2 Heaps | 3 Heaps | 4 Heaps |
---|---|---|
1 1 * | 1 1 1 ** | 1 1 1 1 * |
2 2 | 1 2 3 | 1 1 n n |
3 3 | 1 4 5 | 1 2 4 7 |
4 4 | 1 6 7 | 1 2 5 6 |
5 5 | 1 8 9 | 1 3 4 6 |
6 6 | 2 4 6 | 1 3 5 7 |
7 7 | 2 5 7 | 2 3 4 5 |
8 8 | 3 4 7 | 2 3 6 7 |
9 9 | 3 5 6 | 2 3 8 9 |
(n n) | 4 8 12 | 4 5 6 7 |
4 9 13 | 4 5 8 9 | |
5 8 13 | n n m m | |
5 9 12 | n n n n |
The two-person mathematical game Nim, which many believe originated in China, is probably one of the oldest games in the world.
Wikimedia Commons has media related to Nim. |
def game():
, you should insert:answer=input('Do you want to play again?(y/n)')
at the end of your while answer'y':
loop. This will ask the user for a replay every time, instead of just after the first game.