time due | submission file |
---|---|
last day of class | csci/431/HW8/yourid.h
csci/431/HW8/yourid.cpp |
This is the same game as Homework 7 but this time it is played in C++. Start by extracting a "driver" implementation containing the following four files:
OddWinsPlayer.h | A C++ abstract class that your code must extend. |
Home8Test.cpp | A C++ program for testing a class extending OddWinsPlayer |
Home8Play.cpp | A C++ program for playing two classes extending OddWinsPlayer against each other |
Makefile | The start of a Makefile |
Your task is to write a C++ class that extends
OddWinsPlayer
Your class should should have a default constructor (taking
no argument) implement the following five methods of
OddWinsPlayuer
opponentTakes(N)
: Called to inform your object
that the opponent has taken N
counters.
Return 1, if this seems legitimate; and return 0, otherwise.
If your oppenent takes 5 tokens or doesn't allow you a turn,
that would not be legitimate.myTakes()
: Called on your "turn" to obtain the number of
counters you wish to take.
Again return 0, if this call doesn't seem appropriate.setBoardSize(N)
:
Called to inform your object that the board has N counters.
Again return 0, if this call doesn't seem appropriate.setMaxMoves(N)
:
Called to inform your object that at most N counters
can be taken on a single move.
Again return 0, if this call doesn't seem appropriate.resetGame()
:
Called to inform your object that a new game is starting.
Copy and yourid.h and yourid.cpp to the assignment drop-off directory.
You can perform some limited "sanity" tests for your module by running it against the Home8Test included in the homework ZIP file.