gnugo-devel
[Top][All Lists]
Advanced

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

RE: [gnugo-devel] Symmetry corrections


From: Portela Fernand
Subject: RE: [gnugo-devel] Symmetry corrections
Date: Mon, 7 Oct 2002 23:27:19 +0200

I wrote:
> I'm gonna try switching the ordering from descending to ascending, see
> if I can get a better result...

+20 passes and +19 failures, I prefer this one.

/nando

gunnar_3_10.4a : (even) more stable sorting of owl shape moves. 

Index: owl.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/owl.c,v
retrieving revision 1.109
diff -u -r1.109 owl.c
--- owl.c       4 Oct 2002 18:52:35 -0000       1.109
+++ owl.c       7 Oct 2002 21:02:05 -0000
@@ -2877,7 +2877,6 @@
                         struct owl_move_data *moves, int cutoff)
 {
   int top, bottom;
-  float top_val;
   int k;
   int i;
   int move;
@@ -2893,18 +2892,33 @@
    * used by the calling function.
    */
   for (top = list->used; top < list->counter; top++) {
+    /*
+     * NOTICE : In order to stabilize the regression test results,
+     * arbitrary parameters like pattern memory address and move position
+     * have been included in the sorting algorythm. 
+     */
+    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;
+
     /* Maybe we already know the top entry (if previous call was ended
      * by a value cutoff.
      */
-    top_val = list->pattern_list[top].pattern->value;
     if (top >= list->ordered_up_to) {
       /* One bubble sort iteration. */
       for (bottom = list->counter-1; bottom > top; bottom--)
-       if (list->pattern_list[bottom].pattern->value > top_val) {
+       if (list->pattern_list[bottom].pattern->value > top_val
+           || (list->pattern_list[bottom].pattern->value == top_val
+               && 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)) {
          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;
        }
       list->ordered_up_to++;
     }




reply via email to

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