From 2ab7e5f271bed44aa4bec246ffff233a287b51b3 Mon Sep 17 00:00:00 2001 From: Jean-loup Gailly Date: Sun, 30 Jan 2011 22:29:04 +0100 Subject: [PATCH] group_atari_check(): Do not consider any defending move when attacking This avoids expensive checks when attacking and simplifies the situation (capture laddered group). Needs lcapturerate=90 for optimal results. --- playout/moggy.c | 3 ++- tactics/1lib.c | 31 +++++++++++++++---------------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/playout/moggy.c b/playout/moggy.c index 635902a..ce27cd8 100644 --- a/playout/moggy.c +++ b/playout/moggy.c @@ -826,7 +826,8 @@ playout_moggy_init(char *arg, struct board *b, struct joseki_dict *jdict) pp->lcapturerate = pp->atarirate = pp->nlibrate = pp->patternrate = pp->selfatarirate = pp->josekirate = -1U; if (board_large(b)) { - pp->lcapturerate = pp->patternrate = 100; + pp->lcapturerate = 90; + pp->patternrate = 100; pp->nlibrate = 20; pp->pattern2 = true; } diff --git a/tactics/1lib.c b/tactics/1lib.c index 6f78732..1a6add3 100644 --- a/tactics/1lib.c +++ b/tactics/1lib.c @@ -95,11 +95,6 @@ void group_atari_check(unsigned int alwaysccaprate, struct board *b, group_t group, enum stone to_play, struct move_queue *q, coord_t *ladder, int tag) { - int qmoves_prev = q->moves; - - /* We don't use @to_play almost anywhere since any moves here are good - * for both defender and attacker. */ - enum stone color = board_at(b, group_base(group)); coord_t lib = board_group_info(b, group).lib[0]; @@ -109,6 +104,21 @@ group_atari_check(unsigned int alwaysccaprate, struct board *b, group_t group, e coord2sstr(group, b), coord2sstr(lib, b), color); assert(board_at(b, lib) == S_NONE); + if (to_play != color) { + /* We are the attacker! In that case, do not try defending + * our group, since we can capture the culprit. */ +#ifdef NO_DOOMED_GROUPS + /* Do not remove group that cannot be saved by the opponent. */ + if (!can_be_rescued(b, group, color, tag)) + return; +#endif + if (can_play_on_lib(b, group, to_play)) { + mq_add(q, lib, tag); + mq_nodup(q); + } + return; + } + /* Can we capture some neighbor? */ bool ccap = can_countercapture(b, color, group, to_play, q, tag); if (ccap && !ladder && alwaysccaprate > fast_random(100)) @@ -122,11 +132,6 @@ group_atari_check(unsigned int alwaysccaprate, struct board *b, group_t group, e /* Do not suicide... */ if (!can_play_on_lib(b, group, to_play)) return; -#ifdef NO_DOOMED_GROUPS - /* Do not remove group that cannot be saved by the opponent. */ - if (to_play != color && !can_be_rescued(b, group, color, tag)) - return; -#endif if (DEBUGL(6)) fprintf(stderr, "...escape route valid\n"); @@ -142,12 +147,6 @@ group_atari_check(unsigned int alwaysccaprate, struct board *b, group_t group, e if (DEBUGL(6)) fprintf(stderr, "...no ladder\n"); - if (to_play != color) { - /* We are the attacker! In that case, throw away the moves - * that defend our groups, since we can capture the culprit. */ - q->moves = qmoves_prev; - } - mq_add(q, lib, tag); mq_nodup(q); } -- 2.11.4.GIT