CPSC 170 Post Lab 3
Crazy Eights Solitaire
Due Before Class on Friday, January 29th


For this assignment you will create a one-player version of the card game Crazy Eights (the card game Uno® is another variation of Crazy Eights). The game begins by dealing, from a deck of 52 cards, 6 cards to the player's hand and one card to a discard pile. The objective of the game is to empty your hand by systematically discarding cards (moving them to the discard pile). To play, the user selects a card from the hand that matches either the suit or the value of the top card of the discard pile. Eights are considered wild (that's why they call it crazy eights). An eight can be placed onto the discard pile no matter what card is on top and the next card that is played to the discard pile can be of any value or suit. If the player does not have any cards that can be placed on the discard pile, the player can draw the top card of the deck of cards that have not been dealt yet. The game is won if the player's hand is empty and the game is lost if the hand exceeds 12 cards.


This assignment builds off of the Card class and the PileOfCards class from lab. The program should display all of the cards in the player's hand (face up), but only the top card of the deck of undealt cards (face down) and the only the top card of the discard pile (face up). If the user clicks on the deck of undealt cards, the top card should be added to the player's hand (only if there is a card in the deck and the player does not already have 12 cards). If the player clicks on a card in the hand, the card should be added to the discard pile (only if the clicked card matches the suit or value of the top card of the discard pile (or either is wild)).

Before you begin writing any code you should think about the design of the program. List the classes and methods you think that you will need to complete the program. Some suggestions are:

You will of course need to implement more methods than this; be sure to plan them out before writing any code. Once you have a good understanding of the structure of your program think about what code you are going to implement first. Remember, you will often save time if you write code in small pieces and test each piece before moving on (also remember to test boundary conditions). As usual use good programming practices, appropriate naming of variables, small methods, correct formatting, and thorough documentation.

Submission: Tar and submit your code on the course blackboard site.