Index: engine/board.c =================================================================== RCS file: /cvsroot/gnugo/gnugo/engine/board.c,v retrieving revision 1.74 diff -u -r1.74 board.c --- engine/board.c 20 May 2003 01:26:04 -0000 1.74 +++ engine/board.c 27 May 2003 08:25:26 -0000 @@ -673,7 +673,6 @@ showboard(0); dump_stack(); } - fflush(stdout); fflush(stderr); return 0; } @@ -814,7 +813,6 @@ #endif gprintf("%o\n"); - fflush(stdout); fflush(stderr); } Index: engine/combination.c =================================================================== RCS file: /cvsroot/gnugo/gnugo/engine/combination.c,v retrieving revision 1.45 diff -u -r1.45 combination.c --- engine/combination.c 15 Mar 2003 21:36:23 -0000 1.45 +++ engine/combination.c 27 May 2003 08:25:26 -0000 @@ -392,7 +392,7 @@ /* Accept illegal ko capture here. */ if (!tryko(move, color, NULL, EMPTY, NO_MOVE)) /* Really shouldn't happen. */ - abortgo(__FILE__, __LINE__, "trymove", I(move), J(move)); + abortgo(__FILE__, __LINE__, "trymove", move); increase_depth_values(); aa_val = do_atari_atari(other, &apos, &defense_point, NULL, @@ -789,65 +789,62 @@ atari_atari_succeeded(int color, int *attack_point, int *defense_point, int last_friendly, int save_verbose, int minsize) { - int m, n; + int pos; + int apos; int other = OTHER_COLOR(color); - for (m = 0; m < board_size; m++) - for (n = 0; n < board_size; n++) { - int ii = POS(m, n); - int aa; - - if (board[ii] != other) - continue; - - if (ii != find_origin(ii)) - continue; - - if (minsize > 0 - && get_aa_value(ii) < minsize) - continue; - - if (get_aa_status(ii) != ALIVE) - continue; - - if (board[last_friendly] != EMPTY - && !adjacent_strings(last_friendly, ii)) - continue; - - if (board[last_friendly] == EMPTY - && !liberty_of_string(last_friendly, ii)) - continue; - - if (debug & DEBUG_ATARI_ATARI) - gprintf("Considering attack of %1m. depth = %d.\n", ii, depth); - - if (attack(ii, &aa) && !forbidden[aa]) { - if (save_verbose || (debug & DEBUG_ATARI_ATARI)) { - gprintf("%oThe worm %1m can be attacked at %1m after ", ii, aa); - dump_stack(); - } - if (attack_point) - *attack_point = aa; - - /* We look for a move defending the combination. - * Normally this is found by find_defense but failing - * that, if the attacking move is a safe move for color, - * it probably defends. - */ - if (defense_point) { - if (!find_defense(ii, defense_point)) { - if (safe_move(aa, other)) - *defense_point = aa; - else - *defense_point = NO_MOVE; - } + for (pos = BOARDMIN; pos < BOARDMAX; pos++) { + if (board[pos] != other) + continue; + + if (pos != find_origin(pos)) + continue; + + if (minsize > 0 + && get_aa_value(pos) < minsize) + continue; + + if (get_aa_status(pos) != ALIVE) + continue; + + if (board[last_friendly] != EMPTY + && !adjacent_strings(last_friendly, pos)) + continue; + + if (board[last_friendly] == EMPTY + && !liberty_of_string(last_friendly, pos)) + continue; + + if (debug & DEBUG_ATARI_ATARI) + gprintf("Considering attack of %1m. depth = %d.\n", pos, depth); + + if (attack(pos, &apos) && !forbidden[apos]) { + if (save_verbose || (debug & DEBUG_ATARI_ATARI)) { + gprintf("%oThe worm %1m can be attacked at %1m after ", pos, apos); + dump_stack(); + } + if (attack_point) + *attack_point = apos; + + /* We look for a move defending the combination. + * Normally this is found by find_defense but failing + * that, if the attacking move is a safe move for color, + * it probably defends. + */ + if (defense_point) { + if (!find_defense(pos, defense_point)) { + if (safe_move(apos, other)) + *defense_point = apos; + else + *defense_point = NO_MOVE; } - - DEBUG(DEBUG_ATARI_ATARI, "%oreturn value:%d (%1m)\n", - get_aa_value(ii), ii); - return get_aa_value(ii); } + + DEBUG(DEBUG_ATARI_ATARI, "%oreturn value:%d (%1m)\n", + get_aa_value(pos), pos); + return get_aa_value(pos); } + } return 0; } Index: engine/dragon.c =================================================================== RCS file: /cvsroot/gnugo/gnugo/engine/dragon.c,v retrieving revision 1.111 diff -u -r1.111 dragon.c --- engine/dragon.c 11 May 2003 06:41:38 -0000 1.111 +++ engine/dragon.c 27 May 2003 08:25:28 -0000 @@ -1461,9 +1461,6 @@ if (w->cutstone2 > 0) gprintf("- cutstone2 = %d\n", w->cutstone2); - /* FIXME: List all attack and defense points. Also list all - * threats. - */ for (k = 0; k < MAX_TACTICAL_POINTS; k++) { if (w->attack_codes[k] == 0) break; @@ -1474,9 +1471,8 @@ for (k = 0; k < MAX_TACTICAL_POINTS; k++) { if (w->defense_codes[k] == 0) break; - if (w->defense_codes[k] != 0) - gprintf("- defendable at %1m, defend code = %d\n", - w->defense_points[k], w->defense_codes[k]); + gprintf("- defendable at %1m, defend code = %d\n", + w->defense_points[k], w->defense_codes[k]); } for (k = 0; k < MAX_TACTICAL_POINTS; k++) { @@ -1489,9 +1485,8 @@ for (k = 0; k < MAX_TACTICAL_POINTS; k++) { if (w->defense_threat_codes[k] == 0) break; - if (w->defense_threat_codes[k] != 0) - gprintf("- defense threat at %1m, defense threat code = %d\n", - w->defense_threat_points[k], w->defense_threat_codes[k]); + gprintf("- defense threat at %1m, defense threat code = %d\n", + w->defense_threat_points[k], w->defense_threat_codes[k]); } if (w->lunch != NO_MOVE) @@ -1573,7 +1568,6 @@ static void dragon_eye(int pos, struct eye_data eye[BOARDMAX]) { - int i, j; int ii; int dr = NO_MOVE; int color; @@ -1591,27 +1585,27 @@ color = WHITE; } - for (i = 0; i < board_size; i++) - for (j = 0; j < board_size; j++) { - ii = POS(i, j); - - if (eye[ii].origin == pos - && !eye[ii].marginal - && !(eye[ii].type & INHIBIT_CONNECTION)) { - for (k = 0; k < 4; k++) { - int d = delta[k]; - - if (board[ii+d] == color) { - if (dr == NO_MOVE) - dr = dragon[ii+d].origin; - else if (dragon[ii+d].origin != dr) { - join_dragons(ii+d, dr); - dr = dragon[ii+d].origin; - } + for (ii = BOARDMIN; ii < BOARDMAX; ii++) { + if (!ON_BOARD(ii)) + continue; + + if (eye[ii].origin == pos + && !eye[ii].marginal + && !(eye[ii].type & INHIBIT_CONNECTION)) { + for (k = 0; k < 4; k++) { + int d = delta[k]; + + if (board[ii+d] == color) { + if (dr == NO_MOVE) + dr = dragon[ii+d].origin; + else if (dragon[ii+d].origin != dr) { + join_dragons(ii+d, dr); + dr = dragon[ii+d].origin; } } } } + } } @@ -2265,13 +2259,13 @@ * for (ii = first_worm_in_dragon(pos); ii != NO_MOVE; * ii = next_worm_in_dragon(ii);) * ... - * At the moment first_worm(pos) will always be the origin of the dragon, - * but you should not rely on that. + * At the moment first_worm_in_dragon(pos) will always be the origin + * of the dragon, but you should not rely on that. */ int -first_worm_in_dragon(int w) +first_worm_in_dragon(int d) { - return dragon[w].origin; + return dragon[d].origin; } int Index: engine/influence.c =================================================================== RCS file: /cvsroot/gnugo/gnugo/engine/influence.c,v retrieving revision 1.79 diff -u -r1.79 influence.c --- engine/influence.c 6 May 2003 11:46:12 -0000 1.79 +++ engine/influence.c 27 May 2003 08:25:29 -0000 @@ -1810,7 +1810,8 @@ /* Export game advancement status (fuseki, chuban, yose) * Returned as a value between 0.0 (start) and 1.0 (game over) */ -float game_status(int color) +float +game_status(int color) { float status; influence_evaluate_position(color, NULL, &status); Index: engine/liberty.h =================================================================== RCS file: /cvsroot/gnugo/gnugo/engine/liberty.h,v retrieving revision 1.173 diff -u -r1.173 liberty.h --- engine/liberty.h 25 May 2003 22:46:54 -0000 1.173 +++ engine/liberty.h 27 May 2003 08:25:29 -0000 @@ -405,7 +405,7 @@ int is_same_dragon(int d1, int d2); int are_neighbor_dragons(int d1, int d2); void mark_dragon(int pos, char mx[BOARDMAX], char mark); -int first_worm_in_dragon(int w); +int first_worm_in_dragon(int d); int next_worm_in_dragon(int w); int lively_dragon_exists(int color); void compute_dragon_influence(void); @@ -1086,8 +1086,9 @@ int is_false_eye(struct half_eye_data heye[BOARDMAX], int pos); /* Our own abort() which prints board state on the way out. - * (i, j) is a "relevant" board position for info. */ -void abortgo(const char *file, int line, const char *msg, int i, int j); + * (pos) is a "relevant" board position for info. + */ +void abortgo(const char *file, int line, const char *msg, int pos); #if GG_TURN_OFF_ASSERTS #define ASSERT2(x, i, j) @@ -1095,11 +1096,11 @@ #else /* avoid dangling else */ /* FIXME: Should probably re-write these using do {...} while (0) idiom. */ -#define ASSERT2(x, i, j) if (x) ; else abortgo(__FILE__, __LINE__, #x, i, j) -#define ASSERT1(x, pos) if (x) ; else abortgo(__FILE__, __LINE__, #x, I(pos), J(pos)) +#define ASSERT2(x, i, j) if (x) ; else abortgo(__FILE__, __LINE__, #x, POS(i, j)) +#define ASSERT1(x, pos) if (x) ; else abortgo(__FILE__, __LINE__, #x, pos) #endif -#define gg_assert(x) ASSERT2(x, -1, -1); +#define gg_assert(x) ASSERT1(x, NO_MOVE); #endif /* _LIBERTY_H_ */ Index: engine/optics.c =================================================================== RCS file: /cvsroot/gnugo/gnugo/engine/optics.c,v retrieving revision 1.75 diff -u -r1.75 optics.c --- engine/optics.c 25 May 2003 22:46:54 -0000 1.75 +++ engine/optics.c 27 May 2003 08:25:31 -0000 @@ -3028,7 +3028,7 @@ vertices[num_vertices++] = POS(0, 0); /* Add small invincible black groups in contact with the marginal - * vertices, without dstroying the connectivity of the white stones. + * vertices, without destroying the connectivity of the white stones. * * FIXME: This algorithm is somewhat crude and may fail to add all * black groups if unlucky. Index: engine/owl.c =================================================================== RCS file: /cvsroot/gnugo/gnugo/engine/owl.c,v retrieving revision 1.164 diff -u -r1.164 owl.c --- engine/owl.c 25 May 2003 22:46:54 -0000 1.164 +++ engine/owl.c 27 May 2003 08:25:34 -0000 @@ -791,7 +791,6 @@ break; /* Do not try too many moves. */ - /* FIXME: Replace the hardcoded 6 below with a proper DEPTH constant. */ if (tested_moves > 2 || (stackp > semeai_branch_depth2 && tested_moves > 1) || (stackp > semeai_branch_depth && tested_moves > 0)) { @@ -1594,6 +1593,9 @@ /* Consider only the highest scoring move if we're deeper than * owl_branch_depth. + * + * FIXME: To behave as intended, k should be replaced by + * number_tried_moves. */ if (stackp > owl_branch_depth && k > 0) break; @@ -1617,7 +1619,7 @@ if (mw[mpos]) continue; - captured = (color==WHITE? white_captured : black_captured); + captured = (color == WHITE ? white_captured : black_captured); /* Try to make the move. */ if (!komaster_trymove(mpos, other, moves[k].name, str, @@ -1625,7 +1627,7 @@ &ko_move, savecode == 0)) continue; - captured = (color==WHITE? white_captured : black_captured) - captured; + captured = (color == WHITE ? white_captured : black_captured) - captured; TRACE("Trying %C %1m. Escape = %d. Current stack: ", other, mpos, escape); @@ -2163,6 +2165,9 @@ /* Consider only the highest scoring move if we're deeper than * owl_branch_depth. + * + * FIXME: To behave as intended, k should be replaced by + * number_tried_moves. */ if (stackp > owl_branch_depth && k > 0) break; @@ -2500,7 +2505,6 @@ int dummy_eyemin = 0; int dummy_eyemax = 0; struct eyevalue eyevalue; - /* FIXME: use MAX_EYES from move_reasons.h ? */ struct eyevalue eyevalue_list[BOARDMAX/2]; int eyes_attack_points[BOARDMAX/2]; int pessimistic_min; @@ -2547,8 +2551,10 @@ /* Reset halfeye data. Set topological eye value to something big. */ for (pos = BOARDMIN; pos < BOARDMAX; pos++) { - owl->half_eye[pos].type = 0; - owl->half_eye[pos].value = 10.0; + if (ON_BOARD(pos)) { + owl->half_eye[pos].type = 0; + owl->half_eye[pos].value = 10.0; + } } /* Find topological half eyes and false eyes. */ @@ -3755,7 +3754,7 @@ int pos; for (pos = BOARDMIN; pos < BOARDMAX; pos++) { - if (!ON_BOARD(pos) || board[pos] == EMPTY + if (!IS_STONE(board[pos]) || dragon[pos].origin != pos) continue; if (dragon[pos].status == CRITICAL Index: engine/persistent.c =================================================================== RCS file: /cvsroot/gnugo/gnugo/engine/persistent.c,v retrieving revision 1.10 diff -u -r1.10 persistent.c --- engine/persistent.c 8 Feb 2003 18:55:24 -0000 1.10 +++ engine/persistent.c 27 May 2003 08:25:39 -0000 @@ -627,12 +627,12 @@ void reading_hotspots(float values[BOARDMAX]) { - int m, n, k; + int pos; + int k; int sum_nodes = 0; - for (m = 0; m < board_size; m++) - for (n = 0; n < board_size; n++) - values[POS(m, n)] = 0.0; + for (pos = BOARDMIN; pos < BOARDMAX; pos++) + values[pos] = 0.0; /* Compute the total number of nodes for the cached entries. */ for (k = 0; k < persistent_reading_cache_size; k++) Index: engine/printutils.c =================================================================== RCS file: /cvsroot/gnugo/gnugo/engine/printutils.c,v retrieving revision 1.35 diff -u -r1.35 printutils.c --- engine/printutils.c 1 May 2003 20:55:26 -0000 1.35 +++ engine/printutils.c 27 May 2003 08:25:39 -0000 @@ -243,15 +243,15 @@ /* * A wrapper around abort() which shows the state variables at the time - * of the problem. (x, y) are typically a related move, or -1, -1. + * of the problem. (pos) is typically a related move, or NO_MOVE. */ void -abortgo(const char *file, int line, const char *msg, int x, int y) +abortgo(const char *file, int line, const char *msg, int pos) { verbose = 4; - TRACE("%o\n\n***assertion failure:\n%s:%d - %s near %m***\n\n", - file, line, msg, x, y); + TRACE("%o\n\n***assertion failure:\n%s:%d - %s near %1m***\n\n", + file, line, msg, pos); dump_stack(); /* Dump the stack as board images. */ Index: engine/score.c =================================================================== RCS file: /cvsroot/gnugo/gnugo/engine/score.c,v retrieving revision 1.19 diff -u -r1.19 score.c --- engine/score.c 25 Jan 2003 04:27:34 -0000 1.19 +++ engine/score.c 27 May 2003 08:25:39 -0000 @@ -396,13 +396,11 @@ } } if (chinese_rules) { - DEBUG(DEBUG_SCORING, - "in row %d, white area=%d, black=%d\n", - board_size - i, white_area_in_row, black_area_in_row); + DEBUG(DEBUG_SCORING, "in row %d, white area=%d, black=%d\n", + board_size - i, white_area_in_row, black_area_in_row); } else { - DEBUG(DEBUG_SCORING, - "in row %d, white territory=%d, black=%d\n", + DEBUG(DEBUG_SCORING, "in row %d, white territory=%d, black=%d\n", board_size - i, white_territory_in_row, black_territory_in_row); } } @@ -476,8 +474,7 @@ board_size-i, white_area_in_row, black_area_in_row); } else { - DEBUG(DEBUG_SCORING, - "in row %d, white territory=%d, black=%d\n", + DEBUG(DEBUG_SCORING, "in row %d, white territory=%d, black=%d\n", board_size-i, white_territory_in_row, black_territory_in_row); } } Index: engine/value_moves.c =================================================================== RCS file: /cvsroot/gnugo/gnugo/engine/value_moves.c,v retrieving revision 1.93 diff -u -r1.93 value_moves.c --- engine/value_moves.c 19 May 2003 16:11:16 -0000 1.93 +++ engine/value_moves.c 27 May 2003 08:25:39 -0000 @@ -129,7 +129,6 @@ { int unstable_worms[MAX_WORMS]; int N = 0; /* number of unstable worms */ - int m, n; int ii; int k; int other = OTHER_COLOR(color); @@ -138,134 +137,129 @@ TRACE("\nLooking for additional attack and defense moves. Trying moves ...\n"); /* Identify the unstable worms and store them in a list. */ - for (m = 0; m < board_size; m++) - for (n = 0; n acode) { - acode = this_acode; - if (acode >= worm[aa].attack_codes[0]) - defense_works = 0; - } + if (r < 0) + break; + what = move_reasons[r].what; + if (move_reasons[r].type == ATTACK_MOVE + || move_reasons[r].type == ATTACK_MOVE_GOOD_KO + || move_reasons[r].type == ATTACK_MOVE_BAD_KO + || move_reasons[r].type == DEFEND_MOVE + || move_reasons[r].type == DEFEND_MOVE_GOOD_KO + || move_reasons[r].type == DEFEND_MOVE_BAD_KO + || move_reasons[r].type == CONNECT_MOVE + || move_reasons[r].type == CUT_MOVE) + break; + /* FIXME: Add code for EITHER_MOVE and ALL_MOVE here. */ + } + + if (k == MAX_REASONS || move[ii].reason[k] == -1) + continue; + + /* Try the move at (ii) and see what happens. */ + cursor_at_start_of_line = 0; + TRACE("%1m ", ii); + if (trymove(ii, color, "find_more_attack_and_defense_moves", + NO_MOVE, EMPTY, NO_MOVE)) { + for (k = 0; k < N; k++) { + int aa = unstable_worms[k]; + + /* string of our color, see if there still is an attack, + * unless we already know the move works as defense move. + */ + if (board[aa] == color + && !defense_move_reason_known(ii, unstable_worms[k])) { + int acode = attack(aa, NULL); + if (acode < worm[aa].attack_codes[0]) { + /* Maybe attack() doesn't find the attack. Try to + * attack with the stored attack move. + */ + int defense_works = 1; + + if (trymove(worm[aa].attack_points[0], other, + "find_more_attack_and_defense_moves", 0, EMPTY, 0)) { + if (!board[aa]) + defense_works = 0; + else { + int this_acode = REVERSE_RESULT(find_defense(aa, NULL)); + if (this_acode > acode) { + acode = this_acode; + if (acode >= worm[aa].attack_codes[0]) + defense_works = 0; } - popgo(); - } - - if (defense_works) { - if (!cursor_at_start_of_line) - TRACE("\n"); - TRACE("%ofound extra point of defense of %1m at %1m code %d\n", - aa, ii, REVERSE_RESULT(acode)); - cursor_at_start_of_line = 1; - add_defense_move(ii, aa, REVERSE_RESULT(acode)); } + popgo(); } - } - /* string of opponent color, see if there still is a defense, - * unless we already know the move works as attack move. - */ - if (board[aa] == other - && !attack_move_reason_known(ii, unstable_worms[k])) { + if (defense_works) { + if (!cursor_at_start_of_line) + TRACE("\n"); + TRACE("%ofound extra point of defense of %1m at %1m code %d\n", + aa, ii, REVERSE_RESULT(acode)); + cursor_at_start_of_line = 1; + add_defense_move(ii, aa, REVERSE_RESULT(acode)); + } + } + } + + /* string of opponent color, see if there still is a defense, + * unless we already know the move works as attack move. + */ + if (board[aa] == other + && !attack_move_reason_known(ii, unstable_worms[k])) { + + int dcode = find_defense(aa, NULL); + if (dcode < worm[aa].defense_codes[0]) { + /* Maybe find_defense() doesn't find the defense. Try to + * defend with the stored defense move. + */ + int attack_works = 1; - int dcode = find_defense(aa, NULL); - if (dcode < worm[aa].defense_codes[0]) { - /* Maybe find_defense() doesn't find the defense. Try to - * defend with the stored defense move. - */ - int attack_works = 1; - - if (trymove(worm[aa].defense_points[0], other, - "find_more_attack_and_defense_moves", 0, - EMPTY, 0)) { - int this_dcode = REVERSE_RESULT(attack(aa, NULL)); - if (this_dcode > dcode) { - dcode = this_dcode; - if (dcode >= worm[aa].defense_codes[0]) - attack_works = 0; - } - popgo(); - } - - if (attack_works) { - if (!cursor_at_start_of_line) - TRACE("\n"); - TRACE("%ofound extra point of attack of %1m at %1m code %d\n", - aa, ii, REVERSE_RESULT(dcode)); - cursor_at_start_of_line = 1; - add_attack_move(ii, aa, REVERSE_RESULT(dcode)); + if (trymove(worm[aa].defense_points[0], other, + "find_more_attack_and_defense_moves", 0, EMPTY, 0)) { + int this_dcode = REVERSE_RESULT(attack(aa, NULL)); + if (this_dcode > dcode) { + dcode = this_dcode; + if (dcode >= worm[aa].defense_codes[0]) + attack_works = 0; } + popgo(); + } + + if (attack_works) { + if (!cursor_at_start_of_line) + TRACE("\n"); + TRACE("%ofound extra point of attack of %1m at %1m code %d\n", + aa, ii, REVERSE_RESULT(dcode)); + cursor_at_start_of_line = 1; + add_attack_move(ii, aa, REVERSE_RESULT(dcode)); } } } - popgo(); } + popgo(); } + } TRACE("\n"); decrease_depth_values(); @@ -2859,15 +2853,12 @@ /* This function is called if the biggest move on board was an illegal * ko capture. - * FIXME: We need a check here whether the threat still works after - * the opponent fills in the ko (or resolves it in another way.) */ static void reevaluate_ko_threats(int ko_move, int color) { int ko_stone = NO_MOVE; int opp_ko_move; - int m, n; int pos; int k; int type, what; @@ -2886,27 +2877,25 @@ ASSERT_ON_BOARD1(ko_stone); TRACE("Reevaluating ko threats.\n"); - for (m = 0; m < board_size; m++) - for (n = 0; n < board_size; n++) { - pos = POS(m, n); - if (pos == ko_move) - continue; - if (move[pos].additional_ko_value <= 0.0) - continue; + for (pos = BOARDMIN; pos < BOARDMAX; pos++) { + if (!ON_BOARD(pos) || pos == ko_move) + continue; + if (move[pos].additional_ko_value <= 0.0) + continue; - /* Otherwise we look for the biggest threat, and then check whether - * it still works after ko has been resolved. - */ - threat_size = 0.0; - type = -1; - what = -1; - for (k = 0; k < MAX_REASONS; k++) { - int r = move[pos].reason[k]; - if (r < 0) - break; - if (!(move_reasons[r].type & THREAT_BIT)) - continue; - switch (move_reasons[r].type) { + /* Otherwise we look for the biggest threat, and then check whether + * it still works after ko has been resolved. + */ + threat_size = 0.0; + type = -1; + what = -1; + for (k = 0; k < MAX_REASONS; k++) { + int r = move[pos].reason[k]; + if (r < 0) + break; + if (!(move_reasons[r].type & THREAT_BIT)) + continue; + switch (move_reasons[r].type) { case ATTACK_THREAT: case DEFEND_THREAT: if (worm[move_reasons[r].what].effective_size @@ -2922,7 +2911,7 @@ if (dragon[move_reasons[r].what].effective_size > threat_size) { threat_size = dragon[move_reasons[r].what]\ - .effective_size; + .effective_size; type = move_reasons[r].type; what = move_reasons[r].what; } @@ -2933,24 +2922,24 @@ */ gg_assert(0); break; - } - } - /* If there is no threat recorded, the followup value is probably - * contributed by a pattern. We can do nothing but accept this value. - * (although this does cause problems). - */ - if (type == -1) - threat_does_work = 1; - else { - if (trymove(pos, color, "reevaluate_ko_threats", ko_move, - EMPTY, ko_move)) { - ASSERT_ON_BOARD1(ko_stone); - if (!find_defense(ko_stone, &opp_ko_move)) - threat_does_work = 1; - else { - if (trymove(opp_ko_move, OTHER_COLOR(color), - "reevaluate_ko_threats", ko_move, EMPTY, NO_MOVE)) { - switch (type) { + } + } + /* If there is no threat recorded, the followup value is probably + * contributed by a pattern. We can do nothing but accept this value. + * (although this does cause problems). + */ + if (type == -1) + threat_does_work = 1; + else { + if (trymove(pos, color, "reevaluate_ko_threats", ko_move, + EMPTY, ko_move)) { + ASSERT_ON_BOARD1(ko_stone); + if (!find_defense(ko_stone, &opp_ko_move)) + threat_does_work = 1; + else { + if (trymove(opp_ko_move, OTHER_COLOR(color), + "reevaluate_ko_threats", ko_move, EMPTY, NO_MOVE)) { + switch (type) { case ATTACK_THREAT: threat_does_work = attack(what, NULL); break; @@ -2966,34 +2955,34 @@ * same dragon as ko_move. (Can this really happen?) */ threat_does_work = (ko_move_target != what); - } - popgo(); - - /* Is this a losing ko threat? */ - if (threat_does_work && type == ATTACK_THREAT) { - int apos; - if (attack(pos, &apos) - && does_defend(apos, what) - && !is_proper_eye_space(apos)) { - threat_does_work = 0; - } + } + popgo(); + + /* Is this a losing ko threat? */ + if (threat_does_work && type == ATTACK_THREAT) { + int apos; + if (attack(pos, &apos) + && does_defend(apos, what) + && !is_proper_eye_space(apos)) { + threat_does_work = 0; } - } - } - popgo(); - } - } - - if (threat_does_work) { - TRACE("%1m: %f + %f = %f\n", pos, move[pos].value, - move[pos].additional_ko_value, - move[pos].value + move[pos].additional_ko_value); - move[pos].value += move[pos].additional_ko_value; + } + } + } + popgo(); } - else - DEBUG(DEBUG_MOVE_REASONS, - "%1m: no additional ko value (threat does not work as ko threat)\n", pos); } + + if (threat_does_work) { + TRACE("%1m: %f + %f = %f\n", pos, move[pos].value, + move[pos].additional_ko_value, + move[pos].value + move[pos].additional_ko_value); + move[pos].value += move[pos].additional_ko_value; + } + else + DEBUG(DEBUG_MOVE_REASONS, + "%1m: no additional ko value (threat does not work as ko threat)\n", pos); + } } Index: engine/worm.c =================================================================== RCS file: /cvsroot/gnugo/gnugo/engine/worm.c,v retrieving revision 1.52 diff -u -r1.52 worm.c --- engine/worm.c 22 Feb 2003 10:54:24 -0000 1.52 +++ engine/worm.c 27 May 2003 08:25:39 -0000 @@ -1611,7 +1611,7 @@ #endif /* FIXME: Don't attack the same string more than once. - * Play (ti, tj) and see if there is a defense. + * Play (move) and see if there is a defense. */ if (trymove(move, color, "attack_callback", str, EMPTY, NO_MOVE)) { int dcode; Index: patterns/barriers.db =================================================================== RCS file: /cvsroot/gnugo/gnugo/patterns/barriers.db,v retrieving revision 1.53 diff -u -r1.53 barriers.db --- patterns/barriers.db 21 May 2003 14:37:39 -0000 1.53 +++ patterns/barriers.db 27 May 2003 08:25:39 -0000 @@ -113,7 +113,6 @@ |,o? |.OX - :8,OD |ao? @@ -2146,11 +2145,11 @@ |x!xx |.!.x -|.B.C +|.X.B |AQO? |.oo? -;!attack(A) && oplay_disconnect(A,C) && !attack(C) +;!attack(A) && oplay_disconnect(A,B) && !attack(B) Pattern Nonterritory1 Index: patterns/conn.db =================================================================== RCS file: /cvsroot/gnugo/gnugo/patterns/conn.db,v retrieving revision 1.36 diff -u -r1.36 conn.db --- patterns/conn.db 27 Mar 2003 10:33:12 -0000 1.36 +++ patterns/conn.db 27 May 2003 08:25:39 -0000 @@ -460,7 +460,7 @@ Pattern EB25 # tm New Pattern (3.1.22) -O!. cutable keima on edge. +O!. cutable keima on edge .*O .!. --- @@ -909,7 +909,7 @@ # ######################## -# Static connections needs almost everything +# Static connections need almost everything callback_data .Oxo,! @@ -1021,7 +1021,7 @@ # ############################################## -# Static connections needs almost everything +# Static connections need almost everything callback_data .Oxo,! Index: patterns/endgame.db =================================================================== RCS file: /cvsroot/gnugo/gnugo/patterns/endgame.db,v retrieving revision 1.51 diff -u -r1.51 endgame.db --- patterns/endgame.db 27 May 2003 07:43:50 -0000 1.51 +++ patterns/endgame.db 27 May 2003 08:25:39 -0000 @@ -218,12 +218,13 @@ :8,OXe,terri(0.1) ?ab -XOc descend to edge -.*d may quite possibly be 0 points gote +XOc +.*d --- ;o_somewhere(a,b,c,d) + Pattern EE6 .OOOXX @@ -762,12 +763,13 @@ |*A? |OXX |.OX ----- ++--- ;alive(A) Pattern EE416 +# pp New pattern (3.3.18) |.OO? |..*X @@ -775,14 +777,13 @@ :8,OXe -|.BB? -|..aX +|.aa? +|..*X +---- -;xplay_attack(a,B) && !oplay_attack(a,B) - ->prevent_attack_threat(B) +;xplay_attack(*,a) && !oplay_attack(*,a) +>prevent_attack_threat(a) # miscellaneous first line moves Index: patterns/eyes.db =================================================================== RCS file: /cvsroot/gnugo/gnugo/patterns/eyes.db,v retrieving revision 1.38 diff -u -r1.38 eyes.db --- patterns/eyes.db 11 May 2003 16:58:53 -0000 1.38 +++ patterns/eyes.db 27 May 2003 08:25:40 -0000 @@ -3804,7 +3804,6 @@ # Pattern 6601 -# FIXME: Do all patterns of this type. ... ... Index: patterns/mkpat.c =================================================================== RCS file: /cvsroot/gnugo/gnugo/patterns/mkpat.c,v retrieving revision 1.120 diff -u -r1.120 mkpat.c --- patterns/mkpat.c 12 May 2003 08:50:42 -0000 1.120 +++ patterns/mkpat.c 27 May 2003 08:25:42 -0000 @@ -638,11 +638,6 @@ * value in the val_mask, we have a match. This test can be * applied in parallel : 2 bits per posn x 16 posns = 32 bits. * "Don't care" has and_mask = val_mask = 0, which is handy ! - * FIXME: Looks like element "." (don't care) has and_mask 3, not 0, - * as indicated in the comments above. - * (answer) "Don't care" means '?', not '.'. The comments mean that - * we don't have to search for '?'s directly, since their - * masks are 0, and it is set up by initialization. */ static void Index: patterns/owl_attackpats.db =================================================================== RCS file: /cvsroot/gnugo/gnugo/patterns/owl_attackpats.db,v retrieving revision 1.85 diff -u -r1.85 owl_attackpats.db --- patterns/owl_attackpats.db 27 May 2003 07:43:51 -0000 1.85 +++ patterns/owl_attackpats.db 27 May 2003 08:25:43 -0000 @@ -1126,6 +1126,7 @@ :8,-,value(55) + ######################################################### # # # Limiting moves on the first line # @@ -2342,6 +2343,7 @@ :8,-,value(75) + Pattern A620 #evand New Pattern. (3.3.18) @@ -3555,6 +3557,7 @@ ;!oplay_connect(*,A,B) + Pattern A1023 # evand New pattern. (3.3.18) @@ -4301,6 +4304,7 @@ ;owl_escape_value(a) + owl_escape_value(b) + ;owl_escape_value(c) + owl_escape_value(d) > 0 + Pattern A1133b # evand New pattern. (3.3.20) @@ -5167,7 +5171,7 @@ |.O? |.XO |X.Y -|..X +|..X |*.X |.A? +--- @@ -5193,7 +5197,7 @@ |OXO |.XO |X.Y -|..X +|..X |*.X |.A? +--- Index: patterns/owl_defendpats.db =================================================================== RCS file: /cvsroot/gnugo/gnugo/patterns/owl_defendpats.db,v retrieving revision 1.97 diff -u -r1.97 owl_defendpats.db --- patterns/owl_defendpats.db 12 May 2003 10:06:51 -0000 1.97 +++ patterns/owl_defendpats.db 27 May 2003 08:25:45 -0000 @@ -1103,7 +1103,7 @@ Pattern D302 -# FIXME: This pattern looks way to general (see owl:23) +# FIXME: This pattern looks way too general (see owl:23) XX.? push along O*.. @@ -2535,24 +2535,7 @@ ;!obvious_false_oeye(a) && !oplay_attack(b,*,*) -Pattern D640 -# gf New pattern. (3.3.20) -# Compare D720. - -?O*.o try to make eye on edge -O.... ------ - -:8,-,value(56) - -?O*bo -Oa... ------ - -;!obvious_false_oeye(a) && !oplay_attack(b,*,*) - - -Pattern D640 +Pattern D641 # evand New pattern. (3.3.20) xXOO. @@ -2570,6 +2553,23 @@ ;!obvious_false_oeye(a) || !obvious_false_oeye(b) +Pattern D642 +# tm New Pattern (3.1.22) (see trevord:910) + +X*O? Extend side eye-space in sente +?..o +---- + +:8,-,value(80) + +C*O? +?bao +---- + +;!obvious_false_oeye(a) +;&& oplay_attack(*,b,C) + + ######################################################### # # # Make eyeshape in the center # @@ -3605,24 +3605,6 @@ Pattern D839 -# tm New Pattern (3.1.22) (see trevord:910) -# gf FIXME: This is no corner pattern, move. (3.3.18) - -X*O? Extend side eye-space in sente -?..o ----- - -:8,-,value(80) - -C*O? -?bao ----- - -;!obvious_false_oeye(a) -;&& oplay_attack(*,b,C) - - -Pattern D840 # gf New pattern. (3.3.18) |.X?? Capture lunch with threat to make second eye @@ -5942,7 +5924,7 @@ :8,nE,value(90) -a.? +axx .*b ;(owl_strong_dragon(a) || owl_strong_dragon(b)) && !oplay_disconnect(*,a,b) @@ -5954,6 +5936,7 @@ O.? connect to strong friendly dragon to escape .*. ?.O + :8,nE,value(90) a.? @@ -6623,7 +6606,7 @@ ?cbd o... -OX.X +OX*X ?ao? ;(owl_escape_value(b)>0 || owl_escape_value(c)>0 || owl_escape_value(d)>0) Index: patterns/patterns.db =================================================================== RCS file: /cvsroot/gnugo/gnugo/patterns/patterns.db,v retrieving revision 1.109 diff -u -r1.109 patterns.db --- patterns/patterns.db 21 May 2003 14:37:39 -0000 1.109 +++ patterns/patterns.db 27 May 2003 08:25:47 -0000 @@ -5859,6 +5859,27 @@ :8,OXed +Pattern EB1022 +# db New pattern (3.1.28) + +?Xxx?? simply extend to avoid bad aji +oOX.x? +o.O*.. +...... +------ + +:8,O,shape(2) + +?Xxd?? +ocX.e? +obO*a. +...... +------ + +; oplay_attack(a,b,*,c) || x_alive_somewhere(d,e) +> replace(a,*) + + ################# # First line push ################# @@ -6116,8 +6137,8 @@ :8,Xe -?oD?? -b.Da? +?oX?? +b.Xa? ?.*.. ----- @@ -8117,8 +8138,6 @@ Pattern CB237 -# FIXME: Need a connection helper to verify -# that * can't be cut off & die in X moyo. (see viking:13) # tm Modified (3.1.23) # gf Corrected constraint. (3.3.12) @@ -9005,28 +9024,6 @@ :8,OX,shape(2) -Pattern CB336 -# db New pattern (3.1.28) -# gf FIXME: This is an edge pattern. Should be moved to EBxxx. (3.3.4) - -?Xxx?? simply extend to avoid bad aji -oOX.x? -o.O*.. -...... ------- - -:8,O,shape(2) - -?Xxd?? -ocX.e? -obO*a. -...... ------- - -; oplay_attack(a,b,*,c) || x_alive_somewhere(d,e) -> replace(a,*) - - Pattern CB337 # db added (3.3.3) # see nngs1:47 @@ -10160,7 +10157,6 @@ # Furthermore the second half of the constraint doesn't really make # sense. Consider removal. (3.3.17) - ?x? draw back for safety O.X .*O @@ -12745,7 +12741,7 @@ Pattern EJ75 #tm modified (3.1.22) (see trevorc:420) #FIXME: Pattern still seems a bit too general -# consider adding appriate constraint & C attribute. +# consider adding appropriate constraint. .X.?? connect under O*.oo Index: patterns/patterns2.db =================================================================== RCS file: /cvsroot/gnugo/gnugo/patterns/patterns2.db,v retrieving revision 1.61 diff -u -r1.61 patterns2.db --- patterns/patterns2.db 27 May 2003 07:43:51 -0000 1.61 +++ patterns/patterns2.db 27 May 2003 08:25:48 -0000 @@ -547,7 +547,7 @@ fHbg e*ad -# FIXME : Some of these could probably be replaced by break_through. +# FIXME : A readconnect constraint should be better. ;!oplay_attack_either(*,f,g) ;&& (oplay_attack(*,a,H) ; || (!oplay_defend(*,a,b,c,d,a) @@ -1291,14 +1291,13 @@ # pp New pattern (3.3.18) # (Work-around problem with NonTerritory11, see valuation of M19 in # endgame:830) +# It is shape-penalized since it can probably be a semeai attack/defense +# in exceptionally rare cases. But actually it is really an antisuji. ?XX? don't play stupid zero point gote o*.o ---- -# It is shape-penaltized since it can probably be a semeai attack/defense -# in exceptionally rare cases. But actually it is really an antisuji. - :8,X,shape(-10) aXXc @@ -1306,10 +1305,9 @@ ---- ; o_alive_somewhere(a,b) && o_alive_somewhere(c,d) -; && !oplay_attack(*,e,e) +; && !oplay_attack(*,e,e) ; && (oplay_attack(*,e,*) || (o_somewhere(c) ? oplay_attack(*,e,c) ; : oplay_attack(*,e,d))) - ########################### Index: sgf/sgfnode.c =================================================================== RCS file: /cvsroot/gnugo/gnugo/sgf/sgfnode.c,v retrieving revision 1.20 diff -u -r1.20 sgfnode.c --- sgf/sgfnode.c 22 Feb 2003 10:54:24 -0000 1.20 +++ sgf/sgfnode.c 27 May 2003 08:25:49 -0000 @@ -57,8 +57,6 @@ /* Some utility functions. */ /* ================================================================ */ -/* General FIXME: Move these somewhere? */ - /* * Utility: a checking, initializing malloc */ @@ -362,9 +360,6 @@ /* * Make an SGF property. - * - * FIXME: To speed up, we should have MkMoveProperty. - * Comment: We *never* have any speed problems with these functions. /iw */ SGFProperty * Index: sgf/sgftree.h =================================================================== RCS file: /cvsroot/gnugo/gnugo/sgf/sgftree.h,v retrieving revision 1.15 diff -u -r1.15 sgftree.h --- sgf/sgftree.h 2 Jan 2003 00:23:30 -0000 1.15 +++ sgf/sgftree.h 27 May 2003 08:25:49 -0000 @@ -53,13 +53,13 @@ typedef struct SGFProperty_t { struct SGFProperty_t *next; - short name; /* FIXME: should be char with enumed flags */ - char *value; /* FIXME: different types */ + short name; + char *value; } SGFProperty; typedef struct SGFNode_t { - SGFProperty *props; + SGFProperty *props; struct SGFNode_t *parent; struct SGFNode_t *child; struct SGFNode_t *next;