- potential_moves[] array converted to 1D 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 8 Nov 2004 22:13:44 -0000 @@ -576,11 +576,8 @@ void move_considered(int move, float value) { - int i = I(move); - int j = J(move); - if (value > potential_moves[i][j]) { - potential_moves[i][j] = value; - } + if (value > potential_moves[move]) + potential_moves[move] = value; } Index: engine/globals.c =================================================================== RCS file: /cvsroot/gnugo/gnugo/engine/globals.c,v retrieving revision 1.68 diff -u -r1.68 globals.c --- engine/globals.c 5 Nov 2004 01:19:00 -0000 1.68 +++ engine/globals.c 8 Nov 2004 22:13:44 -0000 @@ -37,7 +37,7 @@ int hashflags = HASH_DEFAULT; -float potential_moves[MAX_BOARD][MAX_BOARD]; +float potential_moves[BOARDMAX]; /* Used by reading. */ int depth; /* deep reading cut off */ Index: engine/gnugo.h =================================================================== RCS file: /cvsroot/gnugo/gnugo/engine/gnugo.h,v retrieving revision 1.114 diff -u -r1.114 gnugo.h --- engine/gnugo.h 8 Nov 2004 04:10:02 -0000 1.114 +++ engine/gnugo.h 8 Nov 2004 22:13:44 -0000 @@ -259,7 +259,7 @@ extern int mandated_owl_node_limit; /* Keep this as 2D until we change the entire API. */ -extern float potential_moves[MAX_BOARD][MAX_BOARD]; +extern float potential_moves[BOARDMAX]; extern int limit_search; /* limit move search to a portion of the board */ extern int oracle_exists; /* oracle is available for consultation */ Index: engine/sgffile.c =================================================================== RCS file: /cvsroot/gnugo/gnugo/engine/sgffile.c,v retrieving revision 1.32 diff -u -r1.32 sgffile.c --- engine/sgffile.c 8 Nov 2004 04:10:02 -0000 1.32 +++ engine/sgffile.c 8 Nov 2004 22:13:44 -0000 @@ -49,36 +49,32 @@ void sgffile_add_debuginfo(SGFNode *node, float value) { - int m, n; + int pos; char comment[24]; if (!outfilename[0]) return; - for (m = 0; m < board_size; ++m) - for (n = 0; n < board_size; ++n) { - if (BOARD(m, n) && (output_flags & OUTPUT_MARKDRAGONS)) { - switch (dragon[POS(m, n)].crude_status) { - case DEAD: - sgfLabel(node, "X", m, n); - break; - case CRITICAL: - sgfLabel(node, "!", m, n); - break; - default: - ; - } - } - - if (potential_moves[m][n] > 0.0 && (output_flags & OUTPUT_MOVEVALUES)) { - if (potential_moves[m][n] < 1.0) - sgfLabel(node, "<1", m, n); - else - sgfLabelInt(node, (int) potential_moves[m][n], m, n); - } + for (pos = BOARDMIN; pos < BOARDMAX; pos++) { + if (!ON_BOARD(pos)) + continue; + + if (IS_STONE(board[pos]) && (output_flags & OUTPUT_MARKDRAGONS)) { + if (dragon[pos].crude_status == DEAD) + sgfLabel(node, "X", I(pos), J(pos)); + else if (dragon[pos].crude_status == CRITICAL) + sgfLabel(node, "!", I(pos), J(pos)); } + + if (potential_moves[pos] > 0.0 && (output_flags & OUTPUT_MOVEVALUES)) { + if (potential_moves[pos] < 1.0) + sgfLabel(node, "<1", I(pos), J(pos)); + else + sgfLabelInt(node, (int) potential_moves[pos], I(pos), J(pos)); + } + } - if (value > 0 && (output_flags & OUTPUT_MOVEVALUES)) { + if (value > 0.0 && (output_flags & OUTPUT_MOVEVALUES)) { sprintf(comment, "Value of move: %.2f", value); sgfAddComment(node, comment); } Index: interface/play_test.c =================================================================== RCS file: /cvsroot/gnugo/gnugo/interface/play_test.c,v retrieving revision 1.17 diff -u -r1.17 play_test.c --- interface/play_test.c 8 Nov 2004 04:10:02 -0000 1.17 +++ interface/play_test.c 8 Nov 2004 22:13:44 -0000 @@ -174,16 +174,16 @@ else { mprintf("GNU Go plays %m ", i, j); if (!gnugo_is_pass(i, j)) - printf("(%.2f) ", potential_moves[i][j]); + printf("(%.2f) ", potential_moves[POS(i, j)]); } mprintf("- Game move %m ", m, n); - if (!gnugo_is_pass(m, n) && potential_moves[m][n] > 0.0) - printf("(%.2f) ", potential_moves[m][n]); + if (!gnugo_is_pass(m, n) && potential_moves[POS(m, n)] > 0.0) + printf("(%.2f) ", potential_moves[POS(m, n)]); printf("\n"); if (!quiet) { - replay_score += (potential_moves[i][j] - potential_moves[m][n]); - total_score += potential_moves[i][j]; + replay_score += (potential_moves[POS(i, j)] - potential_moves[POS(m, n)]); + total_score += potential_moves[POS(i, j)]; } } if (i != m || j != n) { @@ -191,23 +191,23 @@ gg_snprintf(buf, 127, "GNU Go resigns - Game move %s (%.2f)", location_to_string(POS(m, n)), gnugo_is_pass(m, n) - && potential_moves[m][n] < 0.0 ? - 0 : potential_moves[m][n]); + && potential_moves[POS(m, n)] < 0.0 ? + 0 : potential_moves[POS(m, n)]); else { gg_snprintf(buf, 127, "GNU Go plays %s (%.2f) - Game move %s (%.2f)", location_to_string(POS(i, j)), - gnugo_is_pass(i, j) ? 0 : potential_moves[i][j], + gnugo_is_pass(i, j) ? 0 : potential_moves[POS(i, j)], location_to_string(POS(m, n)), gnugo_is_pass(m, n) - && potential_moves[m][n] < 0.0 ? - 0 : potential_moves[m][n]); + && potential_moves[POS(m, n)] < 0.0 ? + 0 : potential_moves[POS(m, n)]); sgfCircle(node, i, j); } } else gg_snprintf(buf, 127, "GNU Go plays the same move %s (%.2f)", location_to_string(POS(i, j)), - gnugo_is_pass(i, j) ? 0 : potential_moves[i][j]); + gnugo_is_pass(i, j) ? 0 : potential_moves[POS(i, j)]); sgfAddComment(node, buf); sgffile_add_debuginfo(node, 0.0); }