Sample Run

Return to assignment description

This file contains several examples of output:

In the programs that have input, the input will be in blue with that grey arrow at the place where the user presses the Enter key. It's not part of the output!

TestDeck

Deck Tests ---------- A new deck Deck has correct number of cards: PASS Deck has no duplicates: PASS Deck not missing any cards: PASS Take top card: AS Deck left with correct number of cards: PASS Deals correct number of cards: PASS Deck left with correct number of cards: PASS Correct size after adding a card: PASS Adding hand brings deck back to full size: PASS Added card went to bottom: PASS Added hand went to bottom: PASS A shuffled deck Shuffle seems to reorder things: PASS Deck has correct number of cards: PASS Deck has no duplicates: PASS Deck not missing any cards: PASS Botched commands Drawing from empty deck throws correct exception: PASS Dealing too many cards throws correct exception: PASS Dealing too many cards fails without removing cards: PASS addCard(null) throws correct exception: PASS addCards(null) throws correct exception: PASS addCards(list containing null) throws correct exception: PASS

Crazy8s

This is an example. Each game will be different!
Crazy Eights ------------ The hands have been dealt. The top card has been turned. The top card is 7C It's your turn to play. Your cards are: [2S, 4S, 9S, 8H, JH, 5D, 5C, JC] 1) 8H 2) 5C 3) JC Enter the # of your choice: 3 Player 0 plays JC ...press enter... The top card is JC Player 1 misses a turn! The top card is JC ...draws... ...draws... Player 2 plays AC ...press enter... The top card is AC Player 3 plays KC ...press enter... The top card is KC It's your turn to play. Your cards are: [2S, 4S, 9S, 8H, JH, 5D, 5C] 1) 8H 2) 5C Enter the # of your choice: 2 Player 0 plays 5C ...press enter... The top card is 5C Player 1 plays 6C ...press enter... The top card is 6C ...draws... ...draws... ...draws... ...draws... Player 2 plays 4C ...press enter... The top card is 4C Player 3 plays 3C ...press enter... The top card is 3C It's your turn to play. Your cards are: [2S, 4S, 9S, 8H, JH, 5D] 1) 8H Enter the # of your choice: 1 Player 0 plays 8H ...press enter... The top card is 8H Player 1 plays 8C ...press enter... The top card is 8C ...draws... ...draws... Player 2 plays 8D ...press enter... The top card is 8D ...draws... ...draws... ...draws... Player 3 plays 9D ...press enter... The top card is 9D It's your turn to play. Your cards are: [2S, 4S, 9S, JH, 5D] 1) 9S 2) 5D Enter the # of your choice: 1 Player 0 plays 9S ...press enter... The top card is 9S Player 1 plays 10S ...press enter... The top card is 10S Player 2 plays AS ...press enter... The top card is AS Player 3 plays 7S ...press enter... The top card is 7S It's your turn to play. Your cards are: [2S, 4S, JH, 5D] 1) 2S 2) 4S Enter the # of your choice: 1 Player 0 plays 2S ...press enter... The top card is 2S Player 1 must pick up 2! Player 1 plays 6S ...press enter... The top card is 6S Player 2 plays KS ...press enter... The top card is KS Player 3 plays JS ...press enter... The top card is JS Player 0 misses a turn! The top card is JS ...draws... Player 1 plays 3S ...press enter... The top card is 3S Player 2 plays 3D ...press enter... The top card is 3D ...draws... ...draws... ...draws... Player 3 plays 8S ...press enter... The top card is 8S It's your turn to play. Your cards are: [4S, JH, 5D] 1) 4S Enter the # of your choice: 1 Player 0 plays 4S ...press enter... The top card is 4S ...draws... ...draws... ...draws... Player 1 plays 8D ...press enter... The top card is 8D Player 2 plays 7D ...press enter... The top card is 7D Player 3 plays 7H ...press enter... The top card is 7H It's your turn to play. Your cards are: [JH, 5D] 1) JH Enter the # of your choice: 1 Player 0 plays JH Player 0 says "Last card!" ...press enter... The top card is JH Player 1 misses a turn! The top card is JH Player 2 plays 2H ...press enter... The top card is 2H Player 3 must pick up 2! Player 3 plays 6H ...press enter... The top card is 6H It's your turn to play. Your cards are: [5D] You must draw. ...press enter... You drew a 9S You must draw again! ...press enter... You drew a KC You must draw again! ...press enter... You drew a 10S You must draw again! ...press enter... You drew a 2S You must draw again! ...press enter... You drew a JS You must draw again! ...press enter... You drew a 6C That card is playable (press Enter). Player 0 plays 6C ...press enter... The top card is 6C Player 1 plays QC ...press enter... The top card is QC Player 2 plays QD ...press enter... The top card is QD Player 3 plays QS ...press enter... The top card is QS It's your turn to play. Your cards are: [2S, 9S, 10S, JS, 5D, KC] 1) 2S 2) 9S 3) 10S 4) JS Enter the # of your choice: 1 Player 0 plays 2S ...press enter... The top card is 2S Player 1 must pick up 2! Player 1 plays 8C ...press enter... The top card is 8C ...draws... ...draws... ...draws... ...draws... Player 2 plays 8S ...press enter... The top card is 8S Player 3 plays 5S ...press enter... The top card is 5S It's your turn to play. Your cards are: [9S, 10S, JS, 5D, KC] 1) 9S 2) 10S 3) JS 4) 5D Enter the # of your choice: 3 Player 0 plays JS ...press enter... The top card is JS Player 1 misses a turn! The top card is JS Player 2 plays 6S ...press enter... The top card is 6S Player 3 plays 8H ...press enter... The top card is 8H It's your turn to play. Your cards are: [9S, 10S, 5D, KC] You must draw. ...press enter... You drew a KS You must draw again! ...press enter... You drew a 4C You must draw again! ...press enter... You drew a AC You must draw again! ...press enter... You drew a 7C You must draw again! ...press enter... You drew a 3S You must draw again! ...press enter... You drew a JC You must draw again! ...press enter... You drew a 7S You must draw again! ...press enter... You drew a 4S You must draw again! ...press enter... You drew a 9D You must draw again! ...press enter... You drew a 7D You must draw again! ...press enter... You drew a 5S You must draw again! ...press enter... You drew a QC You must draw again! ...press enter... You drew a 6C You must draw again! ...press enter... You drew a 2H That card is playable (press Enter). Player 0 plays 2H ...press enter... The top card is 2H Player 1 must pick up 2! Player 1 plays KH ...press enter... The top card is KH Player 2 plays KD ...press enter... The top card is KD ...draws... ...draws... ...draws... ...draws... Player 3 plays 8D ...press enter... The top card is 8D It's your turn to play. Your cards are: [3S, 4S, 5S, 7S, 9S, 10S, KS, 5D, 7D, 9D, AC, 4C, 6C, 7C, JC, QC, KC] 1) 5D 2) 7D 3) 9D Enter the # of your choice: 3 Player 0 plays 9D ...press enter... The top card is 9D Player 1 plays 9H ...press enter... The top card is 9H Player 2 plays 10H ...press enter... The top card is 10H Player 3 plays 10C ...press enter... The top card is 10C It's your turn to play. Your cards are: [3S, 4S, 5S, 7S, 9S, 10S, KS, 5D, 7D, AC, 4C, 6C, 7C, JC, QC, KC] 1) 10S 2) AC 3) 4C 4) 6C 5) 7C 6) JC 7) QC 8) KC Enter the # of your choice: 6 Player 0 plays JC ...press enter... The top card is JC Player 1 misses a turn! The top card is JC ...draws... Player 2 plays 8C ...press enter... The top card is 8C Player 3 plays 9C ...press enter... The top card is 9C It's your turn to play. Your cards are: [3S, 4S, 5S, 7S, 9S, 10S, KS, 5D, 7D, AC, 4C, 6C, 7C, QC, KC] 1) 9S 2) AC 3) 4C 4) 6C 5) 7C 6) QC 7) KC Enter the # of your choice: 7 Player 0 plays KC ...press enter... The top card is KC Player 1 plays 3C ...press enter... The top card is 3C Player 2 plays 3D ...press enter... The top card is 3D ...draws... ...draws... ...draws... Player 3 plays 8S ...press enter... The top card is 8S It's your turn to play. Your cards are: [3S, 4S, 5S, 7S, 9S, 10S, KS, 5D, 7D, AC, 4C, 6C, 7C, QC] 1) 3S 2) 4S 3) 5S 4) 7S 5) 9S 6) 10S 7) KS Enter the # of your choice: 7 Player 0 plays KS ...press enter... The top card is KS Player 1 plays JS ...press enter... The top card is JS Player 2 misses a turn! The top card is JS Player 3 plays JH ...press enter... The top card is JH Player 0 misses a turn! The top card is JH Player 1 plays 5H ...press enter... The top card is 5H Player 2 plays 4H ...press enter... The top card is 4H Player 3 plays AH ...press enter... The top card is AH It's your turn to play. Your cards are: [3S, 4S, 5S, 7S, 9S, 10S, 5D, 7D, AC, 4C, 6C, 7C, QC] 1) AC Enter the # of your choice: 1 Player 0 plays AC ...press enter... The top card is AC Player 1 plays AD ...press enter... The top card is AD Player 2 plays 10D ...press enter... The top card is 10D ...draws... ...draws... Player 3 plays 8H ...press enter... The top card is 8H It's your turn to play. Your cards are: [3S, 4S, 5S, 7S, 9S, 10S, 5D, 7D, 4C, 6C, 7C, QC] You must draw. ...press enter... You drew a AD You must draw again! ...press enter... You drew a 9D You must draw again! ...press enter... You drew a AC You must draw again! ...press enter... You drew a 8H That card is playable (press Enter). Player 0 plays 8H ...press enter... The top card is 8H Player 1 plays 3H ...press enter... The top card is 3H Player 2 plays QH ...press enter... The top card is QH Player 3 plays 6H ...press enter... The top card is 6H It's your turn to play. Your cards are: [3S, 4S, 5S, 7S, 9S, 10S, AD, 5D, 7D, 9D, AC, 4C, 6C, 7C, QC] 1) 6C Enter the # of your choice: 1 Player 0 plays 6C ...press enter... The top card is 6C Player 1 plays 6D ...press enter... The top card is 6D Player 2 plays 2D ...press enter... The top card is 2D Player 3 must pick up 2! Player 3 plays 2C ...press enter... The top card is 2C Player 0 must pick up 2! It's your turn to play. Your cards are: [3S, 4S, 5S, 7S, 9S, 10S, 10H, AD, 5D, 7D, 9D, AC, 4C, 7C, JC, QC] 1) AC 2) 4C 3) 7C 4) JC 5) QC Enter the # of your choice: 4 Player 0 plays JC ...press enter... The top card is JC Player 1 misses a turn! The top card is JC ...draws... ...draws... Player 2 plays 8C ...press enter... The top card is 8C Player 3 plays 5C ...press enter... The top card is 5C It's your turn to play. Your cards are: [3S, 4S, 5S, 7S, 9S, 10S, 10H, AD, 5D, 7D, 9D, AC, 4C, 7C, QC] 1) 5S 2) 5D 3) AC 4) 4C 5) 7C 6) QC Enter the # of your choice: 6 Player 0 plays QC ...press enter... The top card is QC Player 1 plays QD Player 1 says "Last card!" ...press enter... The top card is QD Player 2 plays 4D ...press enter... The top card is 4D Player 3 plays KD ...press enter... The top card is KD It's your turn to play. Your cards are: [3S, 4S, 5S, 7S, 9S, 10S, 10H, AD, 5D, 7D, 9D, AC, 4C, 7C] 1) AD 2) 5D 3) 7D 4) 9D Enter the # of your choice: 4 Player 0 plays 9D ...press enter... The top card is 9D Player 1 plays JD ...press enter... Player 1 wins!

