[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [gnugo-devel] bug in gnugo
From: |
Gunnar Farneback |
Subject: |
Re: [gnugo-devel] bug in gnugo |
Date: |
Tue, 30 Dec 2003 23:27:10 +0100 |
User-agent: |
EMH/1.14.1 SEMI/1.14.3 (Ushinoya) FLIM/1.14.2 (Yagi-Nishiguchi) APEL/10.3 Emacs/20.7 (sparc-sun-solaris2.7) (with unibyte mode) |
I wrote:
> Caused by filllib. It wants to fill the liberty at E2 but notices that
> G7 becomes tactically critical then (was undefendable). To avoid that
> it suggests first playing the move attacking G7 after E2 was filled.
> Unfortunately that move happens to be C1, which can't be played before
> E2. This is not difficult to work around and I have a patch, but
> unless someone urgently wants to see it I'll wait until Savannah is
> back up to submit it.
Here it is.
- detect_tactical_blunder() revised
/Gunnar
Index: engine/utils.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/utils.c,v
retrieving revision 1.83
diff -u -r1.83 utils.c
--- engine/utils.c 13 Nov 2003 22:48:42 -0000 1.83
+++ engine/utils.c 30 Dec 2003 22:23:04 -0000
@@ -1199,8 +1199,21 @@
if (defense_effective && defense_point) {
int dpos;
- if (attack(pos, &dpos))
+ if (attack(pos, &dpos)) {
*defense_point = dpos;
+ /* Check that this move is legal and effective also on the
+ * original board, otherwise find a tactical attack there
+ * instead.
+ */
+ popgo();
+
+ if (!is_legal(dpos, color)
+ || play_attack_defend_n(color, 0, 1, dpos, pos))
+ attack(pos, defense_point);
+
+ /* Redo the move, we know that it won't fail. */
+ trymove(move, color, NULL, NO_MOVE, EMPTY, NO_MOVE);
+ }
else {
verbose = save_verbose;
TRACE("No attack found (unexpectedly) on %1m after move at %1m.\n",