Skip to content

Commit

Permalink
Always allow passing when low on moves.
Browse files Browse the repository at this point in the history
As pointed out by @gjm11 in leela-zero#2277, when there's few legal moves we might
want to allow passing even if this loses on the board count. The
alternative might be to self-destruct large groups and carry the game
on endlessely even if the policy wouldn't want to.

No difference in "dumbpass" mode.
  • Loading branch information
gcp committed Apr 2, 2019
1 parent 1a4538a commit 57b7f6b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/UCTNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,14 @@ bool UCTNode::create_children(Network & network,
// Always try passes if we're not trying to be clever.
auto allow_pass = cfg_dumbpass;

// Less than 20 available intersections in a 19x19 game.
if (nodelist.size() <= std::max(5, BOARD_SIZE)) {
allow_pass = true;
}

// If we're clever, only try passing if we're winning on the
// net score and on the board count.
if (!allow_pass && (stm_eval > 0.8f || nodelist.size() <= 20)) {
if (!allow_pass && stm_eval > 0.8f) {
const auto relative_score =
(to_move == FastBoard::BLACK ? 1 : -1) * state.final_score();
if (relative_score >= 0) {
Expand Down

0 comments on commit 57b7f6b

Please sign in to comment.