[Top][All Lists]

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

[gnugo-devel] Potential platform dependency

From: Gunnar Farnebäck
Subject: [gnugo-devel] Potential platform dependency
Date: Wed, 15 Jun 2005 20:54:22 +0200
User-agent: EMH/1.14.1 SEMI/1.14.3 (Ushinoya) FLIM/1.14.2 (Yagi-Nishiguchi) APEL/10.3 Emacs/21.3 (sparc-sun-solaris2.9) MULE/5.0 (SAKAKI)

As we all know, floating point calculations can cause platform
dependencies. In the move valuation this problem is elegantly avoided
by the addition of random move value contributions. However, the
random contributions are not given to valueless moves. This is usually
not a problem, except when a formerly valueless moves is reconsidered
as a ko threat. In that case the random contribution is missed.

The appended patch gives a quick and ugly solution to the problem. The
proper solution requires some restructuring of the code so that the
random contributions need only be handled in one place.

The patch has no effects on the regressions.


Index: engine/value_moves.c
RCS file: /cvsroot/gnugo/gnugo/engine/value_moves.c,v
retrieving revision 1.149
diff -u -r1.149 value_moves.c
--- engine/value_moves.c        12 Jun 2005 09:34:14 -0000      1.149
+++ engine/value_moves.c        15 Jun 2005 08:57:53 -0000
@@ -3595,6 +3595,18 @@
   for (k = 0; k < num_good_threats; k++) {
     pos = good_threats[k];
+    /* If the move previously had no value, we need to add in the
+     * randomness contribution now.
+     *
+     * FIXME: This is very ugly. Restructure the code so that the
+     * randomness need only be considered in one place.
+     */
+    if (move[pos].value == 0.0) {
+      move[pos].value += 
+       0.01 * move[pos].random_number * move[pos].randomness_scaling;
+    }
     TRACE("%1m: %f + %f = %f\n", pos, move[pos].value,
          move[pos].value + move[pos].additional_ko_value);

reply via email to

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