-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
895 lines (648 loc) · 22.6 KB
/
main.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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
#include "yinsh.h"
int player_num,rings_num,markers_num;
float time_left;
Yinsh game;
Place ring_to_xy(int hex,int pos)
{
Place ans ={0,0};
if(hex==0 && pos==0){
ans.x = 0;
ans.y = 0;
}
else if(pos<hex){
ans.x=hex;
ans.y=pos;
}
else if(pos<2*hex){
ans.x=2*hex - pos;
ans.y=hex;
}
else if(pos<3*hex){
ans.x=2*hex -pos;
ans.y=3*hex-pos;
}
else if(pos<4*hex){
ans.x=-hex;
ans.y=3*hex-pos;
}
else if(pos<5*hex){
ans.x=pos-5*hex;
ans.y=-hex;
}
else {
ans.x=pos-5*hex;
ans.y=pos-6*hex;
}
ans.x=ans.x+rings_num;
ans.y=ans.y+rings_num;
return ans;
}
Place xy_to_ring(int x,int y)
{
Place ans ={0,0};
x=x- rings_num ;
y=y- rings_num ;
if(x==0 && y==0){
ans.x=0;
ans.y=0;
}
else if(x>=y)
{
if(x>=0 && y>=0){
ans.x=x;
ans.y=y;
}
else if(x<=0 && y<=0)
{
ans.x = -y;
ans.y = x-(5*y);
}
else if(x>=0 && y<=0)
{
ans.x=x-y;
ans.y = 6*x - 5*y;
}
}
else if (y>x)
{
if(x>=0 && y>=0)
{
ans.x=y;
ans.y = 2*y-x;
}
else if(x<=0 && y<=0)
{
ans.x=-1*x;
ans.y = (-3*x)-y;
}
else if(x<=0 && y>=0)
{
ans.x = y-x;
ans.y = 2*y - 3*x;
}
}
return ans;
}
void input_moves(vector<Move> &in_moves)
{
string mov_ty;
int x1,y1;
string word;
string dup;
getline(cin,dup);
while(dup.length()==0){
getline(cin,dup);
}
stringstream ss(dup);
// cerr<<"Move received : "<<dup<<endl;
while(ss>>word)
{
mov_ty = word;
// cerr <<word<<" ";
ss>>word;
x1 = stoi(word);
// cerr<<x1<<" ";
ss>>word;
y1=stoi(word);
// cerr << y1<<" ";
// Place p = {0,0};
Place p = ring_to_xy(x1,y1);
Move mv = {mov_ty,p.x,p.y};
// cerr<<"Move received : "<<mov_ty<<" "<< p.x<<" "<< p.y<<endl;
in_moves.push_back(mv);
}
// cerr<<endl;
}
// void eval_neigh(Place dup_sel,vector<Place>& neighb,int id,vector<Place>& neighbour_new){
// vector< vector<int> > original_board = game.myboard ;
// vector< vector<Place> > original_player_rings = game.player;
// map <float, int> m1 ;
// vector<float > p_nei;
// for(int i_1=0;i_1<neighb.size();i_1++){
// game.select_movering(dup_sel,neighb[i_1],id);
// m1[game.evaluate_reward(id)] = i_1;
// p_nei.push_back(game.evaluate_reward(id));
// game.myboard = original_board;
// game.player = original_player_rings;
// }
// sort(p_nei.begin(), p_nei.end());
// // cerr<<"sorted"<< dup_sel.x<<" "<< dup_sel.y <<endl;
// for(int i_1=0;i_1<p_nei.size();i_1++){
// // game.select_movering(dup_sel,neighb[i_1],id);
// neighbour_new.push_back (neighb[m1[p_nei[i_1]]]);
// }
// }
float minimax(int depth,float alpha , float beta , bool isMax_player){
if(depth==0){
game.evaluate_reward(player_num);
}
else{
if(isMax_player){
float best_child = INT_MIN;
// our player num will be maximising so turn = id = player_num
vector<Place> dup_ringlist ;
vector<Place> neighb;
vector<Place> neighb_new;
for(int i_1=0;i_1<rings_num;i_1++){
if(game.player[player_num][i_1].x==-10){
continue;
}
else{
Place p1_1={game.player[player_num][i_1].x,game.player[player_num][i_1].y};
dup_ringlist.push_back(p1_1);
}
}
// original board before sel move child
vector< vector<int> > inter_board = game.myboard ;
vector< vector<Place> > inter_player_rings = game.player;
for(int i_1=0;i_1<dup_ringlist.size();i_1++)
{
Place dup_sel = dup_ringlist[i_1];
// if(!game.totcheck_surr(dup_sel,player_num)){
// continue;
// }
neighb.resize(0);
game.totneighbours(dup_sel,neighb);
// neighb_new.resize(0);
// game.totneighbours(dup_sel,neighb_new);
// neighb.resize(0);
// eval_neigh(dup_sel,neighb_new,player_num,neighb);
for(int i_2=neighb.size()-1;i_2>=0;i_2--)
{
game.select_movering(dup_sel,neighb[i_2],player_num);
vector< vector<Place>> five_rows;
if(player_num==1){
game.check_five(-1,five_rows);
}
else{
game.check_five(1,five_rows);
}
if(five_rows.size()!=0){
//vector<Place> rs_re = five_rows[0];
Place rs = five_rows[0][0];
Place re = five_rows[0][1];
game.remove_row(rs,re,player_num);
int max_diff=0;
int ind_s =0;
int diff1 =0;
for(int ii =0;ii<rings_num;ii++){
diff1 =0;
if(game.player[player_num][ii].x !=-10){
// diff1 = diff1+ totcheck_linering(player[id][i],id);
// diff1 = diff1+ game.totcheck_linering(game.player[player_num][ii],0);
// diff1 = diff1+ game.totcheck_linering(game.player[player_num][ii],1);
diff1 = diff1+ game.totcheck_linering(game.player[player_num][ii],2);
diff1 = diff1+ game.totcheck_linering(game.player[player_num][ii],3);
if(max_diff<=diff1){
max_diff = diff1;
ind_s = ii;
}
}
}
game.remove_ring(game.player[player_num][ind_s],player_num);
// game.remove_ring(dup_ringlist[i_1],player_num);
}
// game.check_five
float child = minimax(depth-1,alpha,beta,!isMax_player);
best_child = max(best_child,child);
alpha = max(alpha,child);
if(alpha>=beta){
return best_child;
}
game.myboard = inter_board;
game.player = inter_player_rings;
}
}
return best_child;
}
else if(!isMax_player){
float best_child = INT_MAX;
int turn;
vector<Place> dup_ringlist ;
vector<Place> neighb;
vector<Place> neighb_new;
if(player_num ==1){
turn =0;
}
else{
turn =1;
}
for(int i_1=0;i_1<rings_num;i_1++){
if(game.player[turn][i_1].x==-10){
continue;
}
else{
Place p1_1 = {game.player[turn][i_1].x,game.player[turn][i_1].y};
dup_ringlist.push_back(p1_1);
}
}
// original board before sel move child
vector< vector<int> > inter_board = game.myboard ;
vector< vector<Place> > inter_player_rings = game.player;
for(int i_1=0;i_1<dup_ringlist.size();i_1++)
{
Place dup_sel = dup_ringlist[i_1];
// if(!game.totcheck_surr(dup_sel,turn)){
// continue;
// }
neighb.resize(0);
game.totneighbours(dup_sel,neighb);
// neighb_new.resize(0);
// game.totneighbours(dup_sel,neighb_new);
// neighb.resize(0);
// eval_neigh(dup_sel,neighb_new,turn,neighb);
for(int i_2=0;i_2<neighb.size();i_2++)
{
game.select_movering(dup_sel,neighb[i_2],turn);
vector< vector<Place>> five_rows;
if(turn==1){
game.check_five(-1,five_rows);
}
else{
game.check_five(1,five_rows);
}
if(five_rows.size()!=0){
//vector<Place> rs_re = five_rows[0];
Place rs = five_rows[0][0];
Place re = five_rows[0][1];
game.remove_row(rs,re,turn);
int max_diff=0;
int ind_s =0;
int diff1 =0;
for(int ii =0;ii<rings_num;ii++){
diff1 =0;
if(game.player[turn][ii].x !=-10){
// diff1 = diff1+ totcheck_linering(player[id][i],id);
// diff1 = diff1+ game.totcheck_linering(game.player[turn][ii],0);
// diff1 = diff1+ game.totcheck_linering(game.player[turn][ii],1);
diff1 = diff1+ game.totcheck_linering(game.player[turn][ii],2);
diff1 = diff1+ game.totcheck_linering(game.player[turn][ii],3);
if(max_diff<=diff1){
max_diff = diff1;
ind_s = ii;
}
}
}
game.remove_ring(game.player[turn][ind_s],turn);
// game.remove_ring(dup_ringlist[i_1],turn);
}
// game.check_five
float child = minimax(depth-1,alpha,beta,isMax_player);
best_child = min(child,best_child);
beta = min(beta,child);
if(alpha>=beta){
return best_child;
}
game.myboard = inter_board;
game.player = inter_player_rings;
}
}
return best_child;
}
}
}
// explore neighbours and find path
void find_moves(vector<Move> &best_moves,int id)
{
int depth =3;
if(time_left<40){
depth = 2;
}
else if(time_left<10){
depth = 1;
}
// cerr<< "find_move" << game.evaluate_reward(id)<<endl;
// if(game.evaluate_reward(id)<.1){
// depth=1;
// }
// if(game.evaluate_reward(id)<1){
// depth=2;
// }
// else{
// depth=3;
// }
bool isMax_player = true;
// copied from below miniax maximising player
vector<Place> dup_ringlist ;
vector<Place> neighb;
vector<Place> neighb_new;
for(int i_1=0;i_1<rings_num;i_1++){
if(game.player[id][i_1].x==-10){
continue;
}
else{
Place p1_1={game.player[id][i_1].x,game.player[id][i_1].y};
dup_ringlist.push_back(p1_1);
}
}
// cerr<< "find move id "<< id<< endl;
// original board before sel move child
vector< vector<int> > original_board = game.myboard ;
vector< vector<Place> > original_player_rings = game.player;
float best_child = INT_MIN;
for(int i_1=0;i_1<dup_ringlist.size();i_1++)
{
Place dup_sel = dup_ringlist[i_1];
// if(!game.totcheck_surr(dup_sel,id)){
// continue;
// }
// neighb.resize(0);
// game.totneighbours(dup_sel,neighb);
neighb_new.resize(0);
// eval_neigh(dup_sel,neighb,id,neighb_new);
game.totneighbours(dup_sel,neighb_new);
if(time_left>80){
if(neighb_new.size()<5){
depth = 4;
}
else{
depth =3;
}}
else{
depth=3;
}
// cerr<< "neighb "<<neighb_new.size()<<endl;
for(int i_2=neighb_new.size()-1;i_2>=0;i_2--)
{
float alpha = INT_MIN;
float beta = INT_MAX;
float g1 = game.evaluate_reward(id);
game.select_movering(dup_sel,neighb_new[i_2],id);
float g2 = game.evaluate_reward(id);
//
float di_f = abs (g1-g2);
if(di_f<10){
depth=2;
}
// else if(di_f<10){
// depth=3;
// }
vector< vector<Place>> five_rows;
if(player_num==1){
game.check_five(-1,five_rows);
}
else{
game.check_five(1,five_rows);
}
// removing dup ring lists first elemt for randomness can be improved also directly taking first five row formed
int ch=0;
if(five_rows.size()!=0){
// cerr<< "entered 5 row:"<< five_rows[0][0].x<< " "<<five_rows[0][0].y<<endl;
//vector<Place> rs_re = five_rows[0];
Place rs = five_rows[0][0];
Place re = five_rows[0][1];
game.remove_row(rs,re,id);
// bool b_t = true;
// ch=0;
// while( ch<rings_num){
// if(game.player[player_num][ch].x!=-10 && game.player[player_num][ch].y!=-10 && (game.player[player_num][ch].x != dup_sel.x || game.player[player_num][ch].y != dup_sel.y ) ){
// cerr<<"entered "<<game.player[player_num][ch].x<<" "<<game.player[player_num][ch].y<< endl;
// game.remove_ring(game.player[player_num][ch],player_num);
// break;
// }
// else{
// ch++;
// }
// }
int diff1 =0;
int ind_s=0;
int v_send =0;
// if(id==0){
// v_send=;
// }
// else{
// v_send =
// }
int max_diff=0;
for(int ii =0;ii<rings_num;ii++){
diff1 =0;
if(game.player[id][ii].x !=-10){
// diff1 = diff1+ totcheck_linering(player[id][i],id);
// diff1 = diff1+ game.totcheck_linering(game.player[id][ii],0);
// diff1 = diff1+ game.totcheck_linering(game.player[id][ii],1);
diff1 = diff1+ game.totcheck_linering(game.player[id][ii],2);
diff1 = diff1+ game.totcheck_linering(game.player[id][ii],3);
if(max_diff>=diff1){
max_diff = diff1;
ind_s = ii;
}
}
}
game.remove_ring(game.player[id][ind_s],id);
}
// game.check_five
float child = minimax(depth-1,alpha,beta,!isMax_player);
// cerr<<"inside"<< child<< " "<<best_child<<endl;
if(best_child<=child){
best_moves.resize(0);
best_moves.push_back({"S",dup_sel.x,dup_sel.y});
best_moves.push_back({"M",neighb_new[i_2].x,neighb_new[i_2].y});
if(five_rows.size()!=0){
best_moves.push_back({"RS",five_rows[0][0].x,five_rows[0][0].y});
best_moves.push_back({"RE",five_rows[0][1].x,five_rows[0][1].y});
best_moves.push_back({"X",neighb_new[i_2].x,neighb_new[i_2].y});
}
best_child = child;
}
game.myboard = original_board;
game.player = original_player_rings;
if(best_moves.size()==5){
break;
}
}
}
}
void print_rings(){
for(int i=0;i<rings_num;i++){
Place p1 = xy_to_ring(game.player[0][i].x,game.player[0][i].y);
Place p2 = xy_to_ring(game.player[1][i].x,game.player[1][i].y);
// cerr<< " 1st "<< p1.x << " "<<p1.y << "2nd "<<p2.x <<" "<<p2.y <<endl;
}
}
// int num_ring_presently(int id){
// int ans;
// for(int i=0;i<rings_num;i++){
// if(game.player[id][i].x !=-10 ){
// ans++;
// }
// }
// return ans;
// }
void play(int id)
{
int turn=0;
vector<Move> playermoves,oppmoves;
if(id==1){
// cerr<<"Player 2 em"<<endl;
input_moves(oppmoves);
game.execute_seq(oppmoves,turn);
turn = turn ^ 1;
}
// cerr<< "starting"<<endl;
// print_rings();
int ring_p=0;
int pos_p=0;
Place rec_ring_pos={0,0};
int num_rings_placed =0;
while(num_rings_placed < rings_num ){
bool b = true;
while(b)
{
rec_ring_pos = ring_to_xy(ring_p,pos_p);
if(game.myboard[rec_ring_pos.x][rec_ring_pos.y]!=0)
{
pos_p++;
if(pos_p <= 6*ring_p-1){
}
else{
ring_p++;
pos_p=0;
}
}
else{
b=false;
}
}
game.place_ring(rec_ring_pos.x,rec_ring_pos.y,turn);
// cerr<< " my playerring rings"<< num_rings_placed << " board: "<< game.myboard[rec_ring_pos.x][rec_ring_pos.y]<< " ring_p "<< ring_p <<" pos_p "<<pos_p<<endl;
cout<< "P "<< ring_p <<" "<< pos_p <<endl;
turn = turn ^1;
oppmoves.resize(0);
input_moves(oppmoves);
// cerr<< " other player : "<<oppmoves[0].type<<" "<< oppmoves[0].x <<" "<<oppmoves[0].y<<endl;
game.execute_seq(oppmoves,turn);
turn = turn^1;
num_rings_placed++;
// cerr<< "after rings placed"<<endl;
// print_rings();
//
}
while(true){
vector<Place> dup_ringlist ;
// cerr<< "frst"<< turn<< endl;
for(int i_1=0;i_1<rings_num;i_1++){
if(game.player[turn][i_1].x==-10){
continue;
}
else{
Place p1_1={game.player[turn][i_1].x,game.player[turn][i_1].y};
dup_ringlist.push_back(p1_1);
}
}
bool b_w=true;
while(b_w){
playermoves.resize(0);
vector< vector<Place>> five_rows;
if(player_num==1){
game.check_five(-1,five_rows);
}
else{
game.check_five(1,five_rows);
}
if(five_rows.size()!=0){
//vector<Place> rs_re = five_rows[0];
Place rs = five_rows[0][0];
Place re = five_rows[0][1];
Place xrem ;
game.remove_row(rs,re,turn);
int ch=0;
while( ch<rings_num){
if(game.player[turn][ch].x!=-10 && game.player[turn][ch].y!=-10 ){
// cerr<<"entered find"<<game.player[player_num][ch].x<<" "<<game.player[player_num][ch].y<< endl;
xrem = game.player[turn][ch];
game.remove_ring(game.player[turn][ch],turn);
break;
}
else{
ch++;
}
}
// game.remove_ring(neighb[i_2],player_num);
// game.remove_ring(dup_ringlist[0],player_num);
// playermoves.push_back({"RS",five_rows[0][0].x,five_rows[0][0].y});
Place hex_coord ;
hex_coord = xy_to_ring(five_rows[0][0].x,five_rows[0][0].y);
cout<< "RS" << " "<< hex_coord.x << " "<< hex_coord.y<<" ";
hex_coord = xy_to_ring(five_rows[0][1].x,five_rows[0][1].y);
cout<< "RE" << " "<< hex_coord.x << " "<< hex_coord.y<< " " ;
hex_coord = xy_to_ring(xrem.x,xrem.y);
cout<< "X" << " "<< hex_coord.x << " "<< hex_coord.y<<" ";
// playermoves.push_back({"RE",five_rows[0][1].x,five_rows[0][1].y});
// playermoves.push_back({"X",dup_ringlist[0].x,dup_ringlist[0].y});
}
else{
b_w = false;
}
}
// vector<Move> tot_moves = playermoves;
// cerr<< "befor find"<<endl;
// print_rings();
playermoves.resize(0);
clock_t startTime=clock();
find_moves(playermoves,turn);
clock_t endTime = clock();
clock_t clockTicksTaken = endTime - startTime;
float timeInSeconds = clockTicksTaken / (float) CLOCKS_PER_SEC;
time_left = time_left - (int) timeInSeconds;
// cerr<< "after find"<< playermoves.size()<<endl;
// print_rings();
// cerr<< "finded move "<< playermoves.size()<<"ring _s "<< rings_num << " "<< num_ring_presently(turn) <<" "<<(rings_num - game.num_ring_present(turn) ) <<endl;
// sending our move
for(int i1=0; i1<playermoves.size() && (rings_num - game.num_ring_present(turn) < 3 ) ;i1++){
string s1 = playermoves[i1].type;
int id1 = playermoves[i1].x;
int id2 = playermoves[i1].y;
if(s1=="S"){
vector<Move> m11;
// cerr<< "sel_mov "<< playermoves[i1].x<<" "<< playermoves[i1].y<<endl;
m11.push_back(playermoves[i1]);
m11.push_back(playermoves[i1+1]);
game.execute_seq(m11,turn);
}
if(s1=="RS"){
vector<Move> m11;
m11.push_back(playermoves[i1]);
m11.push_back(playermoves[i1+1]);
game.execute_seq(m11,turn);
}
if(s1=="X"){
vector<Move> m11;
m11.push_back(playermoves[i1]);
// cerr<< "befr rem"<<endl;
// print_rings();
game.execute_seq(m11,turn);
// cerr<< "after rem"<<endl;
// print_rings();
}
Place hex_coord = xy_to_ring(id1,id2);
cout<< s1 << " "<< hex_coord.x << " "<< hex_coord.y;
if(i1<playermoves.size()-1){
cout<<" ";
}
}
// cerr<< "our turn completed"<<endl;
// print_rings();
cout<<endl;
oppmoves.resize(0);
turn=turn^1;
input_moves(oppmoves);
game.execute_seq(oppmoves,turn);
// cerr<< "opp execute_seq "<< game.myboard[oppmoves[0].x][oppmoves[0].y] << " "<< oppmoves[0].x<<" "<< oppmoves[0].y<<endl;
turn = turn^1;
// cerr<< "his turn completed"<<endl;
// print_rings();
}
}
int main(){
string ind,rings,time,mark;
cin>>ind >> rings >> time ;
// player num 0 or 1
player_num = stoi(ind) -1;
rings_num = stoi(rings);
time_left = stoi(time);
cin>>mark;
markers_num = stoi(mark);
// cerr<< " markers "<< markers_num<<endl;
game = Yinsh(rings_num,2*rings_num+1,markers_num);
play(player_num);
}