-
Notifications
You must be signed in to change notification settings - Fork 0
/
BaseAI.h
60 lines (52 loc) · 1.59 KB
/
BaseAI.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
//Copyright (C) 2009 - Missouri S&T ACM AI Team
//Please do not modify this file while building your AI
//See AI.h & AI.cpp for that
#ifndef BASEAI_H
#define BASEAI_H
#include <vector>
#include <ctime>
#include "game.h"
#include "Move.h"
#include "Piece.h"
#include "Player.h"
/// \brief A basic AI interface.
///This class implements most the code an AI would need to interface with the lower-level game code.
///AIs should extend this class to get a lot of boiler-plate code out of the way
///The provided AI class does just that.
class BaseAI
{
protected:
Connection* c;
std::vector<Move> moves;
std::vector<Piece> pieces;
std::vector<Player> players;
public:
///How many turns it has been since the beginning of the game
int turnNumber();
///Player Number; either 0 or 1
int playerID();
///What number game this is for the server
int gameNumber();
///How many turns until the game ends because no pawn has moved and no piece has been taken
int TurnsToStalemate();
BaseAI(Connection* c);
virtual ~BaseAI();
///
///Make this your username, which should be provided.
virtual const char* username() = 0;
///
///Make this your password, which should be provided.
virtual const char* password() = 0;
///
///This function is run once, before your first turn.
virtual void init() = 0;
///
///This function is called each time it is your turn
///Return true to end your turn, return false to ask the server for updated information
virtual bool run() = 0;
///
///This function is called after the last turn.
virtual void end() = 0;
bool startTurn();
};
#endif