movesMap[mor.move_to_string(move)]=i;//In the map: the move as seen by the player and its representation for the computer
possible_moves=possible_moves>>4;
}
cout<<endl<<"Choose your move: ";
stringmove;
cin>>move;
mor.play(movesMap[move]);
}
//Game ended: print the final state of the board
cout<<mor<<endl;
if(mor.won(0))
cout<<mor.player_to_string(0)<<" has won"<<endl;
...
...
@@ -48,41 +60,50 @@ namespace game
}
/* Start a complete Player vs Computer game */
voidtest_morpion::playout()
{
morpionmor;
automctsPlayer=mcts::make_mcts_two_players(mor,5000,0.3,4);// creation du player a partir du morpion. 5000: ms de reflexion 0.3 fateur d'exploration 4: nb_visit_before_expansion on attend d'etre arrive 4 fois sur un noeud avant de le developper
automctsPlayer=mcts::make_mcts_two_players(mor,1000,0.3,4);// creation du player a partir du morpion. 1000: ms de reflexion 0.3 fateur d'exploration 4: nb_visit_before_expansion on attend d'etre arrive 4 fois sur un noeud avant de le developper
cout<<"Player vs Computer game!"<<endl;
cout<<"Who's first? (Player)"<<endl;
cout<<"Who's first? (P)layer or (C)omputer?"<<endl;
stringchoice;
cin>>choice;
intIAPlayer=1;//Default: the computer will play second
if(choice=="C")//If however we choosed to let the computer play first
IAPlayer=0;
while(!mor.end_of_game())
{
cout<<mor<<endl;
if(mor.current_player()==1)//It's circle turn (computer is circle)