069ccd68a3392be09434f7d32ab9b53816280b67
[progcomp2012.git] / judge / manager / controller.h
1 #ifndef CONTROLLER_H
2 #define CONTROLLER_H
3
4 #include "stratego.h"
5 #include <string>
6
7 /**
8  * Class to control a player for Stratego
9  * Abstract base class
10  */
11
12 class Controller
13 {
14         public:
15                 Controller(const Piece::Colour & newColour, const char * newName = "no-name") : colour(newColour), name(newName) {}
16                 virtual ~Controller() {}
17
18                 MovementResult Setup(const char * opponentName);
19
20                 MovementResult MakeMove(std::string & buffer);
21
22                 virtual bool HumanController() const {return false;} //Hacky... overrides in human_controller... avoids having to use run time type info
23
24                 void Message(const std::string & buffer) {Message(buffer.c_str());}
25                 virtual void Message(const char * string) = 0;
26
27                 virtual MovementResult QuerySetup(const char * opponentName, std::string setup[]) = 0;
28                 virtual MovementResult QueryMove(std::string & buffer) = 0;
29                 virtual bool Valid() const {return true;}
30
31
32                 virtual void Pause() {}         // Hack function (AI_Controller ONLY will overwrite with wrapper to Program::Pause)
33                 virtual void Continue() {}      // Hack function (AI_Controller '' '' wrapper to Program::Continue)
34
35                 const Piece::Colour colour; 
36
37                 virtual void FixName(); //Should be called after setup, sets the name of the controller
38
39                 std::string name;
40
41
42 };
43
44
45
46
47
48 #endif //CONTROLLER_H
49
50

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