CS1050, Spring 2006, Project 4
Nim
by Jacob Bolton
Email:
Submitted: February 20, 2006
n - starts a new game with the player first
N - starts a new game with the computer first
The question with this project is if the computer's moving scheme is a winning scheme. A winning scheme is defined as one that "ensures victory of at least one of the two games of a match." I will show that this is not the case by having the player win both matches. Here is the console transcript for the first game:
New Board with [ 7 5 10 ] Player: Board with [ 0 5 10 ] Computer: Board with [ 0 5 9 ] Player: Board with [ 0 1 9 ] Computer: Board with [ 0 1 8 ] Player: Board with [ 0 1 1 ] Computer: Board with [ 0 0 1 ] Player: Board with [ 0 0 0 ]The player removed the last stone and therefore won the game. In the second match the computer moves first:
New Board with [ 15 11 8 ] Computer: Board with [ 14 11 8 ] Player: Board with [ 0 11 8 ] Computer: Board with [ 0 10 8 ] Player: Board with [ 0 1 8 ] Computer: Board with [ 0 1 7 ] Player: Board with [ 0 1 1 ] Computer: Board with [ 0 0 1 ] Player: Board with [ 0 0 0 ]Even though the computer had the first move, the player was still able to win. Since the computer could not win at least one game, its moving scheme is not a winning scheme.
Source code: P4
Built with Processing