gnugo-devel
[Top][All Lists]
Advanced

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

RE: [gnugo-devel] A speedup


From: Portela Fernando
Subject: RE: [gnugo-devel] A speedup
Date: Tue, 22 Apr 2003 11:19:46 +0200

Paul wrote:

> can it be a further improvement if we avoid trying any moves at all
> when both moves give too much liberties for the defender.

I thought of it, but didn't try because I believed it wouldn't be
effective enough to be regarded as non-negligible. It appears that
I was quite wrong. Well done, Paul :)

Updated patch below.

Regression breakage : none
Performance impact  : -9.6% reading nodes
                      -13.2% trymoves

And I measured a 5.8% speed increase. Again, better timings should be
done by someone else.

/nando

- don't even try 'wrong' liberties in simple_ladder_attack()

Index: engine/reading.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/reading.c,v
retrieving revision 1.110
diff -u -r1.110 reading.c
--- engine/reading.c    1 Mar 2003 12:12:33 -0000       1.110
+++ engine/reading.c    22 Apr 2003 08:39:56 -0000
@@ -5491,8 +5491,14 @@
   /* Get the two liberties of (str). */
   findlib(str, 2, libs);
 
-  for (k = 0; k < 2; k++)
-    ADD_CANDIDATE_MOVE(libs[k], 0, moves, "simple_ladder_attack");
+  /* Kludge : If the defender can get enough liberties by playing
+   * one of these two, then we have no choice but to block there
+   * and consequently, it is unnecesary to try the other liberty.
+   */
+  if (approxlib(libs[0], color, 4, NULL) <= 3)
+    ADD_CANDIDATE_MOVE(libs[1], 0, moves, "simple_ladder_attack");
+  if (approxlib(libs[1], color, 4, NULL) <= 3)
+    ADD_CANDIDATE_MOVE(libs[0], 0, moves, "simple_ladder_attack");
 
   order_moves(str, &moves, other, read_function_name, 0, NO_MOVE);
 




reply via email to

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