controller.h 976 Bytes
Newer Older
Sam Moore's avatar
Sam Moore committed
1
2
3
4
#ifndef CONTROLLER_H
#define CONTROLLER_H

#include "stratego.h"
5
#include <string>
Sam Moore's avatar
Sam Moore committed
6
7

/**
8
9
 * Class to control a player for Stratego
 * Abstract base class
Sam Moore's avatar
Sam Moore committed
10
11
 */

12
class Controller
Sam Moore's avatar
Sam Moore committed
13
14
{
	public:
15
		Controller(const Piece::Colour & newColour, const char * newName = "no-name") : colour(newColour), name(newName) {}
Sam Moore's avatar
Sam Moore committed
16
17
		virtual ~Controller() {}

18
		MovementResult Setup(const char * opponentName);
Sam Moore's avatar
Sam Moore committed
19

20
		MovementResult MakeMove(std::string & buffer);
Sam Moore's avatar
Sam Moore committed
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
26
27
28
		virtual void Message(const char * string) = 0;

		virtual MovementResult QuerySetup(const char * opponentName, std::string setup[]) = 0;
		virtual MovementResult QueryMove(std::string & buffer) = 0;
29
		virtual bool Valid() const {return true;}
30
31

		const Piece::Colour colour; 
Sam Moore's avatar
Sam Moore committed
32

33
34
		std::string name;

Sam Moore's avatar
Sam Moore committed
35
36
37

};

38
39
40
41




Sam Moore's avatar
Sam Moore committed
42
43
44
#endif //CONTROLLER_H