Card Game Help?

I am curious if there is any guides or tutorials based around card games? Specifically I am looking for anything that may teach me how to make the computer shuffle cards recognize individual cards.

Thank you very much in advance. :slight_smile:

An easy method of shuffling is to just loop through the whole deck of cards, and switch cards into another spot randomly

for (int i = 0; i < cards.length; i++)
{
Swap(cards*, cards[Random.Next]);*
}
Something like that (obviously need a swap function which should be easy enough, or already built in)
Recognizing cards isnโ€™t too difficult.
You could just make your deck a string, which cards named C3 (club3) or D10 (diamond 10) etc And use regular expressions to split it or something.
Or you could just use int 1-52 and use a switch statement to break it up
switch (card)
{
case 1-13: suit= club, number = card;
case 14-26: suit= heart, number = card - 13;
case 27-39: suit= diamond, number = card - 26;
case 40-52: suit = spade, number = card - 39;
}
// Obviously not legit code
Hope itโ€™s given you some ideas.

http://forum.unity3d.com/threads/29977-Randomising-shuffling-library?highlight=shuffle+code