From 3e8abcab7fa159bfc21f663d7c20cde8b612173b Mon Sep 17 00:00:00 2001 From: Petr Baudis Date: Thu, 2 Sep 2010 01:49:41 +0200 Subject: [PATCH] Moggy group_2lib_check(): Gain liberties by capturing --- playout/moggy.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/playout/moggy.c b/playout/moggy.c index 30e1ba3..2786230 100644 --- a/playout/moggy.c +++ b/playout/moggy.c @@ -639,6 +639,7 @@ group_2lib_check(struct playout_policy *p, struct board *b, group_t group, enum { enum stone color = board_at(b, group_base(group)); assert(color != S_OFFBOARD && color != S_NONE); + int base_moves = q->moves; if (PLDEBUGL(5)) fprintf(stderr, "[%s] 2lib check of color %d\n", @@ -658,6 +659,20 @@ group_2lib_check(struct playout_policy *p, struct board *b, group_t group, enum if (board_at(b, c) != stone_other(color)) continue; group_t g2 = group_at(b, c); + if (board_group_info(b, g2).libs == 1) { + /* We can capture a neighbor. */ + if (group_is_onestone(b, g2)) { + mq_add(q, board_group_info(b, g2).lib[0]); + continue; + } else { + /* It is a large group! Forget + * everything else and just + * capture it now. */ + q->moves = base_moves; + mq_add(q, board_group_info(b, g2).lib[0]); + return; + } + } if (board_group_info(b, g2).libs != 2) continue; check_group_atari(b, g2, color, to_play, q); -- 2.11.4.GIT