gnugo-devel
[Top][All Lists]
Advanced

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

[gnugo-devel] improved stabilisation in get_next_move_from_list


From: Teun Burgers
Subject: [gnugo-devel] improved stabilisation in get_next_move_from_list
Date: Wed, 23 Oct 2002 20:35:57 +0200

This patch replaces the third stabilisation criterion
in get_next_move_from_list by a orientation independent
criterion

The original criterion is based on the move itself:

&& list->pattern_list[bottom].move < top_move))

The new criterion is based on the distance to the center of the board:

&& bdist(list->pattern_list[bottom].move) < top_dist))

where bdist calculates the distance to the center of the board.
After this patch the orientation results for the tests in
owl_rot.tst are as follows:

23  PASSED failed PASSED PASSED PASSED PASSED PASSED PASSED
66  PASSED PASSED PASSED PASSED PASSED PASSED PASSED PASSED
70  PASSED PASSED PASSED PASSED PASSED PASSED PASSED PASSED
118 FAILED FAILED FAILED FAILED FAILED FAILED FAILED FAILED
125 PASSED PASSED failed PASSED PASSED failed PASSED PASSED
208 FAILED passed passed FAILED FAILED FAILED passed passed
244 PASSED failed failed PASSED PASSED failed failed PASSED
262 FAILED passed passed passed passed passed passed passed

So tests 66, 70 and 118 don't have reorientation inconsistencies any
more.

Teun
Index: owl.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/owl.c,v
retrieving revision 1.114
diff -u -r1.114 owl.c
--- owl.c       21 Oct 2002 19:47:37 -0000      1.114
+++ owl.c       23 Oct 2002 18:26:43 -0000
@@ -3004,6 +3004,21 @@
   matched_patterns->counter++;
 }
 
+/* compute the distance of a point on the board
+ * to the center of the board
+ */
+
+static double bdist(int move);
+static double bdist(int move)
+{
+  /* i = 0:              idist = - (board_size - 1)
+     i = board_size -1 : idist =    board_size - 1
+     */
+  int idist = 2*I(move) - board_size + 1;
+  int jdist = 2*J(move) - board_size + 1;
+  return idist*idist + jdist*jdist;
+}
+
 /* This function searches in the previously stored list of matched patterns
  * for the highest valued unused patterns that have a valid constraint.
  * It returns the moves at the next empty positions in the array (moves[]).
@@ -3046,7 +3061,7 @@
      */
     float top_val = list->pattern_list[top].pattern->value;
     struct pattern *top_pattern = list->pattern_list[top].pattern;
-    int top_move = list->pattern_list[top].move;
+    int top_dist = bdist(list->pattern_list[top].move);
 
     /* Maybe we already know the top entry (if previous call was ended
      * by a value cutoff.
@@ -3059,13 +3074,13 @@
                && list->pattern_list[bottom].pattern < top_pattern)
            || (list->pattern_list[bottom].pattern->value == top_val
                && list->pattern_list[bottom].pattern == top_pattern
-               && list->pattern_list[bottom].move < top_move)) {
+               && bdist(list->pattern_list[bottom].move) < top_dist)) {
          matched_pattern = list->pattern_list[bottom];
          list->pattern_list[bottom] = list->pattern_list[top];
          list->pattern_list[top] = matched_pattern;
          top_val = list->pattern_list[top].pattern->value;
          top_pattern = list->pattern_list[top].pattern;
-         top_move = list->pattern_list[top].move;
+         top_dist = bdist(list->pattern_list[top].move);
        }
       list->ordered_up_to++;
     }

reply via email to

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