Acey Deucey assignment

From WLCS

Objective(s)

  • You will implement the card game Acey Deucey
  • You will design and implement Java classes
  • You will analyze the rules and design the flow of your game

Resource(s)

Direction(s)

Card class

  • Attributes
    • String suit
    • String name
  • Constructor
    • Card() - default constructor
    • Card(String name, String suit) - specific constructor
      • Sets the internal attributes to the same as the parameters
  • Methods
    • String getSuit()
    • void setSuit()
    • String getName()
    • void setName()
    • int getValue()
      • returns the numerical value of the card
    • String toString()
      • returns the String representation of the card in the form "NAME of SUIT"

Deck class

  • Attributes
    • Card[] deck
    • int top
  • Constructor
    • Deck()
      • The deck attribute should be initialized to 52 new Cards
      • You must then go through and set all the values of all the cards
  • Methods
    • void shuffle()
      • Use a loop that swaps random cards around
    • Card deal()
      • Returns the current top card of the deck AND advances the top to the next card
    • void reset()
      • Resets the top index to 0

Acey Deucey class

  1. This class will be where you put your main() method
  2. Write all the comments for the flow of the program (i.e. outline how your program will run in comments)
  3. Implement the game in the main class

Testing Acey Deucey

  1. You will want to test your game and all of its possible scenarios
    • Normal winning (3rd card is inside the first 2 cards)
    • Normal losing (3rd card is outside the first 2 cards)
    • Double loss (3rd card matches one of the first 2 cards)
    • First 2 cards matching - win (correct guess of higher or lower)
    • First 2 cards matching - loss (incorrect guess of higher or lower)
    • First 2 cards matching - triple loss (3rd card matches both first 2 cards)
  2. How do we test all the scenario?
    1. Don't shuffle the deck
    2. Initialize the deck and create the cards in a specific order for testing (see sample list below)
2 of Spades
King of Spades
5 of Spades
4 of Spades
Queen of Spades
3 of Spades
2 of Clubs
10 of Clubs
10 of Hearts
6 of Clubs
6 of Spades
9 of Spades
8 of Spades
8 of Hearts
7 of Spades
Ace of Spades
10 of Spades
Jack of Spades
7 of Clubs
7 of Hearts
7 of Diamonds
3 of Clubs
Ace of Clubs
4 of Clubs
5 of Clubs
8 of Clubs
9 of Clubs
Jack of Clubs
Queen of Clubs
King of Clubs
2 of Hearts
3 of Hearts
4 of Hearts
5 of Hearts
6 of Hearts
9 of Hearts
Jack of Hearts
Queen of Hearts
King of Hearts
Ace of Hearts
2 of Diamonds
3 of Diamonds
4 of Diamonds
5 of Diamonds
6 of Diamonds
8 of Diamonds
9 of Diamonds
10 of Diamonds
Jack of Diamonds
Queen of Diamonds
King of Diamonds
Ace of Diamonds