How to play ``Doubles'': The object of the game is to achieve the highest score of all the players. In the computerized version, you compete against the computer. You go first.
Sample behaviors of the program, Doubles.py:
>python Doubles.py Welcome to Doubles! You play first: You rolled 6 and 3 Your score is 9 Do you want to throw the third die (y or n)?: y Your third die is 5 Your total score is 11 The computer plays next: The computer rolled 2 and 2 A Double! Its score is 8 The computer will throw a third die. It is a 3 The computer's score is reduced. The computer's total score is 5 Congratulations --- you won! Press Enter to finish >python Doubles.py Welcome to Doubles! You play first: You rolled 4 and 2 Your score is 6 Do you want to throw the third die (y or n)?: y Your third die is 4 Your total score is 8 The computer plays next: The computer rolled 5 and 5 A Double! Its score is 20 The computer's total score is 20 Sorry --- the computer won. Press Enter to finish >python Doubles.py Welcome to Doubles! You play first: You rolled 1 and 1 A Double! Your score is 4 Do you want to throw the third die (y or n)?: y Your third die is 1 You threw a Triple! Congratulations --- you won! Press Enter to finish
Designing and building the program:
The Doubles game requires some planning before you
start typing. Make sure that you
The program will use if-commands that ask
questions about the numbers of the dice, compare scores, and so on.
To simulate the throw of a die,
use the Python method, random.randrange(1,7),
as demonstrated in lab. See also Dawson's text, Chapter 3.
Once you have completed your program and have tested it to your satisfaction, remember to attach comments to it that document the program's name, its purpose, the input it expects to receive, and the output it will produce.
Submit: By the submission deadline, use the web page at http://www.cis.ksu.edu/~schmidt/200s08/Assign to submit your file, Doubles.py.
Reminder: This is a single-person assignment. You are welcome to discuss the assignment with your instructors, tutors, and other students, but the algorithm you design and the program you write and submit must be your own work, just as if you are submitting an essay for an English Composition course.