From ff5a9d20ce5cc4e7b9ead1acf92248f8dd2de2a9 Mon Sep 17 00:00:00 2001 From: Petr Baudis Date: Sat, 15 Jan 2011 17:51:43 +0100 Subject: [PATCH] Selfatari three_liberty_suicide(): Fix d5c9b, do not trigger if the group has an eye --- tactics/selfatari.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tactics/selfatari.c b/tactics/selfatari.c index 8ae673a..2516b4f 100644 --- a/tactics/selfatari.c +++ b/tactics/selfatari.c @@ -82,6 +82,13 @@ three_liberty_suicide(struct board *b, group_t g, enum stone color, coord_t to, bool other_libs_neighbors = coord_is_adjecent(other_libs[0], other_libs[1], b); for (int i = 0; i < 2; i++) { int null_libs = other_libs_neighbors + other_libs_adj[i]; + if (board_is_one_point_eye(b, other_libs[1 - i], color)) { + /* The other liberty is an eye, happily go ahead. + * There are of course situations where this will + * take off semeai liberties, but without this check, + * many terminal endgame plays will be messed up. */ + return false; + } if (immediate_liberty_count(b, other_libs[i]) - null_libs > 1) { /* Gains liberties. */ /* TODO: Check for ladder! */ -- 2.11.4.GIT