diff --git a/TP2/src/mybt.cpp b/TP2/src/mybt.cpp index 9ccb9f8..9b3cf5c 100644 --- a/TP2/src/mybt.cpp +++ b/TP2/src/mybt.cpp @@ -246,8 +246,14 @@ bool bt_t::mcts_simulation(void) { // then play randomly 'til the game is over while (endgame() == EMPTY) { - bt_move_t m = get_rand_move(); - play(m); + update_moves(); + if (nb_moves > 0) { + int r = (static_cast(rand())) % nb_moves; + bt_move_t m = moves[r]; + play(m); + } else { + break; + } } // if i won