blob: a672f18c9ed804b36b9b118db3a40a8a73e83e72 (
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
|
#include <iostream>
#include <string>
#include <sys/time.h>
#include "common.h"
using namespace std;
int main(void){
struct timeval tv;
gettimeofday(&tv,NULL);
srand(tv.tv_sec*1000000+tv.tv_usec);
Board bd;
char c;
Move mv;
cin>>c; cin.ignore(1024,'\n');
int me=c-'A';
int x,y,i;
for(int turnidx=me;;turnidx+=NPLAYERS){
c=cin.peek();
if(c=='q'||c=='Q')break;
for(i=me+1;i%NPLAYERS!=me;i++){
cin>>x>>y;
if(x!=-1&&y!=-1)bd.put(x,y,i%NPLAYERS);
}
cin.ignore(1024,'\n');
mv=randommove(bd,me);
bd.put(mv.idx(),me);
cout<<mv.x<<' '<<mv.y<<endl;
}
}
|