From 581c4b5524f6d279cf5ead31b2328226ae315f91 Mon Sep 17 00:00:00 2001 From: Jean-loup Gailly Date: Sat, 3 Apr 2010 21:00:20 +0200 Subject: [PATCH] uct_genmoves(): call prepare_move() earlier to avoid dangling node refs in stats[] if the slave was out of sync. --- uct/uct.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/uct/uct.c b/uct/uct.c index dfd5e3a..e8febef 100644 --- a/uct/uct.c +++ b/uct/uct.c @@ -804,9 +804,6 @@ uct_bestmove(struct engine *e, struct board *b, struct time_info *ti, enum stone b->superko_violation = false; } - /* Seed the tree. If we are a slave in the distributed engine, - * we keep thinking until the next "play" command. */ - if (!thread_manager_running) prepare_move(e, b, color); assert(u->t); u->my_color = color; @@ -890,6 +887,7 @@ uct_genmove(struct engine *e, struct board *b, struct time_info *ti, enum stone { struct uct *u = e->data; uct_pondering_stop(u); + prepare_move(e, b, color); bool keep_looking; coord_t best_coord; @@ -993,6 +991,9 @@ uct_genmoves(struct engine *e, struct board *b, struct time_info *ti, enum stone struct uct *u = e->data; assert(u->slave); + /* Seed the tree if the search is not already running. */ + if (!thread_manager_running) prepare_move(e, b, color); + /* Get playouts and time information from master. * Keep this code in sync with distributed_genmove(). */ if ((ti->dim == TD_WALLTIME -- 2.11.4.GIT