HobKnob Solitaire (for Scaffolding homework)
HobKnob is a simple version of solitaire (a
card game). A player randomly picks cards from a deck until an Ace is
found. A score is calculated by adding the values of the cards
drawn based on the
following scoring guide:
Jack of Clubs, Jack of
Spades 10 points
Jack of Diamonds, Jack of Hearts
15 points
Queen of Clubs, Queen of
Spades 14 points
Queen of Diamonds, Queen of Hearts 18 points
King of Clubs, King of
Spades 20 points
King of Diamonds, King of Hearts
22 points
Even non-face
cards
0
points
Odd non-face
cards
value
of card
Aces
0
points
The goal is to get as high a score as possible. This game is pure
luck, there is no skill involved.
The computer version simply deals cards and keeps score for the human
player. A simple console interface allows the user to press
the Enter key to request a card be dealt. The computer displays
the name of the card, the score for that card and the cumulative
total. When an ace is drawn, the game ends.
Sample
Execution
?
D7 pts:7 total:7
?
C9 pts:9 total:16
?
JS pts:10 total:26
?
S8 pts:8 total:26
?
D1 pts:1 total:26
-------------- game over