[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [gnugo-devel] Re: [gtp] Re: resignation support in clients?
From: |
Gunnar Farnebäck |
Subject: |
Re: [gnugo-devel] Re: [gtp] Re: resignation support in clients? |
Date: |
Wed, 10 Nov 2004 01:55:35 +0100 |
User-agent: |
EMH/1.14.1 SEMI/1.14.3 (Ushinoya) FLIM/1.14.2 (Yagi-Nishiguchi) APEL/10.3 Emacs/21.3 (sparc-sun-solaris2.9) MULE/5.0 (SAKAKI) |
I wrote (on September 2):
> In the special case where GNU Go finds that all its stones are dead
> and the "thrash around for a while anyway" patterns don't kick in it
> would at least be very natural to resign rather than pass. It should
> be an easy patch.
It wasn't easy until I changed the genmove() interface, but now it is.
This patch also changes the lively_dragon_exists() function to be
based on status instead of crude_status. As far as I can tell it
wasn't intentional that it used crude_status but an oversight when the
old status field was renamed to crude_status.
- resign rather than pass when all own stones seem dead
- lively_dragon_exists() based on status rather than crude_status
/Gunnar
Index: engine/dragon.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/dragon.c,v
retrieving revision 1.143
diff -u -r1.143 dragon.c
--- engine/dragon.c 13 Sep 2004 10:45:11 -0000 1.143
+++ engine/dragon.c 9 Nov 2004 20:23:05 -0000
@@ -494,7 +494,7 @@
lively_white_dragons = 0;
lively_black_dragons = 0;
for (d = 0; d < number_of_dragons; d++)
- if (DRAGON(d).crude_status != DEAD) {
+ if (DRAGON(d).status != DEAD) {
if (DRAGON(d).color == WHITE)
lively_white_dragons++;
else
Index: engine/genmove.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/genmove.c,v
retrieving revision 1.96
diff -u -r1.96 genmove.c
--- engine/genmove.c 8 Nov 2004 04:10:02 -0000 1.96
+++ engine/genmove.c 9 Nov 2004 20:23:05 -0000
@@ -54,7 +54,7 @@
static void break_mirror_go(int color);
static int find_mirror_move(int *move, int color);
-static int should_resign(int color, float our_score);
+static int should_resign(int color, float our_score, int move);
void sgfShowConsideredMoves(void);
@@ -533,13 +533,14 @@
}
else {
TRACE("genmove() recommends %1m with value %f\n", move, *value);
- /* Maybe time to resign...
- */
- if (resign && resign_allowed
- && *value < 10.0 && should_resign(color, our_score)) {
- TRACE("... though, genmove() thinks the position is hopeless\n");
- *resign = 1;
- }
+ }
+
+ /* Maybe time to resign...
+ */
+ if (resign && resign_allowed
+ && *value < 10.0 && should_resign(color, our_score, move)) {
+ TRACE("... though, genmove() thinks the position is hopeless\n");
+ *resign = 1;
}
/* If statistics is turned on, this is the place to show it. */
@@ -743,16 +744,24 @@
/* Helper to decide whether GG should resign a game
*/
static int
-should_resign(int color, float our_score)
+should_resign(int color, float our_score, int move)
{
float status;
int d;
/* We resign 19x19 games only, smaller board games are fast enough.
* We resign only if the margin is bigger than 45 pts and if we are
* behind (of course).
+ *
+ * As an exception to this rule, we resign on any board size if
+ * it looks like all our dragons are dead and the generated move
+ * is a pass.
*/
- if (board_size < 19
- || our_score > -45.0)
+ if (move == PASS_MOVE && !lively_dragon_exists(color))
+ return 1;
+
+ if (move != PASS_MOVE
+ || board_size < 19
+ || our_score > -45.0)
return 0;
/* Check dragon statuses. If a friendly dragon is critical, we are
* possibly not that much behind after we save it. If some hostile
Index: patterns/helpers.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/patterns/helpers.c,v
retrieving revision 1.63
diff -u -r1.63 helpers.c
--- patterns/helpers.c 8 Sep 2004 17:03:42 -0000 1.63
+++ patterns/helpers.c 9 Nov 2004 20:23:05 -0000
@@ -763,14 +763,10 @@
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)
+ || color == BLACK
+ || lively_dragon_exists(WHITE))
return 0;
- for (d = 0; d < number_of_dragons; d++)
- if (DRAGON(d).color == WHITE
- && DRAGON(d).status != DEAD)
- return 0;
-
return 1;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: [gnugo-devel] Re: [gtp] Re: resignation support in clients?,
Gunnar Farnebäck <=