PreSolitaire

This game shows what happens if you don't shuffle the deck before you start playing. (NOTE: Your results may differ because your Deck starts off with a different order!)
Solitaire --------- This program plays a simple game of solitaire. Play cards one at a time on top of each other. If the suits of the top and fourth card match, remove the two between them. If the ranks of the top and fourth card match, remove all four top cards. Play until you empty your stack (a win) or the deck runs out (a loss). Programmed by Mark Young (A00000000) ...press enter...<CR> Let's begin! [AS] ...press enter...<CR> [2S, AS] ...press enter...<CR> [3S, 2S, AS] ...press enter...<CR> [4S, 3S, 2S, AS] Suits match: Spades [4S, AS] ...press enter...<CR> [5S, 4S, AS] ...press enter...<CR> [6S, 5S, 4S, AS] Suits match: Spades [6S, AS] ...press enter...<CR> [7S, 6S, AS] ...press enter...<CR> [8S, 7S, 6S, AS] Suits match: Spades [8S, AS] ...press enter...<CR> [9S, 8S, AS] ...press enter...<CR> [10S, 9S, 8S, AS] Suits match: Spades [10S, AS] ...press enter...<CR> [JS, 10S, AS] ...press enter...<CR> [QS, JS, 10S, AS] Suits match: Spades [QS, AS] ...press enter...<CR> [KS, QS, AS] ...press enter...<CR> [AH, KS, QS, AS] Ranks match: Ace [] ...press enter...<CR> You won! ...press enter...<CR>

