October 2004
Intermediate to advanced
336 pages
6h 27m
English
This function draws a card from a deck and puts it into a hand. It is meant to be a part of the game Go Fish, so if the resulting hand has all four suits for a given card rank, those four cards are removed from the hand. The next two programs build on this one to produce a full version of the game.
Cards are identified by their rank and suit: the rank is one of the elements of the list ["2", "3", "4", "5", "6", "7", "8", "9", "10", "J", "Q", "K", "A"] and the suit is one of the elements of the list ["spades", "hearts", "diamonds", "clubs"].
A deck is a list that initially contains 52 elements. Each element ...
Read now
Unlock full access