-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsamurai2016.cpp
71 lines (63 loc) · 1.18 KB
/
samurai2016.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
63
64
65
66
67
68
69
70
71
#include "samurai2016.hpp"
#ifdef CYGWIN
#include <unistd.h>
#endif
#include <cstdlib>
#include <fstream>
int playOrder;
int totalTurns = 96;
char getChar() {
return cin.get();
}
int getInt() {
char c;
do {
c = getChar();
} while (isspace(c));
int v = 0;
bool negate = (c == '-');
if (negate) c = getChar();
do {
v = 10 * v + c - '0';
c = getChar();
} while (!isspace(c));
if (negate) v = -v;
return v;
}
const int width = 15;
const int height = 15;
void SamuraiState::initSamuraiState(int a, int w) {
int x = getInt();
int y = getInt();
done = getInt() ? true : false;
hidden = (getInt() == 0) ? false : true;
recovery = getInt();
}
void GameInfo::readTurnInfo() {
turn = getInt();
if (turn < 0) exit(0);
for (int a = 0; a != 2; a++) {
for (int w = 0; w != 3; w++) {
SamuraiState &ss = sstates[a][w];
ss.initSamuraiState(a, w);
}
}
for (int y = 0; y != height; y++) {
for (int x = 0; x != width; x++) {
int f = getInt();
}
}
}
int main(int argc, char* argv[]) {
playOrder = getInt();
cout << 0 << endl;
GameInfo info;
while (true) {
info.readTurnInfo();
cout << "0 1 0" << endl;
cout.flush();
if (info.turn >= 94) {
break;
}
}
}