-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSquare.h
More file actions
67 lines (58 loc) · 1.29 KB
/
Square.h
File metadata and controls
67 lines (58 loc) · 1.29 KB
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
63
64
65
66
67
#ifndef SQUARE_H_
#define SQUARE_H_
#include <vector>
/*
struct for representing a square in the grid.
*/
struct Square
{
bool isVisible, wasVisible, isWater, isHill, isFood;
char byWater;
int prevAnt, ant, hillPlayer;
int lastSeenTurn;
int timesVisible;
int stationary;
//std::vector<int> deadAnts;
Square()
{
isVisible = wasVisible = isWater = isHill = isFood = false;
byWater = 0;
prevAnt = ant = hillPlayer = -1;
lastSeenTurn = -1000000;
stationary = 0;
};
//resets the information for the square except water information
void reset()
{
if (isWater) {
isVisible = false;
return;
}
if (ant > 0 && prevAnt == ant)
++stationary;
else
stationary = 0;
prevAnt = ant;
isVisible = 0;
isHill = 0;
isFood = 0;
ant = hillPlayer = -1;
//deadAnts.clear();
}
bool setVisible(int turn)
{
if (!isVisible) {
isVisible = 1;
wasVisible = 1;
++timesVisible;
lastSeenTurn = turn;
return true;
}
return false;
}
void putDeadAnt(int who)
{
//deadAnts.push_back(who);
}
};
#endif //SQUARE_H_