blob: 363fe4bb01d266c59d96e6755310f085e571cb6b (
plain)
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
|
#include <iostream>
#include <vector>
#include <climits>
#include <cstdlib>
#include <ctime>
#include "higgs.h"
using namespace std;
Move random( Board& board ) {
vector<Move> move_list = board.generateMoves();
if( move_list.size() == 0 )
return {-1,-1,-1};
return move_list[ rand() % move_list.size() ];
}
Move importMove() {
Move move;
cin >> move.ndir >> move.p >> move.dir;
return move;
}
void exportMove( Move move ) {
cout << move.ndir << " " << move.p << " " << move.dir << endl;
}
int main() {
Board board;
Move move;
string input;
srand( time( NULL ) );
cin >> input;
if( input == "go" ) {
//board.print();
move.ndir = -1;
move.p = S-2;
move.dir = 4;
board.doMove( move );
exportMove( move );
}
while( 1 ) {
//board.print();
board.doMove( importMove() );
//board.print();
move = random( board );
board.doMove( move );
exportMove( move );
}
}
|