gnugo-devel
[Top][All Lists]
Advanced

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

[gnugo-devel] one more owl test, one more owl patch


From: Paul Pogonyshev
Subject: [gnugo-devel] one more owl test, one more owl patch
Date: Sun, 5 Jan 2003 00:47:03 +0200

here is a test and a patch that solves it. it has no impact
on regression (a single fail in viking:2, but that must be
caused by gunnar_3_15.1)

Paul


gnugo/regression/games/owl42.sgf - new file:

(;GM[1]FF[4]
SZ[19]
GN[GNU Go 3.3.14 load and print]
DT[2003-01-05]
KM[5.5]AP[GNU Go 3.3.14]RU[Japanese]
;AW[cp][dp][bq][eq][br][dr][cs]
AB[bn][co][do][ap][bp][ep][fp][fq][fr][bs][es]
PL[B])



Index: engine/owl.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/owl.c,v
retrieving revision 1.135
diff -u -p -r1.135 owl.c
--- engine/owl.c        1 Jan 2003 12:41:25 -0000       1.135
+++ engine/owl.c        4 Jan 2003 22:37:38 -0000
@@ -4374,8 +4374,32 @@ owl_find_lunches(struct local_owl_data *
 }
 
 
+/* Returns true if and only if `pos' is a corner (1-1) point.
+ */
+static int
+corner_point(int pos)
+{
+  ASSERT_ON_BOARD1(pos);
+  
+  return pos == POS(0, 0)
+        || pos == POS(0, board_size - 1)
+        || pos == POS(board_size - 1, 0)
+        || pos == POS(board_size - 1, board_size - 1);
+}
+
+
 /* Try to improve the move to attack a lunch. Essentially we try to
  * avoid unsafe moves when there are less risky ways to attack.
+ *
+ * This function also improves lunch attack point in this special case:
+ *
+ * |.XXX       In this case it is better to play A2 rather than A1 since
+ * |XXOO       it saves an eye in the corner. We replace attack point if
+ * |XO..       three conditions are satisfied:
+ * |.O.O         a) lunch is a single stone
+ * |.XO.         b) it's attack point is a corner point
+ * +----         c) it has no neighbors in atari
+ *
  */
 static int
 improve_lunch_attack(int lunch, int attack_point)
@@ -4383,9 +4407,24 @@ improve_lunch_attack(int lunch, int atta
   int color = OTHER_COLOR(board[lunch]);
   int defense_point;
   int k;
+  int adj[MAXCHAIN];
+
+  if (safe_move(attack_point, color)) {
+    if (countstones(lunch) == 1 && corner_point(attack_point)
+       && chainlinks2(lunch, adj, 1) == 0) {
+      for (k = 0; k < 4; k++) {
+       int apos = attack_point + delta[k];
 
-  if (safe_move(attack_point, color))
+       if (board[apos] == EMPTY) {
+         if (safe_move(apos, color))
+           return apos;
+         break;
+       }
+      }
+    }
+  
     return attack_point;
+  }
 
   for (k = 0; k < 4; k++) {
     int pos = attack_point + delta[k];
Index: regression/owl1.tst
===================================================================
RCS file: /cvsroot/gnugo/gnugo/regression/owl1.tst,v
retrieving revision 1.38
diff -u -p -r1.38 owl1.tst
--- regression/owl1.tst 22 Dec 2002 02:07:39 -0000      1.38
+++ regression/owl1.tst 4 Jan 2003 22:37:41 -0000
@@ -135,6 +135,11 @@ loadsgf games/nngs/gnugo-3.3.12-RikiTiki
 293 defend Q6
 #? [0]*
 
+loadsgf games/owl42.sgf
+294 owl_attack C4
+#? [C3]
+
+
 ########### end of tests #####################
 
 # Report number of nodes visited by the tactical reading




reply via email to

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