gnugo-devel
[Top][All Lists]
Advanced

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

[gnugo-devel] arend_3_3.5: symmetric patterns handled in dfa


From: Arend Bayer
Subject: [gnugo-devel] arend_3_3.5: symmetric patterns handled in dfa
Date: Mon, 20 May 2002 18:25:38 +0200 (CEST)

 - dfa doesn't report symmetric patterns multiple times

This causes 10 FAILs and 8 PASSes, about as usual with the owl
indeterminacy (which will probably drive me crazy some time...).

The patch might actually have a measurable positive performance impact
by reducing the list sizes that get_next_move_from_list has to handle.
But that should be below 1%.

I spotted a few missing symmetries in owl_*.db on the way, but I felt it
more convenient to leave that until escape_3_3.1 is in CVS.

Arend


Index: engine/matchpat.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/matchpat.c,v
retrieving revision 1.32
diff -u -r1.32 matchpat.c
--- engine/matchpat.c   16 May 2002 09:07:48 -0000      1.32
+++ engine/matchpat.c   20 May 2002 15:46:58 -0000
@@ -1049,7 +1049,8 @@
              char goal[BOARDMAX])
 {
   int k;                       /* Iterate over elements of pattern */
-  int found_goal, found_nongoal;
+  int found_goal = 0;
+  int found_nongoal = 0;

 #if PROFILE_PATTERNS
   int nodes_before;
@@ -1058,10 +1059,17 @@
 #ifdef PROFILE_MATCHER
   ++totals[1];
 #endif
-
+
+  /* Throw out duplicating orientations of symmetric patterns. */
+  if (pattern->trfno == 5) {
+    if (ll < 2 || ll >= 6)
+      return;
+  }
+  else
+    if (ll >= pattern->trfno)
+      return;
+
   /* Now iterate over the elements of the pattern. */
-  found_goal = 0;
-  found_nongoal = 0;
   for (k = 0; k < pattern->patlen; k++) {
                                /* match each point */
     int x, y;                  /* absolute (board) co-ords of
@@ -1087,7 +1095,7 @@
         & class_mask[dragon[POS(x, y)].matcher_status][p[x][y]]) != 0)
       goto match_failed;

-  }/* loop over elements */
+  } /* loop over elements */

   /* Make it here ==> We have matched all the elements to the board. */
   if (goal != NULL && !found_goal)




reply via email to

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