Homework #19 (Due: Mon 06 Apr / Wed 15 Apr)
Write a program that will allow a user to play a dice game against the
computer. I'm calling the game ``Drop Dead Remix'' ...it is a
variation of a game called ``Drop Dead''.
The rules for the original game are described at
A good game requiring five dice and a score sheet. Play: Each player
in turn rolls the five dice and scores when none of the dice thrown
show a 2 or a 5. If a 2 or a 5 are not thrown the player scores the
total of the numbers rolled. If a 2 or 5 is thrown they score nothing
and put to one side all the dice showing a 2 or 5. These dice are dead
and the player continues rolling without them, putting to one side any
dice showing a 2 or a 5 and scoring when neither are thrown, until all
the dice are eliminated. Once the final die has turned up as a 2 or 5
the player is said to have dropped dead and it is the next player's
turn. A running tally of a player's score is kept and the player with
the highest score after every player has had a turn wins the game
Drop Dead Remix follows the same rules as Drop Dead except for these additional
- After each role the player is given an option to end their turn
early. Their final turn score is multiplied by the number of live dice
remaining. Thus if a person plays until all dice are dead then their
turn score will be multiplied by 0 resulting in a score of 0.
- Game continues until one or more players reach 200 points. If
multiple players reach 200 points in a single round then the player
with the highest score wins.
After a game is complete, your program will name the winner (or declare a
tie if appropriate) and then allow the user to indicate whether or not
they want to play another game.
This program would be difficult to write if you were required to do so
without using methods. The first challenge, then, is to decide how to
split the assignment into parts. I recommend the following steps:
- Play the game with a friend (keeping track of turns, scores, etc.,
by hand). Try to observe the steps you find yourself doing and realize
that you will need the computer to perform the same tasks.
- Try to describe a solution to this problem using two, three, or
four steps. Plan to use a method to solve each of those steps.
Put your plan in writing.
- For each method (from the previous step) try to describe how it
can be accomplished using fewer than 10 statements. If any of those
statements is fairly complex then plan for those to be a separate
method. Put your plan in writing.
- Continue decomposing the problem until each step is fairly
well-defined. Continue to write down each set of steps.
At the end of this process you should have identified four or five
individual methods and you should have fairly detailed steps for what
each method will have to accomplish.
With your design (algorithm) in hand, you are ready to begin writing the
program. Start by selecting one of the ``bottom-most'' methods (i.e., one
that doesn't call any other methods) and implementing it. Test it
thoroughly before you move on to other methods. Continue implementing
methods one-by-one from the bottom-up until you are finished! This game
requires the use of 5 dice, so I recommend storing the dice as an array.
I have provided a method that will display dice values in an array
using ASCII art. The method is available at
When turning in your program, you should bring a printout of your source
code to class. In addition you should email a copy of your source code
to the homework account: firstname.lastname@example.org.
The design portion of the assignment is has 15 possible points and will be
graded according to the level of detail provided and whether or not the
design is correct (in terms of producing the desired outcome).
The coding portion of this assignment will be graded according to the