Skip to content

Commit

Permalink
Deletion of non-descendents wasn't actually working...
Browse files Browse the repository at this point in the history
  • Loading branch information
alreadydone committed Aug 29, 2018
1 parent b5dec9a commit f0bab87
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
5 changes: 5 additions & 0 deletions src/UCTNodeRoot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,8 @@ void UCTNode::prepare_root_node(Network & network, int color, // redundant argum
ss[i].insert(ss[i].end(), search->sym_states[i][j].begin(),search->sym_states[i][j].end());
}
}
search->sym_states[0].assign(cfg_num_threads, {});
search->sym_states[1].assign(cfg_num_threads, {});

Utils::myprintf("black positions: %d\n", ss[0].size());
Utils::myprintf("white positions: %d\n", ss[1].size());
Expand All @@ -428,6 +430,7 @@ void UCTNode::prepare_root_node(Network & network, int color, // redundant argum
if (cfg_collect_during_search) {
auto hash = root_state.board.get_ko_hash();
auto index = root_state.m_ko_hash_history.size() - 1;
int thread[2] = { 0,0 };
for (auto i = 0; i < 2; i++) {
auto num_removed = 0;
auto colored_root_eval = (i == color ? root_eval : 1.0f - root_eval);
Expand All @@ -440,6 +443,8 @@ void UCTNode::prepare_root_node(Network & network, int color, // redundant argum
num_removed++;
}
else {
search->sym_states[i][thread[i]].push_back(ss[i][j]);
thread[i] = (thread[i] + 1) % cfg_num_threads;
ss[i][j]->diff = abs(ss[i][j]->winrate - colored_root_eval);
ss[i][j - num_removed] = ss[i][j];
if (!cfg_use_root_for_diff) { colored_root_eval += ss[i][j]->winrate; }
Expand Down
6 changes: 3 additions & 3 deletions src/UCTSearch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -224,9 +224,9 @@ SearchResult UCTSearch::play_simulation(GameState & currstate,
if (success && sym_states[color][thread_num].size() * cfg_num_threads < cfg_adj_positions) {
auto sym_state = std::make_shared<Sym_State>();
auto color = currstate.get_to_move();
(*sym_state).symmetry = rand_sym;
(*sym_state).state = currstate;
(*sym_state).winrate = (color == FastBoard::BLACK ? eval : 1.0f - eval);
sym_state->symmetry = rand_sym;
sym_state->state = currstate;
sym_state->winrate = (color == FastBoard::BLACK ? eval : 1.0f - eval);
//LOCK(get_mutex(), lock);
sym_states[color][thread_num].push_back(sym_state);
if ((sym_states[color][thread_num].size() - 1) * cfg_num_threads >= cfg_adj_positions) {
Expand Down

0 comments on commit f0bab87

Please sign in to comment.