5 #include "ai_controller.h"
6 #include "human_controller.h"
11 * Class to manage the game
12 * Bit messy since I keep adding on parameters :P
17 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, double newTimeoutTime = 2.0);
18 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, double newTimeoutTime = 2.0);
23 void Wait(double wait);
25 Piece::Colour Setup(const char * redName, const char * blueName);
26 MovementResult CheckVictoryAttrition();
27 MovementResult Play();
28 void PrintEndMessage(const MovementResult & result);
31 static void HandleBrokenPipe(int signal);
32 void ReadUserCommand();
34 const Piece::Colour Turn() const {return turn;}
35 void ForceTurn(const Piece::Colour & newTurn) {turn = newTurn;}
36 int TurnCount() const {return turnCount;}
38 static Game * theGame;
39 static int Tokenise(std::vector<std::string> & buffer, std::string & str, char split = ' '); //Helper - Split a string into tokens
41 int logMessage(const char * format, ...);
42 FILE * GetLogFile() const {return log;}
51 const bool graphicsEnabled;
54 const bool allowIllegalMoves;
60 const Piece::Colour reveal;
63 static bool gameCreated;
68 const bool printBoard;
75 class FileController : public Controller
78 FileController(const Piece::Colour & newColour, FILE * newFile) : Controller(newColour, "file"), file(newFile) {}
79 virtual ~FileController() {}
81 virtual void Message(const char * string) {} //Don't send messages
82 virtual MovementResult QuerySetup(const char * opponentName, std::string setup[]);
83 virtual MovementResult QueryMove(std::string & buffer);
84 virtual bool Valid() const {return file != NULL;}