This program will explore ideas of object-oriented programming by having you implement a form of Dice-based poker. Code for starting this program was introduced in Lab 12.
Lab 12 defined a Dice class that has the basic interface necessary to play a form of dice-based poker. You should be able to use this class (unchanged from a completed lab) to handle the dice. The rest of the program requires a class to handle the money and interact with the user.
The new class to define should be
called Poker
and should have
an __init__
method to create
the Dice
object and set the
initial money
value to 100. There should be
a run
method that keeps playing rounds as long as money
>= 10
and the user agrees. There should be a playRound
method that plays one round of the game.
One round of the game requires a bet of 10. The dice are randomly
rolled. The user is shown the dice and can request that particular
positions be randomly rolled again (by listing them, say [0,2]).
The user gets two opportunities to do this. Then the score of the
dice is determined (using your score
method from Lab
11) and the second result returned from score is added to money.
(For example, Three of a Kind pays a monetary value of 8.) When
the game is over (because the user runs out of money or indicates
they don't want to continue) you should report their money total
and thank them for playing.
When you are convinced that your code works properly, is well-documented, meets the specifications of the API and your name is in the file upload the file.