/Crazy-Eights

Some function definitions to help make computer card game- Crazy Eights. This uses lists and structures where cards are represented by structures.

Primary LanguageRacket

In the card game “crazy eights” players take turns playing a card in the center, with the goal of being the first player without any cards in their hand. Players must play a card that matches the suit of the center card, with two exceptions- 
First, a player may instead play a card that matches the value of the center card. Second, eights are “wild”, so a player may always play an eight. When a player plays an eight, they say the name of a suit. The eight is treated as having this suit, even if it does not. For example, if a player plays the eight of spades, and says “hearts”, then the next card played must be a “hearts” card (or another eight).
Instead of playing a card, the player may draw a card. If they can play the new card they may do so, otherwise this is the end of their turn.
When a player runs out of cards, they have won the hand. The winning player receives points based on what cards the other players are holding.