gnugo-devel
[Top][All Lists]
Advanced

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

[gnugo-devel] Thrash around patch


From: Gunnar Farneback
Subject: [gnugo-devel] Thrash around patch
Date: Thu, 26 Jun 2003 22:06:43 +0200
User-agent: EMH/1.14.1 SEMI/1.14.3 (Ushinoya) FLIM/1.14.2 (Yagi-Nishiguchi) APEL/10.3 Emacs/20.7 (sparc-sun-solaris2.7) (with unibyte mode)

When faced with a very big handicap as white, GNU Go tends to think
that all its stones are dead after one or a few moves and pass. With a
sufficiently large handicap it even starts with a pass.

In most such positions it's hard to argue that white would stand a
chance against reasonable play by black, but presumably black took all
those handicap stones for a reason. Thus it's desirable that GNU Go
thrashes around for a while hoping that black will make sufficiently
big mistakes and let white live.

This patch implements that functionality.

- new function thrash_around_helper()
- thrashing patterns in patterns.db

/Gunnar

Index: patterns/helpers.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/patterns/helpers.c,v
retrieving revision 1.51
diff -u -r1.51 helpers.c
--- patterns/helpers.c  27 Mar 2003 10:33:13 -0000      1.51
+++ patterns/helpers.c  26 Jun 2003 19:23:55 -0000
@@ -792,6 +791,40 @@
       popgo();
   }
 }
+
+
+/* True if
+ * 1. White to move.
+ * 2. All white stones look dead.
+ * 3. Less than 40% of the board is filled or less than 20% of the
+ *    board is filled with white stones.
+ *
+ * This is intended for patterns forcing white to thrash around early
+ * in high handicap games, instead of passing because it looks like no
+ * stones can live.
+ */
+int 
+thrash_around_helper(ARGS)
+{
+  int d;
+  UNUSED(pattern);
+  UNUSED(trans);
+  UNUSED(move);
+  
+  if (doing_scoring
+      || (stones_on_board(BLACK | WHITE) > board_size * board_size * 2 / 5
+         && stones_on_board(WHITE) > board_size * board_size / 5)
+      || color == BLACK)
+    return 0;
+
+  for (d = 0; d < number_of_dragons; d++)
+    if (DRAGON(d).color == WHITE
+       && DRAGON(d).status != DEAD)
+      return 0;
+
+  return 1;
+}
+
 
 /*
  * LOCAL Variables:
Index: patterns/patterns.db
===================================================================
RCS file: /cvsroot/gnugo/gnugo/patterns/patterns.db,v
retrieving revision 1.112
diff -u -r1.112 patterns.db
--- patterns/patterns.db        25 Jun 2003 15:14:28 -0000      1.112
+++ patterns/patterns.db        26 Jun 2003 19:23:59 -0000
@@ -14275,6 +14276,270 @@
 
 ;olib(a)==2 && !oplay_attack(a,b,b)
 >replace(a,*)
+
+
+######################################################################
+#
+# Thrashing patterns.
+#
+# Patterns to force early moves when playing white against high
+# handicaps instead of passing because all stones look dead.
+# These patterns are disabled by the thrash_around_helper when white has
+# managed to get living stones or when at least 40% of the board is
+# covered.
+#
+######################################################################
+
+Pattern Th1
+
+.....
+X.*.X
+.....
+.....
+-----
+
+:|,-,value(5),thrash_around_helper
+
+
+Pattern Th2
+
+xxXxx
+o...o
+o.*.o
+.....
+.....
+-----
+
+:|,-,value(5),thrash_around_helper
+
+
+Pattern Th3
+
+oo.oo
+.X*.x
+.....
+.....
+.....
+-----
+
+:8,-,value(3),thrash_around_helper
+
+
+Pattern Th4
+
+ooXoo
+o.*.o
+.....
+.....
+-----
+
+:|,-,value(3),thrash_around_helper
+
+
+Pattern Th5
+
+X..o
+..*.
+....
+oooo
+
+:8,-,value(1),thrash_around_helper
+
+
+Pattern Th6
+
+...o
+X.*.
+....
+oooo
+
+:8,-,value(1),thrash_around_helper
+
+
+Pattern Th7
+
+....x
+.X.o.
+.*.o.
+....x
+
+:8,s,value(4),thrash_around_helper
+
+....x
+.X.a.
+.*.b.
+....x
+
+;o_somewhere(a,b)
+
+
+Pattern Th8
+
+oo..?
+*X.o.
+.O.o.
+....x
+
+:8,-,value(5),thrash_around_helper
+
+oo..?
+*X.a.
+.O.b.
+....x
+
+;o_somewhere(a,b)
+
+
+Pattern Th9
+
+....
+O.*.
+...x
+
+:8,-,value(3),thrash_around_helper
+
+
+Pattern Th10
+
+?x?
+.*x
+O.O
+?o?
+
+:8,-,value(3),thrash_around_helper
+
+
+Pattern Th11
+
+?x?
+o*?
+O.O
+?o?
+
+:8,-,value(2),thrash_around_helper
+
+
+Pattern Th12
+
+?.?
+.*.
+...
+O.O
+
+:|,-,value(3),thrash_around_helper
+
+
+Pattern Th13
+
+.O.
+...
+O.*
+
+:8,-,value(3),thrash_around_helper
+
+
+Pattern Th14
+
+x*O
+o..
+O.O
+
+:8,-,value(2),thrash_around_helper
+
+
+Pattern Th15
+
+xO*
+o..
+O.O
+
+:8,-,value(2),thrash_around_helper
+
+
+Pattern Th16
+
+?.O.?
+x*.O?
+??..x
+
+:8,-,value(3),thrash_around_helper
+
+
+Pattern Th17
+# FIXME: Give value to all attack threats.
+
+?O?
+*XO
+?.?
+
+:8,-,value(4),thrash_around_helper
+
+
+Pattern Th18
+# FIXME: Give value to all attack threats.
+
+?O?
+*XO
+?.?
+
+:8,s,value(0.5),thrash_around_helper
+
+
+Pattern Th19
+
+*Ox
+O.O
+.O.
+
+:8,n,value(1),thrash_around_helper
+
+
+Pattern Th20
+
+?.o.
+.*X.
+?...
+
+:8,s,value(0.5),thrash_around_helper
+
+
+Pattern Th21
+
+.O?
+*XO
+.Oo
+
+:8,s,value(1),thrash_around_helper
+
+
+Pattern Th22
+
+..O
+*..
+...
+---
+
+:8,s,value(4),thrash_around_helper
+
+
+Pattern Th23
+
+?X?
+.*O
+...
+---
+
+:8,s,value(2),thrash_around_helper
+
+
+Pattern Th24
+
+.*x
+.XO
+...
+---
+
+:8,s,value(3),thrash_around_helper
 
 
 # END OF FILE




reply via email to

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