Index: engine/aftermath.c =================================================================== RCS file: /cvsroot/gnugo/gnugo/engine/aftermath.c,v retrieving revision 1.37 diff -u -r1.37 aftermath.c --- engine/aftermath.c 30 Nov 2002 16:20:42 -0000 1.37 +++ engine/aftermath.c 30 Dec 2002 18:07:17 -0000 @@ -467,7 +467,7 @@ int important = 0; int safe_atari = 0; for (r = 0; r < 4; r++) { - int d = delta[r]; + d = delta[r]; if (!ON_BOARD(apos+d)) continue; if (board[apos+d] == other Index: engine/cache.h =================================================================== RCS file: /cvsroot/gnugo/gnugo/engine/cache.h,v retrieving revision 1.20 diff -u -r1.20 cache.h --- engine/cache.h 9 Oct 2002 18:36:23 -0000 1.20 +++ engine/cache.h 30 Dec 2002 18:07:18 -0000 @@ -20,6 +20,7 @@ \* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ #include +#include "hash.h" /* * This file, together with engine/hash.c implements hashing of go positions Index: engine/move_reasons.c =================================================================== RCS file: /cvsroot/gnugo/gnugo/engine/move_reasons.c,v retrieving revision 1.105 diff -u -r1.105 move_reasons.c --- engine/move_reasons.c 21 Dec 2002 18:25:51 -0000 1.105 +++ engine/move_reasons.c 30 Dec 2002 18:07:22 -0000 @@ -646,9 +646,9 @@ void add_attack_move(int pos, int ww, int code) { + ASSERT_ON_BOARD1(ww); ww = worm[ww].origin; - ASSERT_ON_BOARD1(ww); if (code == WIN) add_move_reason(pos, ATTACK_MOVE, ww); else if (code == KO_A) @@ -664,9 +664,9 @@ void add_defense_move(int pos, int ww, int code) { + ASSERT_ON_BOARD1(ww); ww = worm[ww].origin; - ASSERT_ON_BOARD1(ww); if (code == WIN) add_move_reason(pos, DEFEND_MOVE, ww); else if (code == KO_A) Index: engine/optics.c =================================================================== RCS file: /cvsroot/gnugo/gnugo/engine/optics.c,v retrieving revision 1.61 diff -u -r1.61 optics.c --- engine/optics.c 1 Dec 2002 22:51:23 -0000 1.61 +++ engine/optics.c 30 Dec 2002 18:07:26 -0000 @@ -424,7 +424,7 @@ } } - if (1 && (debug & DEBUG_EYES)) { + if (0 && (debug & DEBUG_EYES)) { start_draw_board(); for (i = 0; i < board_size; i++) for (j = 0; j < board_size; j++) { @@ -1034,7 +1034,8 @@ return 0; for (pos2 = BOARDMIN; pos2 < BOARDMAX; pos2++) - if (eye[pos2].origin == pos + if (ON_BOARD(pos2) + && eye[pos2].origin == pos && heye[pos2].type == HALF_EYE && heye[pos2].value < 3.0) { if (ko_halfeye != NO_MOVE) { ko_halfeye = NO_MOVE; /* We can't win two kos at once. */ @@ -1218,8 +1219,12 @@ && vpos[mv] != WEST(vpos[mn]) && vpos[mv] != NORTH(vpos[mn]) && vpos[mv] != EAST(vpos[mn]) - && (mv != mn - 1 || heye[vpos[mv]].type != HALF_EYE) - && (mn != mv - 1 || heye[vpos[mn]].type != HALF_EYE)) { + && (mv != mn - 1 + || vpos[mv] == NO_MOVE + || heye[vpos[mv]].type != HALF_EYE) + && (mn != mv - 1 + || vpos[mn] == NO_MOVE + || heye[vpos[mn]].type != HALF_EYE)) { ok = 0; break; } @@ -1263,7 +1268,9 @@ * marginal. This is the case if a half eye preceeds the * current vertex in the list. */ - if (ev->marginal && map[k] > 0 + if (ev->marginal + && map[k] > 0 + && vpos[map[k] - 1] != NO_MOVE && is_halfeye(heye, vpos[map[k] - 1])) { /* Add all diagonals as vital. */ int ix; @@ -1278,7 +1285,9 @@ if (ev->flags & EYE_DEFENSE_POINT) { /* Check for a half eye virtual marginal vertex. */ - if (ev->marginal && map[k] > 0 + if (ev->marginal + && map[k] > 0 + && vpos[map[k] - 1] != NO_MOVE && is_halfeye(heye, vpos[map[k] - 1])) { /* Add all diagonals as vital. */ int ix; Index: engine/value_moves.c =================================================================== RCS file: /cvsroot/gnugo/gnugo/engine/value_moves.c,v retrieving revision 1.73 diff -u -r1.73 value_moves.c --- engine/value_moves.c 22 Dec 2002 20:07:13 -0000 1.73 +++ engine/value_moves.c 30 Dec 2002 18:07:33 -0000 @@ -1926,8 +1926,6 @@ int l; int aa = NO_MOVE; int bb = NO_MOVE; - int a_id; - int b_id; float aa_value = 0.0; float bb_value = 0.0; @@ -1935,11 +1933,10 @@ float tot_value = 0.0; /* Strategical value of connecting or cutting dragons. */ - float *dragon_value = malloc(sizeof(float) * number_of_dragons); - gg_assert(dragon_value); + float dragon_value[BOARDMAX]; - for (k = 0; k < number_of_dragons; k++) - dragon_value[k] = 0.0; + for (aa = BOARDMIN; aa < BOARDMAX; aa++) + dragon_value[aa] = 0.0; for (k = 0; k < MAX_REASONS; k++) { int r = move[pos].reason[k]; @@ -1998,7 +1995,6 @@ for (l = 0; l < next_lunch; l++) if (lunch_worm[l] == aa) { bb = lunch_dragon[l]; - b_id = dragon[bb].id; /* FIXME: This value cannot be computed without some measurement * of how the actual move affects the dragon. The dragon safety @@ -2038,11 +2034,11 @@ || DRAGON2(bb).safety == INVINCIBLE)) this_value = 0.0; - if (this_value > dragon_value[b_id]) { + if (this_value > dragon_value[bb]) { DEBUG(DEBUG_MOVE_REASONS, " %1m: %f - %1m attacked/defended\n", pos, this_value, bb); - dragon_value[b_id] = this_value; + dragon_value[bb] = this_value; } } @@ -2140,8 +2136,8 @@ else this_value = 1.7 * dragon[cc].effective_size; - if (this_value > dragon_value[dragon[cc].id]) { - dragon_value[dragon[cc].id] = this_value; + if (this_value > dragon_value[dragon[cc].origin]) { + dragon_value[dragon[cc].origin] = this_value; DEBUG(DEBUG_MOVE_REASONS, " %1m: %f - connect %1m and %1m to attack thrashing dragon %1m\n", pos, this_value, aa, bb, cc); @@ -2162,17 +2158,14 @@ if (aa == bb) continue; - a_id = dragon[aa].id; - b_id = dragon[bb].id; - /* If we are ahead by more than 20, value connections more strongly */ if ((color == WHITE && score > 20.0) || (color == BLACK && score < -20.0)) this_value = connection_value(aa, bb, pos, gg_abs(score)); else this_value = connection_value(aa, bb, pos, 0); - if (this_value > dragon_value[a_id]) { - dragon_value[a_id] = this_value; + if (this_value > dragon_value[aa]) { + dragon_value[aa] = this_value; DEBUG(DEBUG_MOVE_REASONS, " %1m: %f - %1m cut/connect strategic value\n", pos, this_value, aa); @@ -2184,8 +2177,8 @@ this_value = connection_value(bb, aa, pos, gg_abs(score)); else this_value = connection_value(bb, aa, pos, 0); - if (this_value > dragon_value[b_id]) { - dragon_value[b_id] = this_value; + if (this_value > dragon_value[bb]) { + dragon_value[bb] = this_value; DEBUG(DEBUG_MOVE_REASONS, " %1m: %f - %1m cut/connect strategic value\n", pos, this_value, bb); @@ -2258,7 +2251,6 @@ * FIXME: Improve the implementation. */ aa = move_reasons[r].what; - a_id = dragon[aa].id; /* FIXME: This value cannot be computed without some * measurement of how the actual move affects the dragon. The @@ -2293,8 +2285,8 @@ } } - if (this_value > dragon_value[a_id]) { - dragon_value[a_id] = this_value; + if (this_value > dragon_value[aa]) { + dragon_value[aa] = this_value; DEBUG(DEBUG_MOVE_REASONS, " %1m: %f - %1m strategic attack/defend\n", pos, this_value, aa); @@ -2304,7 +2296,6 @@ case UNCERTAIN_OWL_DEFENSE: aa = move_reasons[r].what; - a_id = dragon[aa].id; /* If there is an adjacent dragon which is critical we should * skip this type of move reason, since attacking or defending @@ -2330,8 +2321,8 @@ else this_value = gg_min(2*dragon[aa].effective_size, gg_abs(0.65*score)); - if (this_value > dragon_value[a_id]) { - dragon_value[a_id] = this_value; + if (this_value > dragon_value[aa]) { + dragon_value[aa] = this_value; DEBUG(DEBUG_MOVE_REASONS, " %1m: %f - %1m uncertain owl defense bonus\n", pos, this_value, aa); @@ -2341,11 +2332,11 @@ } } - for (k = 0; k < number_of_dragons; k++) { - if (dragon_value[k] == 0.0) + for (aa = BOARDMIN; aa < BOARDMAX; aa++) { + if (dragon_value[aa] == 0.0) continue; - aa = dragon2[k].origin; + ASSERT1(dragon[aa].origin == aa, aa); /* If this dragon is critical but not attacked/defended by this * move, we ignore the strategic effect. @@ -2367,7 +2358,7 @@ && (attack_move_reason_known(pos, aa) || defense_move_reason_known(pos, aa))) { TRACE(" %1m: %f - %1m strategic value already counted - A.\n", - pos, dragon_value[k], aa); + pos, dragon_value[aa], aa); continue; } /* If the dragon has been owl captured, owl defended, or involved @@ -2381,7 +2372,7 @@ * value (e.g. because connecting to strong dragon) we award the * excess value as a bonus. */ - float excess_value = (dragon_value[k] - + float excess_value = (dragon_value[aa] - 2 * dragon[aa].effective_size); if (excess_value > 0.0) { TRACE(" %1m: %f - strategic bonus for %1m\n", pos, excess_value, aa); @@ -2389,19 +2380,17 @@ } else { TRACE(" %1m: %f - %1m strategic value already counted - B.\n", - pos, dragon_value[k], aa); + pos, dragon_value[aa], aa); } continue; } TRACE(" %1m: %f - strategic effect on %1m\n", - pos, dragon_value[k], aa); - tot_value += dragon_value[k]; + pos, dragon_value[aa], aa); + tot_value += dragon_value[aa]; } - free(dragon_value); - /* Finally, subtract penalty for invasion type moves. */ this_value = strategic_penalty(pos, color); if (this_value > 0.0) { Index: interface/gtp.h =================================================================== RCS file: /cvsroot/gnugo/gnugo/interface/gtp.h,v retrieving revision 1.10 diff -u -r1.10 gtp.h --- interface/gtp.h 8 Aug 2002 21:35:21 -0000 1.10 +++ interface/gtp.h 30 Dec 2002 18:07:33 -0000 @@ -38,6 +38,7 @@ \* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ #include +#include /* Maximum allowed line length in GTP. */ #define GTP_BUFSIZE 1000