26 lines
1 KiB
Text
26 lines
1 KiB
Text
'''21''' is a two player game, the game is played by choosing
|
|
a number ('''1''', '''2''', or '''3''') to be added to the ''running total''.
|
|
|
|
The game is won by the player whose chosen number causes the ''running total''
|
|
to reach ''exactly'' '''21'''.
|
|
|
|
The ''running total'' starts at zero.
|
|
One player will be the computer.
|
|
|
|
Players alternate supplying a number to be added to the ''running total''.
|
|
|
|
This game is a variant of [https://en.wikipedia.org/wiki/Nim#The_21_game Nim].
|
|
|
|
;Task:
|
|
Write a computer program that will:
|
|
::* do the prompting (or provide a button menu),
|
|
::* check for errors and display appropriate error messages,
|
|
::* do the additions (add a chosen number to the ''running total''),
|
|
::* display the ''running total'',
|
|
::* provide a mechanism for the player to quit/exit/halt/stop/close the program,
|
|
::* issue a notification when there is a winner, and
|
|
::* determine who goes first (maybe a random or user choice, or can be specified when the game begins).
|
|
|
|
;Related tasks:
|
|
::* [[Nim game]]
|
|
<br><br>
|