[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnugo-devel] bugfix patch
From: |
Gunnar Farneback |
Subject: |
[gnugo-devel] bugfix patch |
Date: |
Thu, 24 Jan 2002 21:18:52 +0100 |
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 fixes a few reversed color bugs, most likely originating in
some copy and paste operation.
- bugfix in estimate_territorial_value()
- bugfix in find_worm_threats()
/Gunnar
Index: engine/value_moves.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/value_moves.c,v
retrieving revision 1.6
diff -u -r1.6 value_moves.c
--- engine/value_moves.c 22 Jan 2002 14:57:04 -0000 1.6
+++ engine/value_moves.c 24 Jan 2002 20:08:08 -0000
@@ -1052,6 +1052,7 @@
static void
estimate_territorial_value(int pos, int color, float score)
{
+ int other = OTHER_COLOR(color);
int k;
int aa = NO_MOVE;
@@ -1174,9 +1175,8 @@
case ATTACK_THREAT:
aa = worms[move_reasons[r].what];
- /* Threat on our stones. */
- if (board[aa] == color)
- break;
+ /* Make sure this is a threat to attack opponent stones. */
+ ASSERT1(board[aa] == other, aa);
if (dragon[aa].matcher_status == DEAD) {
DEBUG(DEBUG_MOVE_REASONS,
@@ -1238,7 +1238,7 @@
if (board[aa] != EMPTY
&& find_defense(aa, &defense_move) == WIN
&& defense_move != NO_MOVE) {
- if (trymove(defense_move, OTHER_COLOR(color),
+ if (trymove(defense_move, other,
"estimate_territorial_value-b", NO_MOVE,
EMPTY, NO_MOVE)) {
if (board[pos] == EMPTY || attack(pos, NULL) == WIN) {
@@ -1279,16 +1279,9 @@
case DEFEND_THREAT:
aa = worms[move_reasons[r].what];
- /* Threat on our stones. */
- if (board[aa] == color)
- break;
+ /* Make sure this is a threat to defend our stones. */
+ ASSERT1(board[aa] == color, aa);
- if (dragon[aa].matcher_status == DEAD) {
- DEBUG(DEBUG_MOVE_REASONS,
- " %1m: 0.0 - threatens to defend %1m (dead)\n", pos, aa);
- break;
- }
-
add_followup_value(pos, 2 * worm[aa].effective_size);
TRACE(" %1m: %f (followup) - threatens to defend %1m\n",
Index: engine/worm.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/worm.c,v
retrieving revision 1.27
diff -u -r1.27 worm.c
--- engine/worm.c 15 Dec 2001 14:35:26 -0000 1.27
+++ engine/worm.c 24 Jan 2002 20:08:10 -0000
@@ -1028,7 +1028,7 @@
|| liberty_of_string(bb, pos))
continue;
- if (trymove(bb, other, "threaten defense", pos, EMPTY, NO_MOVE)) {
+ if (trymove(bb, color, "threaten defense", pos, EMPTY, NO_MOVE)) {
if (attack(pos, NULL) == WIN) {
int dcode = find_defense(pos, NULL);
if (dcode != 0)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gnugo-devel] bugfix patch,
Gunnar Farneback <=