General discussion

Locked

card game with visual basic

By toliver ·
My question is:I am trying to develop a card game, like the one we played as kids. The one where you laid out all the cards face down and tried to match by memory a pair. My problem is the code to shuffle the cards after a game has been played.

This conversation is currently closed to new comments.

3 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

card game with visual basic

by VinnyD In reply to card game with visual bas ...

You need to generate a seq of random numbers one for each card.

Use a 2 dim array like card(52,2) where you can put each card into card(i,1) and the random number into card(i,2).

Then use a sort to sort the array by the random number in card(i,2).

Using this way you will have to assign a number to each card like 100 for Ace of Spades 101 for Deuce of Spades. 200 for Ace of Hearts etc.

Collapse -

card game with visual basic

by toliver In reply to card game with visual bas ...

Poster rated this answer

Collapse -

card game with visual basic

by toliver In reply to card game with visual bas ...

This question was closed by the author

Back to Web Development Forum
3 total posts (Page 1 of 1)  

Related Discussions

Related Forums