java.lang.ObjectNim
public class Nim
Implements a game of nim, person vs. computer. The game starts with a number of elements chosen by the person. The computer takes 1 or 2 elements. Then the person takes 1 or 2 elements. The game continues until there are no elements left. The play who takes the last turn wins.
Constructor Summary | |
---|---|
Nim()
|
Method Summary | |
---|---|
int |
getComputerMove(int left)
gets the computer's move, 1 or 2. |
void |
play()
plays the game of nim, computer versus person |
Methods inherited from class |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Nim()
Method Detail |
---|
public int getComputerMove(int left)
left
-
public void play()