[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnugo-devel] reading patch
From: |
Gunnar Farneback |
Subject: |
[gnugo-devel] reading patch |
Date: |
Fri, 26 Oct 2001 22:48:27 +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) |
This patch to reading.c solves the test case reading:154 and as a
consequence trevor:3. I haven't run the rest of the regressions so I
don't know whether it has additional effects.
- break_chain2_efficient_moves() and break_chain2_moves() revised
/Gunnar
Index: engine/reading.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/reading.c,v
retrieving revision 1.26
diff -u -r1.26 reading.c
--- engine/reading.c 2001/10/26 07:21:11 1.26
+++ engine/reading.c 2001/10/26 20:42:33
@@ -4453,7 +4453,10 @@
break_chain2_efficient_moves(int str, int moves[MAX_MOVES],
int scores[MAX_MOVES], int *num_moves)
{
+ int color = board[str];
+ int other = OTHER_COLOR(color);
int r;
+ int k;
int adj, adjs[MAXCHAIN];
int adj2, adjs2[MAXCHAIN];
int libs[2];
@@ -4477,10 +4480,10 @@
continue;
findlib(adjs[r], 2, libs);
- if (approxlib(libs[0], board[adjs[r]], 3, NULL) <= 2)
- ADD_CANDIDATE_MOVE(libs[1], 0, moves, scores, *num_moves);
- if (approxlib(libs[1], board[adjs[r]], 3, NULL) <= 2)
- ADD_CANDIDATE_MOVE(libs[0], 0, moves, scores, *num_moves);
+ for (k = 0; k < 2; k++)
+ if (approxlib(libs[k], other, 3, NULL) <= 2
+ && !is_self_atari(libs[1 - k], color))
+ ADD_CANDIDATE_MOVE(libs[1 - k], 0, moves, scores, *num_moves);
/* A common special case is this kind of edge position
*
@@ -4550,6 +4553,7 @@
for (k = 0; k < 2; k++) {
unsafe[k] = is_self_atari(libs[k], color);
if (!unsafe[k]
+ || is_ko(libs[k], color, NULL)
|| (!require_safe
&& approxlib(libs[k], other, 5, NULL) < 5))
ADD_CANDIDATE_MOVE(libs[k], 0, moves, scores, *num_moves);