CPSC 120B: Programming Assignment 4
Playing Chance-It
Due Friday, December 10, 2005 by 4:00 p.m.
In this project you will write a GUI-based program that plays a
modified version of a game called Chance-It. The game involves two
players who play in rounds. In your program one player will be
the computer and the other will be the human user of the program.
The rules of the game:
- During each round, each player takes a turn.
The human will go first each round.
- At the beginning of a turn, the player rolls a pair of dice and
remembers the sum. This sum is called their first roll.
- After the first roll, the player must decide whether to stop or
continue (chance it!). If the player decides to continue, then
he/she/it rolls again. If the roll (sum of the dice)
matches the first roll, the player's
turn is over and the points earned for that turn is 0. If the
roll does not match the first roll, the player has the option of stopping
at that point or continuing.
- The player can continue rolling as long as the roll does not match the
first roll. The player must stop (for that round) whenever the
roll matches the first roll. In that case the points earned for that turn
is 0.
- If the player chooses to stop (before matching the first roll),
their
turn ends and their score for that turn is the maximum number of
points rolled during that turn.
Hence, the player's score for a given turn is either 0 (if the player
rolled the first roll again) or the maximum roll for that turn.
- The player's overall score is the sum of the scores for each round.
- In the real game a fixed number of rounds is played (determined before
the players start). After each player has taken his/her/its turn in the
last round the one with the highest overall score is the winner.
However, for the purposes of this assignment you can have the winner be
the first player to reach some fixed number of points (50 for example).
Requirements
- Your program must have a GUI for the user to interact with. We'll do
a preliminary design of the GUI in class.
- Your program must use classes appropriately (we'll also work on
a design in class). Click here for
the design document which has links to the dice classes and snowman
classes.
- Your program (and all classes) must adhere to good programming
practices. See the requirements on earlier assignments for details.
- Your program must be thoroughly tested.
Document any errors you are aware of !
Any problems that arise in your testing that you don't have time to
fix should be documented either in the internal documentation of the
program (write it in the header documentation of the class or
the main program) OR in a separate document. Such errors should be
described in clear complete English sentences. Undocumented errors
will be penalized more than documented errors.
Grading: The GUI with non-functioning buttons (30%), the game and its
interaction with the GUI
(46%), graphical dice with dots (8%), good programming and testing (16%).
Academic Integrity Reminder: Programming assignments are to be
your own work. You may get help on the specifics of the assignment from
no one except the instructor.
Hand in: A printed copy of all program files. Tar the directory
containing your work and send the tar file to ingram@roanoke.edu.