CS120
Assignment #4
Due at midnight on Monday Sept. 29th
Beginning with the NIM program make the following modifications:
- Add a running "commentary" to the game, as if there was an announcer making comments when there are particular
numbers of objects left. For example, if there are 6 objects left the "announcer" could say: "It's getting
close now folks." Or when there are 15-18 objects left the "announcer" could say "It's still anyone's game."
Add at least 3 pieces of commentary. (This is problem 6, Chapter 3, from the printed text.)
- Add "graphical" ouput. That is have the program print a row of symbols, like # or *, to represent
the number of objects remaining. This requires a loop that prints num_objects in a row. Have the objects be printed
everytime the program prints how many objects are left, e.g.:
Objects remaining: 8
########
(This is problem 4, Chapter 3, from the printed text.)
- Multiple games and keeping score. Allow the user to play multiple games without restarting the program and
have the program keep track of how many games the player has won and lost. This will require new variables to
keep track of the games won and lost, another loop that surounds most of the program so that when one game ends
another begins, and a place where the program asks the user if they want to paly another game. (This is exercise 8, Chapter 3 from the printed text.)
If you can't get all of the modifications done (and for some of the
assignments you probably won't)
be sure to list which ones you've completed in the comments at the
beginning of the program. On the other hand if you did extra work on a
lab or assignment (and sometime you will want to) also describe the extra work in
the comment at the
beginning of the program.
Include a block of comments at the beginning of the program
(or add to the existing block) that lists your name, section number, date,
and the assignment number. Also include comments on any parts of the
assignment you didn't finish or on any extra work you did.
Include this comment block at the beginning
of every assignment and lab.
Turn in: Name your code file Assignment4SecX.cpp (where X is your section number) and turn in the code for your program (the .cpp file, not a.out) using the
cscheckin command.