DealCard handles dealing and shuffling for card games

Category:
Multimedia/Games
Type:
Snippets
Difficulty:
Intermediate
Author:
Larry Serflaten

Version Compatibility:

More information:
The returned value is a number between 0 and 51, indicating which card is being dealt. (See comments for details) This function accepts two types of parameters; If the parameter is a number then the deck will be shuffled and no card will be returned, if the number is greater than 0, then that number indicates how many decks should be shuffled together. If the parameter is a string then that string will be filled with the name of the next card dealt.

When the entire deck has been dealt, a new shuffle will automatically take place.

SYNTAX:
DealCard 4 'Shuffle four decks together
DealCard 0 'Re-shuffle same deck(s)
c = DealCard() 'Return next card value (0-51)
DealCard sCard 'Fill sCard (string) with text name of next
'card

Instructions: Copy the declarations and code below and paste directly into your VB project.

Declarations:

Code: