-
Notifications
You must be signed in to change notification settings - Fork 0
/
BaseAI.cpp
62 lines (55 loc) · 1.06 KB
/
BaseAI.cpp
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
61
62
//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
#include "BaseAI.h"
#include "game.h"
int BaseAI::turnNumber()
{
return getTurnNumber(c);
}
int BaseAI::playerID()
{
return getPlayerID(c);
}
int BaseAI::gameNumber()
{
return getGameNumber(c);
}
int BaseAI::TurnsToStalemate()
{
return getTurnsToStalemate(c);
}
bool BaseAI::startTurn()
{
static bool initialized = false;
int count = 0;
count = getMoveCount(c);
moves.clear();
moves.resize(count);
for(int i = 0; i < count; i++)
{
moves[i] = Move(getMove(c, i));
}
count = getPieceCount(c);
pieces.clear();
pieces.resize(count);
for(int i = 0; i < count; i++)
{
pieces[i] = Piece(getPiece(c, i));
}
count = getPlayerCount(c);
players.clear();
players.resize(count);
for(int i = 0; i < count; i++)
{
players[i] = Player(getPlayer(c, i));
}
if(!initialized)
{
initialized = true;
init();
}
return run();
}
BaseAI::BaseAI(Connection* conn) : c(conn) {}
BaseAI::~BaseAI() {}