X-Git-Url: https://git.ucc.asn.au/?p=progcomp2012.git;a=blobdiff_plain;f=judge%2Fmanager%2Fgame.h;h=ce83545bc301eb198d159d9cdd5d08355ad13d8f;hp=2ed35f6b593ce1d05f357370fb532ea993c1eef7;hb=HEAD;hpb=85cfed04e179dad45eefd9fdf747628addbf93fb diff --git a/judge/manager/game.h b/judge/manager/game.h index 2ed35f6..ce83545 100644 --- a/judge/manager/game.h +++ b/judge/manager/game.h @@ -4,6 +4,7 @@ #include "stratego.h" #include "ai_controller.h" #include "human_controller.h" +#include "network_controller.h" #include @@ -14,8 +15,8 @@ class Game { public: - 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); - 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); + 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, const char * newImageOutput = ""); + 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, const char * newImageOutput = ""); virtual ~Game(); @@ -37,8 +38,12 @@ class Game static Game * theGame; static int Tokenise(std::vector & buffer, std::string & str, char split = ' '); //Helper - Split a string into tokens + + private: + void MakeControllers(const char * redPath, const char * bluePath); //Create a controller based off a path public: int logMessage(const char * format, ...); + static void PrintResults(const MovementResult & result, std::string & buffer); FILE * GetLogFile() const {return log;} Controller * red; Controller * blue; @@ -69,6 +74,7 @@ class Game private: double timeoutTime; + std::string imageOutput; }; @@ -78,7 +84,7 @@ class FileController : public Controller FileController(const Piece::Colour & newColour, FILE * newFile) : Controller(newColour, "file"), file(newFile) {} virtual ~FileController() {} - virtual void Message(const char * string) {} //Don't send messages + virtual bool Message(const char * string) {return true;} //Don't send messages virtual MovementResult QuerySetup(const char * opponentName, std::string setup[]); virtual MovementResult QueryMove(std::string & buffer); virtual bool Valid() const {return file != NULL;} @@ -89,6 +95,7 @@ class FileController : public Controller }; +std::string itostr(int i); #endif //MAIN_H