9a02044e1dbc8f5ee383600ee5f96c006e7443cb
[progcomp2012.git] / manager / game.h
1 #ifndef MAIN_H
2 #define MAIN_H
3
4 #include "stratego.h"
5 #include "ai_controller.h"
6 #include "human_controller.h"
7
8
9
10 /**
11  * Class to manage the game
12  */
13 class Game
14 {
15         public:
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);
17                 virtual ~Game();
18
19                 
20
21                 void Wait(double wait); 
22
23                 bool Setup(const char * redName, const char * blueName);
24                 MovementResult Play();
25                 void PrintEndMessage(const MovementResult & result);
26                 
27
28                 static void HandleBrokenPipe(int signal);
29                 
30                 
31                 const Piece::Colour Turn() const {return turn;}
32                 int TurnCount() const {return turnCount;}
33
34                 static Game * theGame;
35         private:
36                 int logMessage(const char * format, ...);
37                 Controller * red;
38                 Controller * blue;
39                 Piece::Colour turn;
40                 
41         public:
42                 Board theBoard;
43         private:
44                 const bool graphicsEnabled;
45                 double stallTime;
46         public:
47                 const bool allowIllegalMoves;
48
49         private:
50                 FILE * log;
51                 Piece::Colour reveal;
52                 int turnCount;
53                 
54 };
55
56
57 #endif //MAIN_H

UCC git Repository :: git.ucc.asn.au