gnugo-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [gnugo-devel] Saphir game


From: Gunnar Farneback
Subject: Re: [gnugo-devel] Saphir game
Date: Fri, 06 Dec 2002 21:33:01 +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)

Dan wrote:
> The patch causes crashes in filllib:19 and golife:4. The following
> patch stops these crashes.

I didn't have time to test it more than to see that it solved the
immediate problems. The fix is of course correct.

> I think an underlying problem may still not be fixed. Starting around
> 258 GNU started filling its own territory, attacking various
> already-dead worms. These moves were given the reason "E11
> cutstone".

Strictly speaking that is not a move reason but part of the move
valuation. 

> These traces are mostly gone after the patch but not entirely.
> 
> Even after this patch, at move 260 we get:
> 
>   F3: -0.5 - penalty for ko stone G3 (workaround)
>   F3: 6.00 - E11 cutstone
>   F3: 8.98 - strategic effect on A6
>   F3:   0.00 - total followup value, added 0.00 as territorial followup
>   F3: 0.17 - secondary
>   F3: 0.63 - connects strings (connect value 6, shape factor 0.126)
>   F3:   1.00 - maximum accepted value
> Move generation values F3 to 1.00

If we look at the move reasons we have 

Move at F3 defends E11 with good ko
Move at F3 defends G3
Move at F3 owl-defends G3
Move at F3 connects G3 and B5

Of these "F3 defends E11 with good ko" is clearly bogus. F3 has no
tactical effect at all on the E11 string. This is basically the same
problem that my previous patch fixed, but this bogus defense is found
already in make_worms(). The patch below is very similar to the
previous one. In fact it's so similar that we should consider whether
we can unify the involved pieces of code in make_worms() and in
find_more_attack_and_defense_moves().

- make_worms() revised.

This patch is as untested as the previous one.

/Gunnar

Index: engine/worm.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/worm.c,v
retrieving revision 1.45
diff -u -r1.45 worm.c
--- engine/worm.c       12 Nov 2002 16:21:56 -0000      1.45
+++ engine/worm.c       6 Dec 2002 20:31:11 -0000
@@ -342,12 +342,36 @@
           */
          else if (worm[str].color == color
                   && worm[str].attack_codes[0] != 0) {
-           int acode = attack(str, NULL); 
+           int acode = attack(str, NULL);
            if (acode < worm[str].attack_codes[0]) {
-             DEBUG(DEBUG_WORMS,
-                   "adding point of defense of %1m at %1m with code %d\n",
-                   str, pos, REVERSE_RESULT(acode));
-             change_defense(str, pos, REVERSE_RESULT(acode));
+             int defense_works = 1;
+             /* Sometimes attack() fails to find an
+              * attack which has been found by other means.
+              * Try if the old attack move still works.
+              */
+             if (worm[str].attack_codes[0] != 0
+                 && trymove(worm[str].attack_points[0],
+                            OTHER_COLOR(color), "make_worms", 0, EMPTY, 0)) {
+               int this_acode;
+               if (board[str] == EMPTY)
+                 this_acode = WIN;
+               else
+                 this_acode = REVERSE_RESULT(find_defense(str, NULL));
+               if (this_acode > acode) {
+                 acode = this_acode;
+                 if (acode >= worm[str].attack_codes[0])
+                   defense_works = 0;
+               }
+               popgo();
+             }
+             
+             /* ...then add an attack point of that worm at pos. */
+             if (defense_works) {
+               DEBUG(DEBUG_WORMS,
+                     "adding point of defense of %1m at %1m with code %d\n",
+                     str, pos, REVERSE_RESULT(acode));
+               change_defense(str, pos, REVERSE_RESULT(acode));
+             }
            }
          }
        }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]