### 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

1. Your program must have a GUI for the user to interact with. We'll do a preliminary design of the GUI in class.