Class Nim

java.lang.Object
  extended by Nim

public class Nim
extends java.lang.Object

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

Nim

public Nim()
Method Detail

getComputerMove

public int getComputerMove(int left)
gets the computer's move, 1 or 2.

Parameters:
left -
Returns:

play

public void play()
plays the game of nim, computer versus person