@@ -209,7 +209,7 @@ ClearEvalQueue()
209209// //////////
210210
211211// Virtual Lossを加算
212- static void AddVirtualLoss ( child_node_t *child, int current );
212+ static int AddVirtualLoss ( child_node_t *child, int current );
213213
214214// 次のプレイアウト回数の設定
215215static void CalculateNextPlayouts ( game_info_t *game, int color, double best_wp, double finish_time );
@@ -1573,7 +1573,7 @@ UctSearch(game_info_t *game, int color, mt19937_64 *mt, LGR& lgrf, LGRContext& l
15731573 path.push_back (current);
15741574
15751575 // Virtual Lossを加算
1576- AddVirtualLoss (&uct_child[next_index], current);
1576+ int n = AddVirtualLoss (&uct_child[next_index], current);
15771577
15781578 memcpy (game->seki , uct_node[current].seki , sizeof (bool ) * BOARD_MAX );
15791579
@@ -1672,16 +1672,12 @@ UctSearch(game_info_t *game, int color, mt19937_64 *mt, LGR& lgrf, LGRContext& l
16721672// ////////////////////////
16731673// Virtual Lossの加算 //
16741674// ////////////////////////
1675- static void
1675+ static int
16761676AddVirtualLoss (child_node_t *child, int current)
16771677{
1678- #if defined CPP11
16791678 atomic_fetch_add (&uct_node[current].move_count , VIRTUAL_LOSS );
1680- atomic_fetch_add (&child->move_count , VIRTUAL_LOSS );
1681- #else
1682- uct_node[current].move_count += VIRTUAL_LOSS ;
1683- child->move_count += VIRTUAL_LOSS ;
1684- #endif
1679+ int org = atomic_fetch_add (&child->move_count , VIRTUAL_LOSS );
1680+ return org;
16851681}
16861682
16871683
0 commit comments