#ifndef ARRAY_GAME_H #define ARRAY_GAME_H #include #include "Game.h" #include "GameOverException.h" using namespace std; /** * An array-based implementation of the game class. */ class ArrayGame : public Game { public: /** * A constructor, where the parameters N and K are interpetted, as * described in the documentation for the class Game, and which are * assumed to be positive integers. */ ArrayGame(int N, int K); /** * Returns the number of players who currently remaining in the game. */ int size() const; /** * Plays a single round, eliminating one player. This method can be * called repeatedly to simulate several consecutive rounds of the * game. * * If there is only one player in the game, throws a * GameOverException, rather than removing the last player. * * The return value is The ID of the removed player. */ int playRound() throw(GameOverException); /** * Completes the entire game, from the current state. * (i.e. equivalent to calling playRound repeatedly until size is * one). * * The return value should be the ID of the sole surviving player. */ int completeGame(); /** * This method toggles the 'verbose' setting. The return value * indicates the new setting. * * The default behavior should be with verbose set to false, in * which case no output is to be generated by the other methods. * * If verbose is set to true, subsequent steps of the game should * produce a message, printed to the standard output stream, to * document the play of the game. * * This method may be called more than once, if setting changes are * desired while a game is in progress. */ bool toggleVerbose(); /** * Destructor */ ~ArrayGame(); private: // add any private methods or private state information which you // deem necessary }; #endif