From a118df743c7adf7fffeb51e1ec68ae7fa6041b6d Mon Sep 17 00:00:00 2001 From: Petr Baudis Date: Sat, 16 Jan 2010 02:14:29 +0100 Subject: [PATCH] uct_playouts(): Just loop until uct_halt if games==0 --- uct/walk.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/uct/walk.c b/uct/walk.c index 3c03bb2..d0f60aa 100644 --- a/uct/walk.c +++ b/uct/walk.c @@ -338,10 +338,11 @@ uct_playouts(struct uct *u, struct board *b, enum stone color, struct tree *t, i { /* Should we print progress info? In case all threads work on the same * tree, only the first thread does. */ + /* XXX: The thread manager should do things like this. */ #define ok_to_talk (!u->parallel_tree || !thread_id) int i; - for (i = 0; i < games; i++) { + for (i = 0; !uct_halt && (!games || i < games); i++) { int result = uct_playout(u, b, color, t); if (result == 0) { /* Tree descent has hit invalid move. */ @@ -358,12 +359,6 @@ uct_playouts(struct uct *u, struct board *b, enum stone color, struct tree *t, i || (best->u.playouts >= 500 && tree_node_get_value(t, 1, best->u.value) >= 0.95))) break; } - - if (uct_halt) { - if (UDEBUGL(2)) - fprintf(stderr, "\n", games - i); - break; - } } if (ok_to_talk) { -- 2.11.4.GIT