[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnugo-devel] scoring patch
From: |
Gunnar Farnebäck |
Subject: |
[gnugo-devel] scoring patch |
Date: |
Tue, 04 Jan 2005 05:01:30 +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) |
This patch solves score2:60 with no impact on the regular regressions.
- new static function all_own_neighbors_inessential() in aftermath.c
- do_aftermath_genmove() revised
/Gunnar
Index: engine/aftermath.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/aftermath.c,v
retrieving revision 1.50
diff -u -r1.50 aftermath.c
--- engine/aftermath.c 8 Nov 2004 04:10:02 -0000 1.50
+++ engine/aftermath.c 7 Dec 2004 05:01:02 -0000
@@ -30,10 +30,27 @@
static SGFTree *aftermath_sgftree;
+
static int do_aftermath_genmove(int color,
int under_control[BOARDMAX],
int do_capture_dead_stones);
+
+static int
+all_own_neighbors_inessential(int pos, int color)
+{
+ int k;
+ for (k = 0; k < 4; k++)
+ if (board[pos + delta[k]] == color
+ && DRAGON2(pos + delta[k]).safety != INESSENTIAL
+ && (DRAGON2(pos + delta[k]).safety != ALIVE
+ || DRAGON2(pos + delta[k]).owl_status != DEAD))
+ return 0;
+
+ return 1;
+}
+
+
/* External interface to do_aftermath_genmove().
*
* If the suggested move turn out not to be allowed we just return
@@ -648,7 +665,7 @@
if (board[pos] != EMPTY || distance[pos] != -1)
continue;
target = NO_MOVE;
- for (k = 0; k < 4; k++) {
+ for (k = 0; k < 8; k++) {
int pos2 = pos + delta[k];
if (!ON_BOARD(pos2))
continue;
@@ -657,8 +674,10 @@
&& (do_capture_dead_stones
|| worm[pos2].unconditional_status != DEAD)
&& DRAGON2(pos2).safety != INESSENTIAL) {
- target = pos2;
- break;
+ if (k < 4 || all_own_neighbors_inessential(pos, color)) {
+ target = pos2;
+ break;
+ }
}
}
if (target == NO_MOVE)
@@ -745,8 +764,13 @@
/* If we have an adjacent own dragon, which is not inessential,
* verify that it remains safe.
*/
- if (cc != NO_MOVE && !owl_does_defend(move, cc, NULL))
- continue;
+ if (cc != NO_MOVE && !owl_does_defend(move, cc, NULL)) {
+ int resulta, resultb;
+ owl_analyze_semeai_after_move(move, color, target, cc,
+ &resulta, &resultb, NULL, 1, NULL, 1);
+ if (resulta != 0)
+ continue;
+ }
/* If we don't allow self atari, also call confirm safety to
* avoid setting up combination attacks.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gnugo-devel] scoring patch,
Gunnar Farnebäck <=