A game!

Due: 4 Nov 2005

Educational objectives:

Statement of work: (i) Implement generic stack and queue classes, and (ii) use your stack class to play the game NIM, as described below.

Deliverables:

Background: This game involves two players, and starts with a certain number of heaps of objects (say sticks), with each heap containing a certain number of sticks (the number may vary from heap to heap). The players alternate in taking turns. In each turn, a player has to remove objects from exactly one heap. The player may remove any number of sticks from that heap, but must remove at least one. The game ends when there are no more sticks left in any of the heaps. The last player to remove a stick loses.

Requirements:

Sample executable: A sample executable is available at ~cop4530/fall05/bin/nim on linprog. The first person to find errors in our program will get a bonus point!

Bonus points:

You may get up to 10 additional points for providing a good GUI interface. You may also get 10 additional points if your implementation plays as well as ours!

Notes:

  1. You should not use the STL list, vector, deque, stack, or queue classes. You may use the string class. Please get my permission before using any other STL feature.
  2. We will test your stack and queue classes on entirely different applications. So it is important for these classes to be generic and exactly as specified.
  3. You will be graded on your user interface too.

Last modified: 12 Oct 2005