#ifndef NIMM_H #define NIMM_H typedef enum {PLAYER1, PLAYER2} player; class Nim { public: // constructors Nim(); Nim(int initial_size); // accessors bool finished() const; // returns true iff all sticks have been taken int size_of_heap() const; // returns current state of the game (number of sticks) player winner() const; // PRE: finished() is true player next_player() const; // PRE: finished() is false // returns who has to move next // (i.e. to remove sticks from the heap) bool valid(int move) const; // PRE: finished() is false // returns true iff this is a valid move // mutators void perform_move(int move); // PRE: finished() is false and valid(move) is true private: player other_player() const; // returns the other player in respect to whose_turn int heap_size; // current state of the game player whose_turn; // which player has to move next }; #endif