Solitaire

This is an example. Each game will be different!

BONUS POINTS for re-creating the dots hiding the cards after the 4th. You can get full credit without it.

Solitaire --------- This program plays a simple game of solitaire. Play cards one at a time on top of each other. If the suits of the top and fourth card match, remove the two between them. If the ranks of the top and fourth card match, remove all four top cards. Play until you empty your stack (a win) or the deck runs out (a loss). Programmed by Mark Young (A00000000) ...press enter...<CR> Let's begin! [8C] ...press enter...<CR> [3D, 8C] ...press enter...<CR> [AH, 3D, 8C] ...press enter...<CR> [2S, AH, 3D, 8C] ...press enter...<CR> [7D, 2S, AH, 3D, .] Suits match: Diamonds [7D, 3D, 8C] ...press enter...<CR> [5C, 7D, 3D, 8C] Suits match: Clubs [5C, 8C] ...press enter...<CR> [10C, 5C, 8C] ...press enter...<CR> [9S, 10C, 5C, 8C] ...press enter...<CR> [JD, 9S, 10C, 5C, .] ...press enter...<CR> [7S, JD, 9S, 10C, ..] ...press enter...<CR> [10D, 7S, JD, 9S, ...] ...press enter...<CR> [8D, 10D, 7S, JD, ....] Suits match: Diamonds [8D, JD, 9S, 10C, ..] ...press enter...<CR> [6C, 8D, JD, 9S, ...] ...press enter...<CR> [10S, 6C, 8D, JD, ....] ...press enter...<CR> [KH, 10S, 6C, 8D, .....] ...press enter...<CR> [5D, KH, 10S, 6C, ......] ...press enter...<CR> [3S, 5D, KH, 10S, .......] Suits match: Spades [3S, 10S, 6C, 8D, .....] ...press enter...<CR> [3C, 3S, 10S, 6C, ......] Suits match: Clubs [3C, 6C, 8D, JD, ....] ...press enter...<CR> [JC, 3C, 6C, 8D, .....] ...press enter...<CR> [JH, JC, 3C, 6C, ......] ...press enter...<CR> [7C, JH, JC, 3C, .......] Suits match: Clubs [7C, 3C, 6C, 8D, .....] ...press enter...<CR> [10H, 7C, 3C, 6C, ......] ...press enter...<CR> [KD, 10H, 7C, 3C, .......] ...press enter...<CR> [3H, KD, 10H, 7C, ........] ...press enter...<CR> [5S, 3H, KD, 10H, .........] ...press enter...<CR> [QH, 5S, 3H, KD, ..........] ...press enter...<CR> [KS, QH, 5S, 3H, ...........] ...press enter...<CR> [AD, KS, QH, 5S, ............] ...press enter...<CR> [4H, AD, KS, QH, .............] Suits match: Hearts [4H, QH, 5S, 3H, ...........] Suits match: Hearts [4H, 3H, KD, 10H, .........] Suits match: Hearts [4H, 10H, 7C, 3C, .......] ...press enter...<CR> [8H, 4H, 10H, 7C, ........] ...press enter...<CR> [AS, 8H, 4H, 10H, .........] ...press enter...<CR> [6D, AS, 8H, 4H, ..........] ...press enter...<CR> [4S, 6D, AS, 8H, ...........] ...press enter...<CR> [9C, 4S, 6D, AS, ............] ...press enter...<CR> [AC, 9C, 4S, 6D, .............] ...press enter...<CR> [KC, AC, 9C, 4S, ..............] ...press enter...<CR> [8S, KC, AC, 9C, ...............] ...press enter...<CR> [6S, 8S, KC, AC, ................] ...press enter...<CR> [JS, 6S, 8S, KC, .................] ...press enter...<CR> [QS, JS, 6S, 8S, ..................] Suits match: Spades [QS, 8S, KC, AC, ................] ...press enter...<CR> [2H, QS, 8S, KC, .................] ...press enter...<CR> [6H, 2H, QS, 8S, ..................] ...press enter...<CR> [7H, 6H, 2H, QS, ...................] ...press enter...<CR> [9D, 7H, 6H, 2H, ....................] ...press enter...<CR> [4D, 9D, 7H, 6H, .....................] ...press enter...<CR> [5H, 4D, 9D, 7H, ......................] Suits match: Hearts [5H, 7H, 6H, 2H, ....................] Suits match: Hearts [5H, 2H, QS, 8S, ..................] ...press enter...<CR> [2D, 5H, 2H, QS, ...................] ...press enter...<CR> [QD, 2D, 5H, 2H, ....................] ...press enter...<CR> [2C, QD, 2D, 5H, .....................] ...press enter...<CR> [4C, 2C, QD, 2D, ......................] ...press enter...<CR> [QC, 4C, 2C, QD, .......................] Ranks match: Queen [2D, 5H, 2H, QS, ...................] ...press enter...<CR> [9H, 2D, 5H, 2H, ....................] Suits match: Hearts [9H, 2H, QS, 8S, ..................] ...press enter...<CR> There are no more cards left in the deck. You lose. ...press enter...<CR>

Return to Outline page / assignment description