From 09b8902c79e2de6c37aee64b522dc394abb0ecf1 Mon Sep 17 00:00:00 2001 From: Jean-loup Gailly Date: Mon, 8 Mar 2010 11:48:26 +0100 Subject: [PATCH] Set board->size even if BOARD_SIZE is defined, for consistency and to avoid subtle bugs. Use board_size() instead of b->size to fix (once again) the komi with Japanese rules. --- board.c | 5 ++--- uct/uct.c | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/board.c b/board.c index 508c5b1..ddd6bc7 100644 --- a/board.c +++ b/board.c @@ -145,10 +145,9 @@ board_resize(struct board *board, int size) { #ifdef BOARD_SIZE assert(board_size(board) == size + 2); -#else - board_size(board) = size + 2 /* S_OFFBOARD margin */; - board_size2(board) = board_size(board) * board_size(board); #endif + board->size = size + 2 /* S_OFFBOARD margin */; + board->size2 = board_size(board) * board_size(board); if (board->b) free(board->b); diff --git a/uct/uct.c b/uct/uct.c index 498915f..73ce933 100644 --- a/uct/uct.c +++ b/uct/uct.c @@ -735,7 +735,7 @@ uct_genmove(struct engine *e, struct board *b, struct time_info *ti, enum stone * odd size). We are not trying to get an exact evaluation for rare * cases of seki. For details see http://home.snafu.de/jasiek/parity.html * TODO: Support the kgs-rules command once available. */ - if (u->territory_scoring && (((int)floor(b->komi) + b->size) & 1)) { + if (u->territory_scoring && (((int)floor(b->komi) + board_size(b)) & 1)) { b->komi += (color == S_BLACK ? 1.0 : -1.0); if (UDEBUGL(0)) fprintf(stderr, "Setting komi to %.1f assuming Japanese rules\n", -- 2.11.4.GIT