From e21ece02018cd2218ca6aae786b025a6275bd40e Mon Sep 17 00:00:00 2001 From: Petr Baudis Date: Sun, 8 May 2011 19:38:38 +0200 Subject: [PATCH] fbook: Add support for handicap lines; do not use normal lines in handicap games --- fbook.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/fbook.c b/fbook.c index 59136f4..f3e2e7b 100644 --- a/fbook.c +++ b/fbook.c @@ -69,6 +69,8 @@ fbook_init(char *filename, struct board *b) struct fbook *fbook = calloc(1, sizeof(*fbook)); fbook->bsize = board_size(b); fbook->handicap = b->handicap; + if (!b->handicap && b->komi < 1) + fbook->handicap = 1; for (int i = 0; i < 1<moves[i] = pass; @@ -90,12 +92,20 @@ fbook_init(char *filename, struct board *b) /* Format of line is: * BSIZE COORD COORD COORD... | COORD + * BSIZE/HANDI COORD COORD COORD... | COORD * We descend up to |, then add the new node * with value minimax(1000), forcing UCT to * always pick that node immediately. */ int bsize = strtol(line, &line, 10); if (bsize != fbook->bsize - 2) continue; + int handi = 0; + if (*line == '/') { + line++; + handi = strtol(line, &line, 10); + } + if (handi != fbook->handicap) + continue; while (isspace(*line)) line++; for (int i = 0; i < 8; i++) { -- 2.11.4.GIT