Skip to content

Commit

Permalink
Check ladder at non root nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
zakki committed Dec 17, 2016
1 parent cb6d7c7 commit d0ff2bf
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/UctSearch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -676,6 +676,7 @@ ExpandNode(game_info_t *game, int color, int current)
unsigned int index = FindSameHashIndex(game->current_hash, color, game->moves);
child_node_t *uct_child, *uct_sibling;
int i, pos, child_num = 0;
bool ladder[BOARD_MAX] = { false };
double max_rate = 0.0;
int max_pos = PASS, sibling_num;
int pm1 = PASS, pm2 = PASS;
Expand All @@ -696,6 +697,11 @@ ExpandNode(game_info_t *game, int color, int current)
// 2手前の着手の座標を取り出す
if (moves > 1) pm2 = game->record[moves - 2].pos;

// 9路盤でなければシチョウを調べる
if (pure_board_size != 9) {
LadderExtension(game, color, ladder);
}

// 現在のノードの初期化
uct_node[index].previous_move1 = pm1;
uct_node[index].previous_move2 = pm2;
Expand All @@ -708,15 +714,15 @@ ExpandNode(game_info_t *game, int color, int current)
uct_child = uct_node[index].child;

// パスノードの展開
InitializeCandidate(&uct_child[PASS_INDEX], PASS, false);
InitializeCandidate(&uct_child[PASS_INDEX], PASS, ladder[PASS]);
child_num++;

// 候補手の展開
for (i = 0; i < pure_board_max; i++) {
pos = onboard_pos[i];
// 探索候補でなければ除外
if (candidates[pos] && IsLegal(game, pos, color)) {
InitializeCandidate(&uct_child[child_num], pos, false);
InitializeCandidate(&uct_child[child_num], pos, ladder[pos]);
child_num++;
}
}
Expand Down

0 comments on commit d0ff2bf

Please sign in to comment.