-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathtest.cpp
More file actions
35 lines (33 loc) · 728 Bytes
/
Copy pathtest.cpp
File metadata and controls
35 lines (33 loc) · 728 Bytes
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
#include <cstdio>
#include <cassert>
#include <unistd.h>
#include <vector>
#include "board.hpp"
#include "common.hpp"
#include "player.hpp"
int main(int argc, char *argv[]) {
Player *player[2];
player[0] = new Player(BLACK);
player[1] = new Player(WHITE);
Board b;
Move *m[2];
m[0] = nullptr;
m[1] = nullptr;
int idx = 0;
while (!b.isDone()) {
m[idx] = player[idx]->doMove(m[(idx+1)%2], 300000);
if (m[idx] && *m[idx] != Move(-1, -1)) {
assert(b.doMove(*m[idx], idx? WHITE:BLACK));
}
idx = (idx+1)%2;
if (m[idx]) {
delete m[idx];
m[idx] = nullptr;
}
}
delete player[0];
delete player[1];
if (m[(idx+1)%2]) {
delete m[(idx+1)%2];
}
}