10
Answers

Card game...

yusuf

yusuf

16y
2.8k
1

Hello !

I have been trying to write a poker game program. i added 52 playing cards to an array. I can give the user 5 cards randomly. But the problem is that it should not be the same cards in a hand.i could not do that. Here are the codes :

string[] kagitlar ={"Kupa 1","Kupa 2","Kupa 3","Kupa 4","Kupa 5","Kupa 6","Kupa 7","Kupa 8",
"Kupa 9","Kupa 10","Kupa Kiz","Kupa Vale","Kupa Papaz",
"Sinek 1","Sinek 2","Sinek 3","Sinek 4","Sinek 5","Sinek 6","Sinek 7","Sinek 8",
"Sinek 9","Sinek 10","Sinek Vale","Sinek Kiz","Sinek Papaz",
"Karo 1","Karo 2","Karo 3","Karo 4","Karo 5","Karo 6","Karo 7","Karo 8","Karo 9",
"Karo 10","Karo Vale","Karo Kiz","Karo Papaz",
"Maça 1","Maça 2","Maça 3","Maça 4","Maça 5","Maça 6","Maça 7","Maça 8","Maça 9",
"Maça 10","Maça Vale","Maça Kiz","Maça Papaz"};

privatevoid button1_Click(object sender, EventArgs e)
{
Random rd = newRandom();
for (int i = 5; i>0; i--)
{
int indeks = rd.Next(0, kagitlar.Length);
listBox1.Items.Add(kagitlar[indeks].ToString());

//kagitlar[indeks].Remove(kagitlar[indeks]); i tried this,did not work...
}
}

 

thanks ..

 

Answers (10)