From 528cf0964d3a6174d5d3f88d5a17f2566d415203 Mon Sep 17 00:00:00 2001 From: Petr Baudis Date: Fri, 24 Feb 2012 17:27:47 +0100 Subject: [PATCH] uct_search_result(): Verbose debug print in case pass is considered unsafe Sometimes, Pachi mysteriously refuses to pass and it is not a reproducible bug; maybe this will help shed some light on it? --- uct/search.c | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/uct/search.c b/uct/search.c index 265de27..2228516 100644 --- a/uct/search.c +++ b/uct/search.c @@ -478,15 +478,21 @@ uct_search_result(struct uct *u, struct board *b, enum stone color, /* If the opponent just passed and we win counting, always * pass as well. For option stones_only, we pass only when there * there is nothing else to do, to show how to maximize score. */ - if (b->moves > 1 && is_pass(b->last_move.coord) && b->rules != RULES_STONES_ONLY - && uct_pass_is_safe(u, b, color, pass_all_alive)) { - if (UDEBUGL(0)) - fprintf(stderr, "\n", - board_official_score(b, NULL) / 2); - *best_coord = pass; - best = u->t->root->children; // pass is the first child - assert(is_pass(node_coord(best))); - return best; + if (b->moves > 1 && is_pass(b->last_move.coord) && b->rules != RULES_STONES_ONLY) { + if (uct_pass_is_safe(u, b, color, pass_all_alive)) { + if (UDEBUGL(0)) + fprintf(stderr, "\n", + board_official_score(b, NULL) / 2); + *best_coord = pass; + best = u->t->root->children; // pass is the first child + assert(is_pass(node_coord(best))); + return best; + } else { + if (UDEBUGL(3)) + fprintf(stderr, "Refusing to pass, unsafe; pass_all_alive %d, ownermap #playouts %d, raw score %f\n", + pass_all_alive, u->ownermap.playouts, + board_official_score(b, NULL) / 2); + } } return best; -- 2.11.4.GIT