mcts
This commit is contained in:
parent
54b40d7918
commit
67b02e2f9d
3 changed files with 8 additions and 1 deletions
|
@ -79,6 +79,7 @@ struct bt_t {
|
|||
bool black_can_move_forward(int _line, int _col);
|
||||
bool black_can_move_left(int _line, int _col);
|
||||
|
||||
bt_move_t get_mcts_move();
|
||||
bt_move_t get_rand_move();
|
||||
bool can_play(bt_move_t _m);
|
||||
void play(bt_move_t _m);
|
||||
|
|
|
@ -58,7 +58,7 @@ void genmove() {
|
|||
printf("= \n\n");
|
||||
return;
|
||||
}
|
||||
bt_move_t m = B.get_rand_move();
|
||||
bt_move_t m = B.get_mcts_move();
|
||||
B.play(m);
|
||||
if (verbose) {
|
||||
m.print(stderr, white_turn, B.nbl);
|
||||
|
|
|
@ -192,6 +192,12 @@ bt_move_t bt_t::get_rand_move() {
|
|||
return moves[r];
|
||||
}
|
||||
|
||||
bt_move_t bt_t::get_mcts_move() {
|
||||
update_moves();
|
||||
int r = (static_cast<int>(rand())) % nb_moves;
|
||||
return moves[r];
|
||||
}
|
||||
|
||||
bool bt_t::can_play(bt_move_t _m) {
|
||||
int dx = abs(_m.col_f - _m.col_i);
|
||||
if (dx > 1) {
|
||||
|
|
Reference in a new issue