From 83f01eaf6f667123b787549acd7cc6b62ecfa375 Mon Sep 17 00:00:00 2001 From: Petr Baudis Date: Tue, 17 Jan 2012 05:18:44 +0100 Subject: [PATCH] group_atari_check(): Save 1pt ko if it protects an eye --- t-regress/games/2012-01-17-pachi2-Soromon-3.sgf | 2 +- tactics/1lib.c | 14 ++++++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/t-regress/games/2012-01-17-pachi2-Soromon-3.sgf b/t-regress/games/2012-01-17-pachi2-Soromon-3.sgf index d087e7c..44b78f1 100644 --- a/t-regress/games/2012-01-17-pachi2-Soromon-3.sgf +++ b/t-regress/games/2012-01-17-pachi2-Soromon-3.sgf @@ -1,6 +1,6 @@ (;GM[1]FF[4]CA[UTF-8]AP[CGoban:3]ST[2] RU[Chinese]SZ[19]HA[2]KM[0.50]TM[0]OT[5x15 byo-yomi] -PW[pachi2]PB[Soromon]WR[3d]BR[1d]DT[2012-01-17]GC[248 S14:alive,C3:dead pachi has two problems - black t10-t9-notconnecting and white t10-notconnecting; C3 is missing pattern issue]PC[The KGS Go Server at http://www.gokgs.com/]C[pachi2 [3d\]: GTP Engine for pachi2 (white): Pachi Distributed version 9.99 (Satsugen-devel): If you believe you have won but I am still playing, please help me understand by capturing all dead stones. Anyone can send me 'winrate' in private chat to get my assessment of the position. Have a nice game! +PW[pachi2]PB[Soromon]WR[3d]BR[1d]DT[2012-01-17]GC[248 /S14:alive,C3:dead pachi has two problems - black t10-t9-notconnecting and white t10-notconnecting; C3 is missing pattern issue]PC[The KGS Go Server at http://www.gokgs.com/]C[pachi2 [3d\]: GTP Engine for pachi2 (white): Pachi Distributed version 9.99 (Satsugen-devel): If you believe you have won but I am still playing, please help me understand by capturing all dead stones. Anyone can send me 'winrate' in private chat to get my assessment of the position. Have a nice game! ]RE[B+Resign] ;B[ji]BL[15]OB[5] ;B[jk]BL[15]OB[5] diff --git a/tactics/1lib.c b/tactics/1lib.c index efb0df4..02ddcdf 100644 --- a/tactics/1lib.c +++ b/tactics/1lib.c @@ -123,8 +123,18 @@ group_atari_check(unsigned int alwaysccaprate, struct board *b, group_t group, e /* Otherwise, do not save kos. */ if (group_is_onestone(b, group) - && neighbor_count_at(b, lib, color) + neighbor_count_at(b, lib, S_OFFBOARD) == 4) - return; + && neighbor_count_at(b, lib, color) + neighbor_count_at(b, lib, S_OFFBOARD) == 4) { + /* Except when the ko is for an eye! */ + bool eyeconnect = false; + foreach_diag_neighbor(b, lib) { + if (board_at(b, c) == S_NONE && neighbor_count_at(b, c, color) + neighbor_count_at(b, c, S_OFFBOARD) == 4) { + eyeconnect = true; + break; + } + } foreach_diag_neighbor_end; + if (!eyeconnect) + return; + } /* Do not suicide... */ if (!can_play_on_lib(b, group, to_play)) -- 2.11.4.GIT