From 2163b4e4f2cbfcb81f85a91f0625102ebed470c5 Mon Sep 17 00:00:00 2001 From: Kensuke Matsuzaki Date: Tue, 2 Jul 2019 23:37:45 +0900 Subject: [PATCH 1/3] Buffer overflow in ladder search --- src/Ladder.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Ladder.cpp b/src/Ladder.cpp index 2e8d34a..719540f 100644 --- a/src/Ladder.cpp +++ b/src/Ladder.cpp @@ -87,7 +87,7 @@ IsLadderCaptured( const int depth, search_game_info_t *game, const int ren_xy, c int escape_color, capture_color, escape_xy, capture_xy, neighbor; bool result; - if (depth >= 100) { + if (depth >= 100 || game->moves >= MAX_RECORDS - 1) { return ALIVE; } From a55f2a8e5fc6dc48f5a74bdfe3c934e1cc030a63 Mon Sep 17 00:00:00 2001 From: Kensuke Matsuzaki Date: Fri, 24 May 2019 00:06:55 +0900 Subject: [PATCH 2/3] Fix pass in simulation --- src/Simulation.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Simulation.cpp b/src/Simulation.cpp index df28524..cb68b74 100644 --- a/src/Simulation.cpp +++ b/src/Simulation.cpp @@ -16,7 +16,8 @@ using namespace std; void Simulation( game_info_t *game, int starting_color, std::mt19937_64 *mt ) { - int color = starting_color, pos = -1, pass_count = (game->record[game->moves - 1].pos == PASS && game->moves > 1); + int color = starting_color, pos = -1; + int pass_count = 0; // シミュレーション打ち切り手数を設定 int length = MAX_MOVES - game->moves; From 2784db2e6741ecfef5fc381aa5d77775cb286d61 Mon Sep 17 00:00:00 2001 From: Kensuke Matsuzaki Date: Fri, 16 Aug 2019 17:08:58 +0900 Subject: [PATCH 3/3] Fix final_score with seki --- src/UctSearch.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/UctSearch.cpp b/src/UctSearch.cpp index fe2755b..47b2d3b 100644 --- a/src/UctSearch.cpp +++ b/src/UctSearch.cpp @@ -1565,16 +1565,19 @@ UctAnalyze( game_info_t *game, int color ) for (int y = board_start; y <= board_end; y++) { for (int x = board_start; x <= board_end; x++) { const int pos = POS(x, y); - const double ownership_value = (double)statistic[pos].colors[S_BLACK] / uct_node[current_root].move_count; - if (ownership_value > 0.5) { - black++; - } else { - white++; + const double black_ownership = (double)statistic[pos].colors[S_BLACK] / uct_node[current_root].move_count; + const double white_ownership = (double)statistic[pos].colors[S_WHITE] / uct_node[current_root].move_count; + if (black_ownership > 0.5) { + black++; + } + if (white_ownership > 0.5) { + white++; } } } - PrintOwner(&uct_node[current_root], color, owner); + PrintOwner(&uct_node[current_root], S_BLACK, owner); + PrintOwner(&uct_node[current_root], S_WHITE, owner); return black - white; }