5 #include "ai_controller.h"
6 #include "human_controller.h"
11 * Class to manage the game
16 Game(const char * redPath, const char * bluePath, const bool enableGraphics, double newStallTime = 1.0, const bool allowIllegal=false, FILE * newLog = NULL, const Piece::Colour & newRevealed = Piece::BOTH, int maxTurns = 5000, const bool printBoard = false);
17 Game(const char * fromFile, const bool enableGraphics, double newStallTime = 1.0, const bool allowIllegal=false, FILE * newLog = NULL, const Piece::Colour & newRevealed = Piece::BOTH, int maxTurns = 5000, const bool printBoard = false);
22 void Wait(double wait);
24 Piece::Colour Setup(const char * redName, const char * blueName);
25 MovementResult Play();
26 void PrintEndMessage(const MovementResult & result);
29 static void HandleBrokenPipe(int signal);
30 void ReadUserCommand();
32 const Piece::Colour Turn() const {return turn;}
33 void ForceTurn(const Piece::Colour & newTurn) {turn = newTurn;}
34 int TurnCount() const {return turnCount;}
36 static Game * theGame;
38 int logMessage(const char * format, ...);
39 FILE * GetLogFile() const {return log;}
48 const bool graphicsEnabled;
51 const bool allowIllegalMoves;
57 const Piece::Colour reveal;
60 static bool gameCreated;
65 const bool printBoard;
69 class FileController : public Controller
72 FileController(const Piece::Colour & newColour, FILE * newFile) : Controller(newColour, "file"), file(newFile) {}
73 virtual ~FileController() {}
75 virtual void Message(const char * string) {} //Don't send messages
76 virtual MovementResult QuerySetup(const char * opponentName, std::string setup[]);
77 virtual MovementResult QueryMove(std::string & buffer);
78 virtual bool Valid() const {return file != NULL;}