Index: doc/dragon.texi =================================================================== RCS file: /cvsroot/gnugo/gnugo/doc/dragon.texi,v retrieving revision 1.16 diff -u -r1.16 dragon.texi --- doc/dragon.texi 13 Nov 2003 22:48:40 -0000 1.16 +++ doc/dragon.texi 25 May 2004 01:57:27 -0000 @@ -329,7 +329,7 @@ @code{worm[]} is constant on each worm, the data in @code{dragon[]} is constant on each dragon. -Amalgamation of worms in GNU Go 3.0 proceeds as follows. +Amalgamation of worms in GNU Go proceeds as follows. First we amalgamate all boundary components of an eyeshape. Thus in the following example: Index: doc/influence.texi =================================================================== RCS file: /cvsroot/gnugo/gnugo/doc/influence.texi,v retrieving revision 1.22 diff -u -r1.22 influence.texi --- doc/influence.texi 30 Jul 2003 07:30:29 -0000 1.22 +++ doc/influence.texi 25 May 2004 01:57:27 -0000 @@ -277,7 +277,7 @@ has two territory more, for a total difference of 18 points. That the influence function counts the value of captured stones was -introduced in GNU Go 3.2.. Previously this was instead done using the +introduced in GNU Go 3.2. Previously this was instead done using the effective_size heuristic. The effective size is the number of stones plus the surrounding empty spaces which are closer to this string or dragon than to any other stones. Here the @samp{O} Index: engine/board.c =================================================================== RCS file: /cvsroot/gnugo/gnugo/engine/board.c,v retrieving revision 1.96 diff -u -r1.96 board.c --- engine/board.c 29 Apr 2004 23:59:21 -0000 1.96 +++ engine/board.c 25 May 2004 01:57:28 -0000 @@ -1295,7 +1295,8 @@ return komaster; } -int get_kom_pos() +int +get_kom_pos() { return kom_pos; } @@ -2266,7 +2267,7 @@ libs1 = string[n].libs; for (k = 0; k < liberties2; k++) - if (!UNMARKED_LIBERTY(libs1[k])){ + if (!UNMARKED_LIBERTY(libs1[k])) { if (commonlibs < maxlib) libs[commonlibs] = libs1[k]; commonlibs++; Index: engine/boardlib.c =================================================================== RCS file: /cvsroot/gnugo/gnugo/engine/boardlib.c,v retrieving revision 1.2 diff -u -r1.2 boardlib.c --- engine/boardlib.c 24 Jan 2004 04:04:56 -0000 1.2 +++ engine/boardlib.c 25 May 2004 01:57:28 -0000 @@ -41,15 +41,15 @@ int move_history_pos[MAX_MOVE_HISTORY]; int move_history_pointer; -float komi; -int movenum; -int allow_suicide = 0; /* allow opponent to make suicide moves */ +float komi; +int movenum; +int allow_suicide = 0; /* allow opponent to make suicide moves */ Intersection shadow[BOARDMAX]; /* Hashing of positions. */ -Hash_data hashdata; +Hash_data hashdata; int stackp; /* stack pointer */ int position_number; /* position number */ Index: engine/cache.c =================================================================== RCS file: /cvsroot/gnugo/gnugo/engine/cache.c,v retrieving revision 1.42 diff -u -r1.42 cache.c --- engine/cache.c 22 May 2004 20:21:43 -0000 1.42 +++ engine/cache.c 25 May 2004 01:57:28 -0000 @@ -158,7 +158,7 @@ /* Set result and move. Return value: * 0 if not found - * 1 if found, but depth to small to be trusted. In this case the move + * 1 if found, but depth too small to be trusted. In this case the move * can be used for move ordering. * 2 if found and depth is enough so that the result can be trusted. */ Index: engine/cache.h =================================================================== RCS file: /cvsroot/gnugo/gnugo/engine/cache.h,v retrieving revision 1.49 diff -u -r1.49 cache.h --- engine/cache.h 22 May 2004 20:21:43 -0000 1.49 +++ engine/cache.h 25 May 2004 01:57:28 -0000 @@ -60,7 +60,7 @@ unsigned int data; /* Should be 32 bits, but only wastes 25% if 64 bits. */ } Hashnode; -#define HN_MAX_REMAINING_DEPTH 31 +#define HN_MAX_REMAINING_DEPTH 31 /* Hashentry: an entry, with two nodes of the hash_table Index: engine/clock.c =================================================================== RCS file: /cvsroot/gnugo/gnugo/engine/clock.c,v retrieving revision 1.20 diff -u -r1.20 clock.c --- engine/clock.c 24 Jan 2004 04:04:56 -0000 1.20 +++ engine/clock.c 25 May 2004 01:57:28 -0000 @@ -113,8 +113,8 @@ static void timeval_print(FILE *outfile, double tv) { - int min; - double sec; + int min; + double sec; min = (int) tv / 60; sec = tv - min*60; @@ -222,7 +222,7 @@ void clock_push_button(int color) { - double now, dt, tme; + double now, dt, tme; if (!clk.clock_on) return; Index: engine/dragon.c =================================================================== RCS file: /cvsroot/gnugo/gnugo/engine/dragon.c,v retrieving revision 1.138 diff -u -r1.138 dragon.c --- engine/dragon.c 3 May 2004 03:29:46 -0000 1.138 +++ engine/dragon.c 25 May 2004 01:57:29 -0000 @@ -711,7 +711,7 @@ dragon[str].color = worm[str].color; dragon[str].origin = worm[str].origin; dragon[str].crude_status = UNKNOWN; - dragon[str].status = UNKNOWN; + dragon[str].status = UNKNOWN; half_eye[str].type = 0; half_eye[str].value = 10.0; /* Something big. */ @@ -854,8 +854,8 @@ } /* Expand from dist-1 to dist. Break out of the loop at the end if - * we couldn't expand anything. Never expand more than five steps. - */ + * we couldn't expand anything. Never expand more than five steps. + */ for (dist = 1; dist <= 5; dist++) { int found_one = 0; Index: engine/genmove.c =================================================================== RCS file: /cvsroot/gnugo/gnugo/engine/genmove.c,v retrieving revision 1.90 diff -u -r1.90 genmove.c --- engine/genmove.c 28 Apr 2004 16:37:30 -0000 1.90 +++ engine/genmove.c 25 May 2004 01:57:29 -0000 @@ -462,7 +462,7 @@ *move, val); } } - time_report(1, "move reasons with revised semeai status", NO_MOVE, 1.0); + time_report(1, "move reasons with revised thrashing status", NO_MOVE, 1.0); } /* If the move value is 6 or lower, we look for endgame patterns too. */ @@ -492,7 +492,8 @@ *move, val); } } - time_report(1, "move reasons with revised semeai status", NO_MOVE, 1.0); + time_report(1, "move reasons with revised semeai or thrashing status", + NO_MOVE, 1.0); } /* If still no move, fill a remaining liberty. This should pick up @@ -553,7 +554,7 @@ /* Maybe time to resign... */ if (resign_allowed && val < 10.0 && should_resign(color, our_score)) { - TRACE("... though, genmove() thinks the position is hopeless\n" ); + TRACE("... though, genmove() thinks the position is hopeless\n"); /* Signal resignation by negating the move value */ val = -val; } Index: engine/gnugo.h =================================================================== RCS file: /cvsroot/gnugo/gnugo/engine/gnugo.h,v retrieving revision 1.108 diff -u -r1.108 gnugo.h --- engine/gnugo.h 28 Apr 2004 16:37:30 -0000 1.108 +++ engine/gnugo.h 25 May 2004 01:57:29 -0000 @@ -118,22 +118,22 @@ typedef struct { - int handicap; + int handicap; - int to_move; /* whose move it currently is */ - SGFTree game_record; /* Game record in sgf format. */ + int to_move; /* whose move it currently is */ + SGFTree game_record; /* Game record in sgf format. */ - int computer_player; /* BLACK, WHITE, or EMPTY (used as BOTH) */ + int computer_player; /* BLACK, WHITE, or EMPTY (used as BOTH) */ } Gameinfo; void gameinfo_clear(Gameinfo *ginfo, int boardsize, float komi); void gameinfo_print(Gameinfo *ginfo); void gameinfo_load_sgfheader(Gameinfo *gameinfo, SGFNode *head); void gameinfo_play_move(Gameinfo *ginfo, int i, int j, int color); -int gameinfo_play_sgftree_rot(Gameinfo *gameinfo, SGFTree *tree, - const char *untilstr, int orientation); -int gameinfo_play_sgftree(Gameinfo *gameinfo, SGFTree *tree, - const char *untilstr); +int gameinfo_play_sgftree_rot(Gameinfo *gameinfo, SGFTree *tree, + const char *untilstr, int orientation); +int gameinfo_play_sgftree(Gameinfo *gameinfo, SGFTree *tree, + const char *untilstr); /* ================================================================ */ Index: engine/influence.c =================================================================== RCS file: /cvsroot/gnugo/gnugo/engine/influence.c,v retrieving revision 1.101 diff -u -r1.101 influence.c --- engine/influence.c 30 Apr 2004 15:13:38 -0000 1.101 +++ engine/influence.c 25 May 2004 01:57:29 -0000 @@ -1358,7 +1358,7 @@ float diff = 0.0; if (q->white_influence[ii] + q->black_influence[ii] > 0) diff = (q->white_influence[ii] - q->black_influence[ii]) - /(q->white_influence[ii] + q->black_influence[ii]); + / (q->white_influence[ii] + q->black_influence[ii]); first_guess[ii] = diff * diff * diff; /* If both side have small influence, we have to reduce this value. Index: engine/liberty.h =================================================================== RCS file: /cvsroot/gnugo/gnugo/engine/liberty.h,v retrieving revision 1.215 diff -u -r1.215 liberty.h --- engine/liberty.h 28 Apr 2004 16:37:42 -0000 1.215 +++ engine/liberty.h 25 May 2004 01:57:29 -0000 @@ -384,7 +384,7 @@ void add_all_move(int pos, int reason1, int target1, int reason2, int target2); -int set_minimum_move_value(int pos, float value); +int set_minimum_move_value(int pos, float value); void set_maximum_move_value(int pos, float value); void set_minimum_territorial_value(int pos, float value); void set_maximum_territorial_value(int pos, float value); @@ -683,9 +683,9 @@ /* global variables */ /* ================================================================ */ -extern int disable_threat_computation; -extern int disable_endgame_patterns; -extern int doing_scoring; +extern int disable_threat_computation; +extern int disable_endgame_patterns; +extern int doing_scoring; /* Reading parameters */ extern int depth; /* deep reading cutoff */ @@ -732,8 +732,8 @@ extern char *rgoal; extern int goallib; -extern int transformation[MAX_OFFSET][8]; -extern const int transformation2[8][2][2]; +extern int transformation[MAX_OFFSET][8]; +extern const int transformation2[8][2][2]; /* Arrays pointing out the closest worms from each vertex. The first @@ -759,8 +759,8 @@ extern int forced_backfilling_moves[BOARDMAX]; extern double slowest_time; /* Timing statistics */ -extern int slowest_move; -extern int slowest_movenum; +extern int slowest_move; +extern int slowest_movenum; extern double total_time; @@ -877,7 +877,7 @@ int moyo_size; /* size of surrounding influence moyo, */ float moyo_territorial_value; /* ...and its territorial value */ - enum dragon_status safety; /* a more detailed status estimate */ + enum dragon_status safety; /* a more detailed status estimate */ float weakness; /* A new (3.4) continuous estimate of the dragon's safety */ float weakness_pre_owl; /* Dragon safety based on pre-owl computations */ int escape_route; /* a measurement of likelihood of escape */ Index: engine/move_reasons.c =================================================================== RCS file: /cvsroot/gnugo/gnugo/engine/move_reasons.c,v retrieving revision 1.126 diff -u -r1.126 move_reasons.c --- engine/move_reasons.c 28 Apr 2004 16:37:42 -0000 1.126 +++ engine/move_reasons.c 25 May 2004 01:57:29 -0000 @@ -851,7 +851,6 @@ void add_semeai_move(int pos, int dr) { - ASSERT_ON_BOARD1(dr); add_move_reason(pos, SEMEAI_MOVE, dragon[dr].origin); } Index: engine/optics.c =================================================================== RCS file: /cvsroot/gnugo/gnugo/engine/optics.c,v retrieving revision 1.89 diff -u -r1.89 optics.c --- engine/optics.c 28 Apr 2004 16:37:43 -0000 1.89 +++ engine/optics.c 25 May 2004 01:57:30 -0000 @@ -805,7 +805,7 @@ struct eye_data eye[BOARDMAX], struct half_eye_data heye[BOARDMAX]) { - static int bulk_coefficients[5] = {-1,-1, 1, 4, 12}; + static int bulk_coefficients[5] = {-1, -1, 1, 4, 12}; int pos2; int margins = 0; @@ -2701,7 +2701,7 @@ if (!ON_BOARD(pos2)) { if (!edge) return 0; - else if (u >= 0 && u <=3 && v >= 0 && v <= 3) + else if (u >= 0 && u <= 3 && v >= 0 && v <= 3) return 0; else if (I(pos2) != I(NORTH(marginpos)) && I(pos2) != I(SOUTH(marginpos)) Index: engine/owl.c =================================================================== RCS file: /cvsroot/gnugo/gnugo/engine/owl.c,v retrieving revision 1.212 diff -u -r1.212 owl.c --- engine/owl.c 22 May 2004 20:21:43 -0000 1.212 +++ engine/owl.c 25 May 2004 01:57:30 -0000 @@ -2042,7 +2042,7 @@ */ else if (experimental_owl_ext && goal_worms_computed #if 0 - && stackp>1 + && stackp > 1 #endif && captured >= 3) { int w = MAX_GOAL_WORMS; @@ -3165,8 +3165,8 @@ * If we capture the lunch by an illegal ko capture, we become * ko master with this move, and hence the above is true. */ - if (owl->lunch_attack_code[lunch] == WIN - || is_illegal_ko_capture(attack_point, owl->color)) + if (owl->lunch_attack_code[lunch] == WIN + || is_illegal_ko_capture(attack_point, owl->color)) owl_add_move(moves, attack_point, value, "eat lunch", 1, owl->lunch[lunch], 0, NO_MOVE, MAX_MOVES); else @@ -3540,7 +3540,7 @@ struct matched_pattern_data *matched_pattern; if (!list->initialized) return; - gprintf("%oList size %d. %d Patterns in list, %d have been used, .\n", + gprintf("%oList size %d. %d Patterns in list, %d have been used.\n", list->list_size, list->counter, list->used); for (i = 0; i < list->counter; i++) { matched_pattern = &list->pattern_list[i]; @@ -3569,7 +3569,7 @@ matched_patterns->pattern_list = realloc(matched_patterns->pattern_list, matched_patterns->list_size - * sizeof(struct matched_pattern_data)); + * sizeof(matched_patterns->pattern_list[0])); } next_pattern = &matched_patterns->pattern_list[matched_patterns->counter]; @@ -3756,8 +3756,7 @@ * but it is easier to allocate more than to count real number of * heap elements first. */ - list->pattern_heap = malloc(list->counter - * sizeof(struct matched_pattern_data *)); + list->pattern_heap = malloc(list->counter * sizeof(*(list->pattern_heap))); gg_assert(list->pattern_heap != NULL); for (pos = BOARDMIN; pos < BOARDMAX; pos++) @@ -4559,6 +4558,7 @@ if (!IS_STONE(board[pos]) || dragon[pos].origin != pos) continue; + if (dragon[pos].status == CRITICAL && DRAGON2(pos).owl_attack_point != NO_MOVE) { if (board[pos] == color) { @@ -4893,7 +4893,7 @@ if (defense_point) *defense_point = defense; if (kworm) - *kworm= wpos; + *kworm = wpos; return result; } @@ -4938,10 +4938,10 @@ * some stones of the goal dragon from the board. */ #if 1 - init_owl(&owl, target, NO_MOVE, NO_MOVE, 1); + init_owl(&owl, target, NO_MOVE, NO_MOVE, 1); #endif - if (trymove(move, other, "owl_does_attack", target)) { + if (trymove(move, other, "owl_does_attack", target)) { /* Check if a compatible owl_defend() is cached. */ if (search_persistent_owl_cache(OWL_DEFEND, origin, 0, 0, &result, NULL, kworm, NULL)) { Index: engine/persistent.c =================================================================== RCS file: /cvsroot/gnugo/gnugo/engine/persistent.c,v retrieving revision 1.23 diff -u -r1.23 persistent.c --- engine/persistent.c 23 Apr 2004 03:06:36 -0000 1.23 +++ engine/persistent.c 25 May 2004 01:57:30 -0000 @@ -929,7 +929,7 @@ /* Distance two expansion through empty intersections and own stones. */ for (k = 1; k < 3; k++) { - for (pos = BOARDMIN; pos < BOARDMAX; pos++){ + for (pos = BOARDMIN; pos < BOARDMAX; pos++) { if (!ON_BOARD(pos) || board[pos] == other || active[pos] != 0) continue; if ((ON_BOARD(SOUTH(pos)) && active[SOUTH(pos)] == k) @@ -1266,7 +1266,7 @@ /* Distance two expansion through empty intersections and own stones. */ for (k = 1; k < 3; k++) { - for (pos = BOARDMIN; pos < BOARDMAX; pos++){ + for (pos = BOARDMIN; pos < BOARDMAX; pos++) { if (!ON_BOARD(pos) || board[pos] == other || active[pos] != 0) continue; if ((ON_BOARD(SOUTH(pos)) && active[SOUTH(pos)] == k) @@ -1526,7 +1526,7 @@ /* Distance four expansion through empty intersections and own stones. */ for (k = 1; k < 5; k++) { - for (pos = BOARDMIN; pos < BOARDMAX; pos++){ + for (pos = BOARDMIN; pos < BOARDMAX; pos++) { if (!ON_BOARD(pos) || board[pos] == other || active[pos] > 0) continue; if ((ON_BOARD(SOUTH(pos)) && active[SOUTH(pos)] == k) Index: engine/reading.c =================================================================== RCS file: /cvsroot/gnugo/gnugo/engine/reading.c,v retrieving revision 1.142 diff -u -r1.142 reading.c --- engine/reading.c 22 May 2004 20:21:43 -0000 1.142 +++ engine/reading.c 25 May 2004 01:57:42 -0000 @@ -2729,7 +2729,7 @@ libs = countlib(str); - if (stackp > depth && libs>2) { + if (stackp > depth && libs > 2) { SGFTRACE(0, 0, "Too deep"); return 0; } @@ -4343,7 +4343,7 @@ } -/* (str) points to a group with two liberties. break_chain2_moves() +/* (str) points to a string with two or more liberties. break_chain2_moves() * tries to defend this string by attacking a neighbouring string with * two liberties. * This is done by playing on either of its liberties Index: engine/score.c =================================================================== RCS file: /cvsroot/gnugo/gnugo/engine/score.c,v retrieving revision 1.24 diff -u -r1.24 score.c --- engine/score.c 22 May 2004 20:05:17 -0000 1.24 +++ engine/score.c 25 May 2004 01:57:42 -0000 @@ -494,7 +494,7 @@ l = white_area - black_area + komi; else { DEBUG(DEBUG_SCORING, - "black captured: %d\nwhite captured: %d\nkomi: %f\n", + "black captured: %d\nwhite captured: %d\nkomi: %f\n", black_captured, white_captured, komi); l = white_territory + black_captured - black_territory - white_captured + komi; Index: engine/semeai.c =================================================================== RCS file: /cvsroot/gnugo/gnugo/engine/semeai.c,v retrieving revision 1.69 diff -u -r1.69 semeai.c --- engine/semeai.c 10 Apr 2004 14:30:03 -0000 1.69 +++ engine/semeai.c 25 May 2004 01:57:42 -0000 @@ -389,7 +389,7 @@ && (dragon2[d].owl_defense_point == NO_MOVE || dragon2[d].semeai_defense_certain >= dragon2[d].owl_defense_certain)) { - /* My dragon can be defended */ + /* My dragon can be defended. */ add_semeai_move(dragon2[d].semeai_defense_point, dragon2[d].origin); DEBUG(DEBUG_SEMEAI, "Adding semeai defense move for %1m at %1m\n", DRAGON(d).origin, dragon2[d].semeai_defense_point); @@ -432,7 +432,7 @@ || dragon2[d].owl_defense_point == NO_MOVE || dragon2[d].semeai_attack_certain >= dragon2[d].owl_attack_certain)) { - /* Your dragon can be attacked */ + /* Your dragon can be attacked. */ add_semeai_move(dragon2[d].semeai_attack_point, dragon2[d].origin); DEBUG(DEBUG_SEMEAI, "Adding semeai attack move for %1m at %1m\n", DRAGON(d).origin, dragon2[d].semeai_attack_point); Index: engine/sgfdecide.c =================================================================== RCS file: /cvsroot/gnugo/gnugo/engine/sgfdecide.c,v retrieving revision 1.55 diff -u -r1.55 sgfdecide.c --- engine/sgfdecide.c 28 Apr 2004 16:37:43 -0000 1.55 +++ engine/sgfdecide.c 25 May 2004 01:57:42 -0000 @@ -44,7 +44,7 @@ { int aa, dd; int acode, dcode; - SGFTree tree; + SGFTree tree; if (board[pos] == EMPTY) { fprintf(stderr, "gnugo: --decide-string called on an empty vertex\n"); Index: engine/surround.c =================================================================== RCS file: /cvsroot/gnugo/gnugo/engine/surround.c,v retrieving revision 1.12 diff -u -r1.12 surround.c --- engine/surround.c 24 Jan 2004 04:04:56 -0000 1.12 +++ engine/surround.c 25 May 2004 01:57:42 -0000 @@ -525,7 +525,7 @@ int dist = 10000; int ii; - for (ii = BOARDMIN; ii = 7) - aa_depth = gg_max(0, AA_DEPTH -1); + aa_depth = gg_max(0, AA_DEPTH - 1); else aa_depth = gg_max(0, AA_DEPTH - (8 - level)); Index: engine/value_moves.c =================================================================== RCS file: /cvsroot/gnugo/gnugo/engine/value_moves.c,v retrieving revision 1.127 diff -u -r1.127 value_moves.c --- engine/value_moves.c 5 May 2004 06:06:52 -0000 1.127 +++ engine/value_moves.c 25 May 2004 01:57:43 -0000 @@ -398,7 +398,7 @@ int y_max_dragon[MAX_WORMS]; int maximum_distance = 3; /* maximum Manhatan distance tried */ int dist; - int other= OTHER_COLOR(color); + int other = OTHER_COLOR(color); if (debug & DEBUG_LARGE_SCALE) gprintf("\nTrying to find large scale attack moves.\n"); @@ -416,9 +416,10 @@ if (debug & DEBUG_LARGE_SCALE) gprintf("Small critical dragon found at %1m\n", pos); - /* Find the physical extension of the dragon, and remember it */ - /* FIXME : probably there should be a better place to calculate - them, maybe a new field in the dragon2 array ? */ + /* Find the physical extension of the dragon, and remember it + * FIXME : probably there should be a better place to calculate + * them, maybe a new field in the dragon2 array ? + */ x = I(pos); y = J(pos); x_min_dragon[N] = x_max_dragon[N] = x; @@ -443,20 +444,21 @@ } /* For each unstable dragon, try to find large scale attacks. - We do this by first trying to find attacks at dist = 0, then - dist = 1, etc., up to maximum_distance */ + * We do this by first trying to find attacks at dist = 0, then + * dist = 1, etc., up to maximum_distance. + */ for (k = 0; k < N; k++) for (dist = 0; dist <= maximum_distance; dist++) for (x = x_min_dragon[k]-dist; x <= x_max_dragon[k]+dist; x++) for (y = y_min_dragon[k]-dist; y <= y_max_dragon[k]+dist; y++) { target = unstable_dragons[k]; - pos = POS(x,y); + pos = POS(x, y); - if (ON_BOARD2(x,y) && ON_BOARD1(pos) && (board[pos] == EMPTY)) { + if (ON_BOARD2(x, y) && ON_BOARD1(pos) && (board[pos] == EMPTY)) { int a, b; a = abs(x - x_min_dragon[k]); b = abs(x - x_max_dragon[k]); - dx = gg_min(a,b); + dx = gg_min(a, b); a = abs(y - y_min_dragon[k]); b = abs(y - y_max_dragon[k]); dy = gg_min(a, b); @@ -477,9 +479,10 @@ /* We try all large scale attacks on small dragons (and - only moves with other move reason) */ + * only moves with other move reason). + */ if (board[target] == other) - worth_trying = ((dragon[target].size <= 6) + worth_trying = (dragon[target].size <= 6 && has_move_reasons); if (worth_trying) { @@ -492,13 +495,14 @@ gprintf("Trying large scale move %1m on %1m\n", pos, target); /* To avoid horizon effects, we temporarily increase - * the depth values to find the large scale attacks. */ + * the depth values to find the large scale attacks. + */ increase_depth_values(); /* To reduce the amount of aji allowed for large scale * attacks, we reduce the owl limit to 350 nodes for * attacks at distance <= 1, and 150 nodes for attacks at - * distance >= 2 + * distance >= 2. */ if (dist <= 1) new_node_limit = gg_min(350, owl_node_limit); @@ -506,21 +510,22 @@ new_node_limit = gg_min(150, owl_node_limit); change_owl_node_limit(new_node_limit, &old_node_limit); - /* Try large scale killing moves on opponent's stones */ + /* Try large scale killing moves on opponent's stones. */ owl_nodes_before = get_owl_node_counter(); if (board[target] == other && !owl_attack_move_reason_known(pos, target)) { int kworm = NO_MOVE; int acode; int save_verbose = verbose; - if (verbose > 0) verbose--; + if (verbose > 0) + verbose--; acode = owl_does_attack(pos, target, &kworm); owl_nodes_used = get_owl_node_counter() - owl_nodes_before; - if ((acode >= DRAGON2(target).owl_attack_code) && - (acode == WIN)) { + if (acode >= DRAGON2(target).owl_attack_code + && acode == WIN) { add_owl_attack_move(pos, target, kworm, acode); if (debug & DEBUG_LARGE_SCALE) gprintf("Move at %1m owl-attacks %1m on a large scale(%r).\n", @@ -540,7 +545,6 @@ /* Restore the depth values */ decrease_depth_values(); - } } } @@ -1302,8 +1306,8 @@ static float connection_value(int dragona, int dragonb, int tt, float margin) { - struct dragon_data2* da = &DRAGON2(dragona); - struct dragon_data2* db = &DRAGON2(dragonb); + struct dragon_data2 *da = &DRAGON2(dragona); + struct dragon_data2 *db = &DRAGON2(dragonb); float sizea = dragon[dragona].effective_size; float sizeb = dragon[dragonb].effective_size; int safetya = da->safety; @@ -1672,7 +1676,7 @@ } /* - * Estimate the direct territorial value of a move at (pos). + * Estimate the direct territorial value of a move at (pos) by (color). */ static void estimate_territorial_value(int pos, int color, float our_score, @@ -2119,7 +2123,8 @@ && attack_move_reason_known(pos, aa) != WIN) { if (large_scale) this_value = (2.0 + 0.05 * (2 * worm[aa].effective_size)); - else this_value = 0.05 * (2 * worm[aa].effective_size); + else + this_value = 0.05 * (2 * worm[aa].effective_size); TRACE(" %1m: -%f - suspected ineffective owl attack of worm %1m\n", pos, this_value, aa); tot_value -= this_value; @@ -2253,7 +2258,8 @@ if (move[pos].move_safety == 1 && safe_move(pos, color) == WIN) { safe_stones[pos] = INFLUENCE_SAVED_STONE; strength[pos] = DEFAULT_STRENGTH; - if (0) TRACE(" %1m: is a safe move\n", pos); + if (0) + TRACE(" %1m: is a safe move\n", pos); } else { TRACE(" %1m: not a safe move\n", pos); @@ -3587,8 +3593,7 @@ /* * Choosing a strategy based on the current score estimate - * and the game status (between 0.0 (start) and 1.0 (game over)) - * + * and the game status (between 0.0 (start) and 1.0 (game over)). */ void @@ -3619,7 +3624,7 @@ invasion_malus_weight = 1.3; followup_weight = 1.1; TRACE(" %s is leading, using conservative settings.\n", - color == WHITE ? "White" : "Black"); + color == WHITE ? "White" : "Black"); } else if (game_status > 0.16) { Index: interface/gtp.c =================================================================== RCS file: /cvsroot/gnugo/gnugo/interface/gtp.c,v retrieving revision 1.18 diff -u -r1.18 gtp.c --- interface/gtp.c 24 Jan 2004 04:04:56 -0000 1.18 +++ interface/gtp.c 25 May 2004 01:57:43 -0000 @@ -86,9 +86,11 @@ if (!fgets(line, GTP_BUFSIZE, gtp_input)) break; /* EOF or some error */ - if (gtp_dump_commands) + if (gtp_dump_commands) { fputs(line, gtp_dump_commands); - + fflush(gtp_dump_commands); + } + /* Preprocess the line. */ for (i = 0, p = line; line[i]; i++) { char c = line[i]; Index: interface/main.c =================================================================== RCS file: /cvsroot/gnugo/gnugo/interface/main.c,v retrieving revision 1.99 diff -u -r1.99 main.c --- interface/main.c 25 May 2004 01:53:47 -0000 1.99 +++ interface/main.c 25 May 2004 01:57:43 -0000 @@ -61,7 +61,7 @@ static void show_debug_flags(void); /* long options which have no short form */ -enum {OPT_BOARDSIZE=127, +enum {OPT_BOARDSIZE = 127, OPT_HANDICAPSTONES, OPT_COLOR, OPT_KOMI, @@ -149,7 +149,7 @@ /* names of playing modes */ enum mode { - MODE_UNKNOWN=0, + MODE_UNKNOWN = 0, MODE_ASCII, MODE_ASCII_EMACS, MODE_GTP, @@ -428,7 +428,7 @@ outflags = gg_optarg; output_flags = 0; if (outflags) - while (*outflags){ + while (*outflags) { switch (*outflags) { case 'd': output_flags |= OUTPUT_MARKDRAGONS; @@ -1365,6 +1365,7 @@ } play_gtp(gtp_input_FILE, gtp_dump_commands_FILE, orientation); + fclose(gtp_dump_commands_FILE); break; case MODE_ASCII_EMACS: Index: interface/play_ascii.c =================================================================== RCS file: /cvsroot/gnugo/gnugo/interface/play_ascii.c,v retrieving revision 1.47 diff -u -r1.47 play_ascii.c --- interface/play_ascii.c 28 Apr 2004 16:37:44 -0000 1.47 +++ interface/play_ascii.c 25 May 2004 01:57:43 -0000 @@ -329,7 +329,7 @@ printf("\n"); } -enum commands {INVALID=-1, END, EXIT, QUIT, RESIGN, +enum commands {INVALID = -1, END, EXIT, QUIT, RESIGN, PASS, MOVE, FORCE, SWITCH, PLAY, PLAYBLACK, PLAYWHITE, SETHANDICAP, FREEHANDICAP, SETBOARDSIZE, SETKOMI, Index: interface/play_gtp.c =================================================================== RCS file: /cvsroot/gnugo/gnugo/interface/play_gtp.c,v retrieving revision 1.149 diff -u -r1.149 play_gtp.c --- interface/play_gtp.c 28 Apr 2004 16:37:44 -0000 1.149 +++ interface/play_gtp.c 25 May 2004 01:57:43 -0000 @@ -253,7 +253,7 @@ {"get_life_node_counter", gtp_get_life_node_counter}, {"get_owl_node_counter", gtp_get_owl_node_counter}, {"get_random_seed", gtp_get_random_seed}, - {"get_reading_node_counter",gtp_get_reading_node_counter}, + {"get_reading_node_counter", gtp_get_reading_node_counter}, {"get_trymove_counter", gtp_get_trymove_counter}, {"gg-undo", gtp_gg_undo}, {"gg_genmove", gtp_gg_genmove}, Index: interface/play_solo.c =================================================================== RCS file: /cvsroot/gnugo/gnugo/interface/play_solo.c,v retrieving revision 1.31 diff -u -r1.31 play_solo.c --- interface/play_solo.c 28 Apr 2004 16:37:44 -0000 1.31 +++ interface/play_solo.c 25 May 2004 01:57:43 -0000 @@ -293,7 +293,7 @@ * what's stored in the game record. * * FIXME: No comparison is made if the stored result was 0. Wins by - * time or forfeit or not handled either. + * time or forfeit are not handled either. * * FIXME: Does anybody actually care about this information? Just * removing this piece of code is a tempting alternative. Index: patterns/Makefile.am =================================================================== RCS file: /cvsroot/gnugo/gnugo/patterns/Makefile.am,v retrieving revision 1.24 diff -u -r1.24 Makefile.am --- patterns/Makefile.am 4 Nov 2003 21:59:44 -0000 1.24 +++ patterns/Makefile.am 25 May 2004 01:57:43 -0000 @@ -58,7 +58,7 @@ extract_fuseki_LDADD = ../engine/libengine.a libpatterns.a\ ../engine/libengine.a libpatterns.a\ ../sgf/libsgf.a ../utils/libutils.a -extract_fuseki_LDFLAGS = -I$(top_srcdir)/sgf +extract_fuseki_INCLUDES = -I$(top_srcdir)/sgf noinst_HEADERS = patterns.h eyes.h patlib.h dfa.h dfa-mkpat.h Index: patterns/barriers.db =================================================================== RCS file: /cvsroot/gnugo/gnugo/patterns/barriers.db,v retrieving revision 1.64 diff -u -r1.64 barriers.db --- patterns/barriers.db 12 Apr 2004 15:22:46 -0000 1.64 +++ patterns/barriers.db 25 May 2004 01:57:43 -0000 @@ -2207,12 +2207,15 @@ Pattern Intrusion60 #pp New pattern (3.5.1) +# gf FIXME: This pattern looks rather likely to introduce more +# problems than it solves. We may need to find some other +# solution to endgame:880. (3.5.7) OQ? this pattern should prevent attempts to cut bamboo joint X.! OO? -:-,B,value(20) +:8,B,value(20) Pattern Intrusion61 Index: patterns/dfa.c =================================================================== RCS file: /cvsroot/gnugo/gnugo/patterns/dfa.c,v retrieving revision 1.35 diff -u -r1.35 dfa.c --- patterns/dfa.c 24 Jan 2004 04:04:56 -0000 1.35 +++ patterns/dfa.c 25 May 2004 01:57:43 -0000 @@ -254,8 +254,8 @@ assert(pdfa->last_state <= pdfa->max_states); assert(pdfa->last_index <= pdfa->max_indexes); - pBuf = realloc(pdfa->states, max_states * sizeof(state_t)); - pBuf2 = realloc(pdfa->indexes, max_indexes * sizeof(attrib_t)); + pBuf = realloc(pdfa->states, max_states * sizeof(*pBuf)); + pBuf2 = realloc(pdfa->indexes, max_indexes * sizeof(*pBuf2)); if (pBuf == NULL || pBuf2 == NULL) { fprintf(stderr, "No memory left for dfa: %s", pdfa->name); exit(EXIT_FAILURE); @@ -599,7 +599,7 @@ assert(val > 0); assert(!get_from_entry_list(*pplist, l, r)); - new_entry = malloc(sizeof(entry_t)); + new_entry = malloc(sizeof(*new_entry)); if (new_entry == NULL) { fprintf(stderr, "No memory left for new entry\n"); exit(EXIT_FAILURE); @@ -836,11 +836,11 @@ int q2p; int i, j; - state_to = calloc(pdfa->last_state+1, sizeof(int)); - state_from = calloc(pdfa->last_state+1, sizeof(int)); + state_to = calloc(pdfa->last_state+1, sizeof(*state_to)); + state_from = calloc(pdfa->last_state+1, sizeof(*state_from)); - queue1 = malloc((pdfa->last_state+1) * sizeof(int)); - queue2 = malloc((pdfa->last_state+1) * sizeof(int)); + queue1 = malloc((pdfa->last_state+1) * sizeof(*queue1)); + queue2 = malloc((pdfa->last_state+1) * sizeof(*queue2)); q1p = 1; q2p = 0; queue1[0] = 1; /* i.e. start at state 1. */ @@ -867,7 +867,7 @@ q2p = 0; } - old_states = malloc((pdfa->last_state+1) * sizeof(struct state)); + old_states = malloc((pdfa->last_state+1) * sizeof(*old_states)); for (i = 1; i <= pdfa->last_state; i++) { for (j = 0; j < 4; j++) { old_states[i].next[j] = pdfa->states[i].next[j]; @@ -1179,7 +1179,7 @@ dfa_attrib *attribute; if (array->allocated == DFA_ATTRIB_BLOCK_SIZE) { - dfa_attrib_block *new_block = malloc(sizeof(dfa_attrib_block)); + dfa_attrib_block *new_block = malloc(sizeof(*new_block)); assert(new_block); new_block->previous = array->last_block; @@ -1243,7 +1243,7 @@ dfa_node *node; if (graph->allocated == DFA_NODE_BLOCK_SIZE) { - dfa_node_block *new_block = malloc(sizeof(dfa_node_block)); + dfa_node_block *new_block = malloc(sizeof(*new_block)); assert(new_block); new_block->previous = graph->last_block; @@ -1272,7 +1272,7 @@ dfa_hash_entry_new(void) { if (dfa_hash_allocated == DFA_HASH_BLOCK_SIZE) { - dfa_hash_block *new_block = malloc(sizeof(dfa_hash_block)); + dfa_hash_block *new_block = malloc(sizeof(*new_block)); assert(new_block); new_block->previous = dfa_hash_last_block; @@ -1668,7 +1668,7 @@ while (patterns->num_patterns <= index) { patterns->num_patterns++; - pattern = malloc(sizeof(dfa_pattern)); + pattern = malloc(sizeof(*pattern)); pattern->num_variations = 0; if (patterns->last_pattern) @@ -1735,7 +1735,7 @@ dfa_graph *graph = &(patterns->graph); dfa_pattern *pattern; - strings = malloc(patterns->num_patterns * sizeof(char *)); + strings = malloc(patterns->num_patterns * sizeof(*strings)); assert(strings); dfa_graph_clear(graph); @@ -1791,7 +1791,7 @@ double change_probability = 4.0 / patterns->num_patterns; dfa_pattern *pattern; - best_variations = malloc(patterns->num_patterns * sizeof(int)); + best_variations = malloc(patterns->num_patterns * sizeof(*best_variations)); assert(best_variations); for (pattern = patterns->patterns; pattern; pattern = pattern->next, k++) best_variations[k] = pattern->current_variation; Index: patterns/extract_fuseki.c =================================================================== RCS file: /cvsroot/gnugo/gnugo/patterns/extract_fuseki.c,v retrieving revision 1.22 diff -u -r1.22 extract_fuseki.c --- patterns/extract_fuseki.c 3 Mar 2004 22:14:12 -0000 1.22 +++ patterns/extract_fuseki.c 25 May 2004 01:57:43 -0000 @@ -565,7 +565,7 @@ move_number++; } else { /* something is wrong */ - fprintf(stderr, "Error in store_pattern_if_winner: %d\n",k); + fprintf(stderr, "Error in store_pattern_if_winner: %d\n", k); winning_moves[k].pattern[i][j] = '.'; } } @@ -641,7 +641,7 @@ if (k > 0) { /* something is wrong with the file */ if (0) - fprintf(stderr, "move number:%d\n",k); + fprintf(stderr, "move number:%d\n", k); return 0; } continue; @@ -1162,7 +1162,7 @@ number_of_games = read_sgf_filenames(argv[1], NULL); /* Allocate space for the list of unused files. */ - unused_games = calloc(number_of_games, sizeof(int)); + unused_games = calloc(number_of_games, sizeof(*unused_games)); if (unused_games == NULL) { fprintf(stderr, "Fatal error, failed to allocate memory.\n"); exit(EXIT_FAILURE); Index: patterns/helpers.c =================================================================== RCS file: /cvsroot/gnugo/gnugo/patterns/helpers.c,v retrieving revision 1.60 diff -u -r1.60 helpers.c --- patterns/helpers.c 12 Apr 2004 15:22:47 -0000 1.60 +++ patterns/helpers.c 25 May 2004 01:57:43 -0000 @@ -722,7 +722,6 @@ return 0; } - void backfill_replace(int move, int str) { Index: patterns/mkpat.c =================================================================== RCS file: /cvsroot/gnugo/gnugo/patterns/mkpat.c,v retrieving revision 1.133 diff -u -r1.133 mkpat.c --- patterns/mkpat.c 4 Mar 2004 00:06:26 -0000 1.133 +++ patterns/mkpat.c 25 May 2004 01:57:43 -0000 @@ -354,11 +354,11 @@ {"xplay_break_through", 3, 1, 5.00, "play_break_through_n(OTHER_COLOR(color), %d"}, {"oplay_break_through", 3, 1, 5.00, "play_break_through_n(color, %d"}, - {"oplay_connect", 2, 1,10.00, "play_connect_n(color, 1, %d"}, - {"xplay_connect", 2, 1,10.00, + {"oplay_connect", 2, 1, 10.00, "play_connect_n(color, 1, %d"}, + {"xplay_connect", 2, 1, 10.00, "play_connect_n(OTHER_COLOR(color), 1, %d"}, - {"oplay_disconnect", 2, 1,10.00, "play_connect_n(color, 0, %d"}, - {"xplay_disconnect", 2, 1,10.00, + {"oplay_disconnect", 2, 1, 10.00, "play_connect_n(color, 0, %d"}, + {"xplay_disconnect", 2, 1, 10.00, "play_connect_n(OTHER_COLOR(color), 0, %d"}, {"seki_helper", 1, 0, 0.0, "seki_helper(%s)"}, {"threaten_to_save", 1, 0, 0.0, "threaten_to_save_helper(move,%s)"}, @@ -432,7 +432,7 @@ {"surround_map", 2, 0, 0.01, "surround_map(%s, %s)"}, {"oracle_threatens", 2, 0, 0.01, "oracle_threatens(%s, %s)"}, {"value", 0, 2, 0.0, "(%s->value)"}, - {"adjacent_to_stone_in_atari",1, 0, 1.0, + {"adjacent_to_stone_in_atari", 1, 0, 1.0, "adjacent_to_stone_in_atari(%s)"}, {"adjacent_to_defendable_stone_in_atari", 1, 0, 1.0, "adjacent_to_defendable_stone_in_atari(%s)"}, @@ -501,9 +501,9 @@ struct hint_data { - char name[MAXNAME]; - int transformation_hint; - struct hint_data *next; + char name[MAXNAME]; + int transformation_hint; + struct hint_data *next; }; static struct hint_data *first_hint = NULL; @@ -516,7 +516,7 @@ while (!feof(file)) { int n; - struct hint_data *hint = malloc(sizeof(struct hint_data)); + struct hint_data *hint = malloc(sizeof(*hint)); n = fscanf(file, "%s %d", hint->name, &hint->transformation_hint); if (n == 2) { @@ -584,7 +584,7 @@ for (i = ino; i <= maxi+ino; i++) for (j = jwo; j <= maxj+jwo; j++) { if (0) - fprintf(stderr,"%2d %2d %c %c\n", i, j, constraint_diagram[i][j], + fprintf(stderr, "%2d %2d %c %c\n", i, j, constraint_diagram[i][j], diagram[i][j]); if (strchr(CHECK_CHARS, constraint_diagram[i][j]) && constraint_diagram[i][j] != diagram[i][j]) { @@ -648,7 +648,7 @@ /* apply edge constraints to the size of the pattern */ - if (where & (NORTH_EDGE|SOUTH_EDGE|EAST_EDGE|WEST_EDGE)) + if (where & (NORTH_EDGE | SOUTH_EDGE | EAST_EDGE | WEST_EDGE)) ++pats_with_constraints; if (verbose) @@ -1310,7 +1310,7 @@ switch (symmetry) { case '+' : - if (where & (NORTH_EDGE|EAST_EDGE|SOUTH_EDGE|WEST_EDGE)) + if (where & (NORTH_EDGE | EAST_EDGE | SOUTH_EDGE | WEST_EDGE)) fprintf(stderr, "%s(%d) : Warning : symmetry inconsistent with edge constraints (pattern %s)\n", current_file, current_line_number, pattern_names[patno]); @@ -1318,7 +1318,7 @@ break; case 'X' : - if (where & (NORTH_EDGE|EAST_EDGE|SOUTH_EDGE|WEST_EDGE)) + if (where & (NORTH_EDGE | EAST_EDGE | SOUTH_EDGE | WEST_EDGE)) fprintf(stderr, "%s(%d) : Warning : X symmetry inconsistent with edge constraints (pattern %s)\n", current_file, current_line_number, pattern_names[patno]); @@ -1330,7 +1330,7 @@ break; case '-' : - if (where & (NORTH_EDGE|SOUTH_EDGE)) + if (where & (NORTH_EDGE | SOUTH_EDGE)) fprintf(stderr, "%s(%d) : Warning : symmetry inconsistent with edge constraints (pattern %s)\n", current_file, current_line_number, pattern_names[patno]); @@ -1338,7 +1338,7 @@ break; case '|' : - if (where & (EAST_EDGE|WEST_EDGE)) + if (where & (EAST_EDGE | WEST_EDGE)) fprintf(stderr, "%s(%d) : Warning : symmetry inconsistent with edge constraints (pattern %s)\n", current_file, current_line_number, pattern_names[patno]); @@ -1359,7 +1359,7 @@ break; case 'O' : - if (where & (NORTH_EDGE|EAST_EDGE|SOUTH_EDGE|WEST_EDGE)) + if (where & (NORTH_EDGE | EAST_EDGE | SOUTH_EDGE | WEST_EDGE)) fprintf(stderr, "%s(%d) : Warning : symmetry inconsistent with edge constraints (pattern %s)\n", current_file, current_line_number, pattern_names[patno]); @@ -1920,7 +1920,7 @@ struct element_node *elist_prev; if (!tree_start->next_list) { - tree_start->next_list = malloc(sizeof(struct tree_node_list)); + tree_start->next_list = malloc(sizeof(*(tree_start->next_list))); tree_start->next_list->next = 0; } @@ -1949,7 +1949,7 @@ grptr = grptr->next) ; - grptr->next = malloc(sizeof(struct tree_node_list)); + grptr->next = malloc(sizeof(*(grptr->next))); grptr = grptr->next; grptr->node.matches = 0; grptr->node.att = elist->next->e.att; @@ -1963,7 +1963,7 @@ } grptr->node.x = elist->next->e.x; grptr->node.y = elist->next->e.y; - grptr->node.next_list= 0; + grptr->node.next_list = 0; grptr->next = 0; elist->next = elist->next->next; if (verbose) { @@ -1981,7 +1981,7 @@ matches = tree_start->matches; if (!matches) { - matches = malloc(sizeof(struct match_node)); + matches = malloc(sizeof(*matches)); matches->next = 0; tree_start->matches = matches; } @@ -1989,7 +1989,7 @@ while (matches->next != NULL) matches = matches->next; - matches->next = malloc(sizeof(struct match_node)); + matches->next = malloc(sizeof(*(matches->next))); matches = matches->next; matches->patnum = patno; matches->next = 0; @@ -2019,18 +2019,18 @@ } if (need_copy) { - struct element_node *elist_copy1 = malloc(sizeof(struct element_node)); - struct element_node *elist_copy2 = malloc(sizeof(struct element_node)); + struct element_node *elist_copy1 = malloc(sizeof(*elist_copy1)); + struct element_node *elist_copy2 = malloc(sizeof(*elist_copy2)); struct element_node *elist1_next = elist_copy1; struct element_node *elist2_next = elist_copy2; int found_copy_element = 0; elist_next = elist->next; while (elist_next) { - elist1_next->next = malloc(sizeof(struct element_node)); + elist1_next->next = malloc(sizeof(*(elist1_next->next))); elist1_next = elist1_next->next; elist1_next->e = elist_next->e; - elist2_next->next = malloc(sizeof(struct element_node)); + elist2_next->next = malloc(sizeof(*(elist2_next->next))); elist2_next = elist2_next->next; elist2_next->e = elist_next->e; if (!found_copy_element) { @@ -2085,10 +2085,10 @@ struct element_node *elist_next = 0; int i; - elist = malloc(sizeof(struct element_node)); + elist = malloc(sizeof(*elist)); elist_next = elist; for (i = 0; i < el; i++) { - elist_next->next = malloc(sizeof(struct element_node)); /*or die*/ + elist_next->next = malloc(sizeof(*(elist_next->next))); /*or die*/ elist_next = elist_next->next; elist_next->e.att = elements[i].att; /* or continue if we don't need this transformation */ @@ -2144,7 +2144,7 @@ int i; for (i = 0; i < el; i++) { fprintf(stderr, "E[%d, %d, %c]\n", - elements[i].x - ci, elements[i].y -cj, + elements[i].x - ci, elements[i].y - cj, *(VALID_PATTERN_CHARS + elements[i].att)); } fprintf(stderr, "\n"); @@ -2293,8 +2293,8 @@ oanchor_index = tnl_count+1; dump_tree_node(outfile, &graph[1], 0, PASS_COUNT); - tnl_dump = malloc(sizeof(struct tree_node_list) * tnl_count); - matches_dump = malloc(sizeof(struct match_node) * mn_count); + tnl_dump = malloc(sizeof(*tnl_dump) * tnl_count); + matches_dump = malloc(sizeof(*matches_dump) * mn_count); tnl_dump[0].next = (void *) 1; /* X anchor node */ tnl_dump[0].node.att = -1; /* Not used */ @@ -2469,12 +2469,12 @@ /* Dynamically allocates a new variation structure. */ -static struct corner_variation_b* +static struct corner_variation_b * corner_variation_new(int move_offset, char xor_att, char num_stones) { struct corner_variation_b *variation; - variation = malloc(sizeof(struct corner_variation_b)); + variation = malloc(sizeof(*variation)); variation->move_offset = move_offset; variation->xor_att = xor_att; @@ -2494,7 +2494,7 @@ /* Follow a variation. If such a variation already exists, returns * a pointer to it. Otherwise, creates and initializes a new one. */ -static struct corner_variation_b* +static struct corner_variation_b * corner_follow_variation(struct corner_variation_b *variation, int offset, int color, char num_stones) { @@ -2741,7 +2741,7 @@ fprintf(outfile, ",\n"); } - fprintf(outfile,"\n#endif\n};\n\n"); + fprintf(outfile, "\n#endif\n};\n\n"); } @@ -2829,10 +2829,10 @@ int ll; for (ll = 0; ll < 8; ++ll) - fprintf(outfile, " 0x%08x%s", p->and_mask[ll], ll<7 ? "," : ""); + fprintf(outfile, " 0x%08x%s", p->and_mask[ll], ll < 7 ? "," : ""); fprintf(outfile, "},\n {"); for (ll = 0; ll < 8; ++ll) - fprintf(outfile, " 0x%08x%s", p->val_mask[ll], ll<7 ? "," : ""); + fprintf(outfile, " 0x%08x%s", p->val_mask[ll], ll < 7 ? "," : ""); } fprintf(outfile, "}\n "); #endif Index: patterns/owl_attackpats.db =================================================================== RCS file: /cvsroot/gnugo/gnugo/patterns/owl_attackpats.db,v retrieving revision 1.111 diff -u -r1.111 owl_attackpats.db --- patterns/owl_attackpats.db 25 May 2004 01:40:58 -0000 1.111 +++ patterns/owl_attackpats.db 25 May 2004 01:57:43 -0000 @@ -1218,7 +1218,6 @@ # gf New pattern. (3.5.3). # See e.g. nngs:1090. - ...o? ..*O? ...Xx @@ -2607,7 +2606,7 @@ Pattern A622 -# gf New patterm. (3.5.3) +# gf New pattern. (3.5.3) # Compare D704b. See nngs3:450. xX.O half eye sometimes missed @@ -4583,7 +4582,7 @@ ?AY b*e -cd. +cdx ;(owl_escape_value(d) > 0 ; || owl_escape_value(b) > 0 @@ -4831,7 +4830,7 @@ :8,-,value(40) -BOY +XOY .*a --- @@ -4848,7 +4847,7 @@ :8,-,value(40) -YOB +YOX .*a --- Index: patterns/owl_defendpats.db =================================================================== RCS file: /cvsroot/gnugo/gnugo/patterns/owl_defendpats.db,v retrieving revision 1.118 diff -u -r1.118 owl_defendpats.db --- patterns/owl_defendpats.db 3 May 2004 03:33:06 -0000 1.118 +++ patterns/owl_defendpats.db 25 May 2004 01:57:44 -0000 @@ -1134,7 +1134,6 @@ # gf New pattern. (3.5.3). # See e.g. nngs:1090. - ...x? ..*X? ...Oo @@ -3791,7 +3790,7 @@ :8,-,value(45) -Pattern D841 +Pattern D842 # gf New pattern. (3.5.5) ???X.| @@ -3804,7 +3803,7 @@ :8,-,value(76) -Pattern D842 +Pattern D843 # pp New pattern (3.5.5) |OOOOO workaround lunch problem (the eye is not considered a unit) @@ -4996,7 +4995,7 @@ ?C? *AX -?DB +?XB ; does_defend(*,A) && !oplay_attack(*,B) ; && !same_string(B,C) && vital_chain(B) && vital_chain(C) @@ -5007,7 +5006,6 @@ # gf New pattern. (3.5.3). # See e.g. nngs:1090. - .*XO XOXO ..Oo @@ -5050,7 +5048,7 @@ :8,-,value(40) -bXc +OXO .*A --- @@ -6982,6 +6980,7 @@ o*bc. ABa.? ?x.?? +----- ; owl_escape_value(d) > 0 ; && oplay_attack_either(*,a,b,c,d,B,c) && oplay_connect(*,a,b,c,d,?,A,C) @@ -7488,10 +7487,10 @@ .... OOOo -:8,c, threatens_eye(b), value(30) +:8,c, threatens_eye(a), value(30) ?O*? -.b.. +.a.. OOOo Index: patterns/patlib.c =================================================================== RCS file: /cvsroot/gnugo/gnugo/patterns/patlib.c,v retrieving revision 1.9 diff -u -r1.9 patlib.c --- patterns/patlib.c 24 Jan 2004 04:04:57 -0000 1.9 +++ patterns/patlib.c 25 May 2004 01:57:44 -0000 @@ -100,7 +100,7 @@ static void textpattern_ns_edge_print(FILE *outfile, Textpattern *tp) { - int i; + int i; if (tp->edge_constraints & WEST_EDGE) fputc('+', outfile); @@ -271,7 +271,7 @@ parse_whitespace(int to_end_of_line_only) { char *p = whitespacebuffer; - int is_comment; + int is_comment; if (!isspace(next_char) && next_char != '#') @@ -333,7 +333,7 @@ static int parse_int(void) { - int val = 0; + int val = 0; if (!isdigit(next_char)) return 0; @@ -425,7 +425,7 @@ static int parse_north_south_constraint(Textpattern *tp) { - int width; + int width; width = 0; while (next_char == '-') { @@ -438,7 +438,7 @@ return 0; } - if (tp->width >0) { + if (tp->width > 0) { /* This has to be the south border */ if (width != tp->width || (next_char == '+' && (tp->edge_constraints & EAST_EDGE) == 0)) { @@ -465,7 +465,7 @@ static int parse_pattern_diagram(Textpattern *tp) { - int width; + int width; /* See if there is a north border constraint. */ if (next_char == '+' || next_char == '-') { @@ -536,9 +536,9 @@ { /* FIXME: Only one row of explanation possible */ /* FIXME: Check boundaries */ - char buf[1024]; + char buf[1024]; char *p = buf; - int only_spaces = 1; + int only_spaces = 1; while (next_char != EOF && next_char != '\n') { *p++ = next_char; @@ -613,7 +613,7 @@ static int parse_constraint_diagram(Textpattern *tp) { - int width; + int width; /* Constraint diagram is optional. */ if (!strchr(VALID_PATTERN_CHARS, next_char) @@ -848,10 +848,10 @@ char *p1, *p2; int mini, minj; int maxi, maxj; - int r; - int newedge; - int i=0, j=0; - int i1, j1; + int r; + int newedge; + int i = 0, j = 0; + int i1, j1; assert(0 <= transform && transform < 8); @@ -862,8 +862,8 @@ size++; size2 = size*2; - array1 = (char *) malloc(size2 * size2); - array2 = (char *) malloc(size2 * size2); + array1 = malloc(size2 * size2); + array2 = malloc(size2 * size2); assert(array1 != NULL && array2 != NULL); Index: patterns/patterns.db =================================================================== RCS file: /cvsroot/gnugo/gnugo/patterns/patterns.db,v retrieving revision 1.125 diff -u -r1.125 patterns.db --- patterns/patterns.db 3 Mar 2004 22:14:12 -0000 1.125 +++ patterns/patterns.db 25 May 2004 01:57:44 -0000 @@ -10978,7 +10978,7 @@ > replace(a,*) -Pattern ED96 +Pattern ED97 # gf New pattern. (3.5.3) # See gifu03:401 @@ -11001,7 +11001,7 @@ ;weak(a) && weak(B) && x_somewhere(c,d) -Pattern ED97 +Pattern ED98 # evand new Pattern (3.5.4) ..... @@ -12116,7 +12116,7 @@ Pattern EJ20 - + ?x.XOOo Connect underneath. oOXOX.o o.*O..o @@ -14784,7 +14784,7 @@ Pattern RE14 -# gf New pattern. (3.3.20) +# gf New pattern. (3.3.22) # See filllib:35. +--- Index: patterns/patterns.h =================================================================== RCS file: /cvsroot/gnugo/gnugo/patterns/patterns.h,v retrieving revision 1.63 diff -u -r1.63 patterns.h --- patterns/patterns.h 4 Mar 2004 00:06:26 -0000 1.63 +++ patterns/patterns.h 25 May 2004 01:57:45 -0000 @@ -26,13 +26,13 @@ * describing the patterns. */ +#ifndef _PATTERN_H_ +#define _PATTERN_H_ + #ifdef HAVE_CONFIG_H #include #endif -#ifndef __PATTERN_H__ -#define __PATTERN_H__ - /* local versions of absolute value, min and max */ #define gg_abs(x) ((x) < 0 ? -(x) : (x)) @@ -459,7 +459,7 @@ }; -#endif /* __PATTERN_H__ */ +#endif /* _PATTERN_H_ */ /* Index: patterns/patterns2.db =================================================================== RCS file: /cvsroot/gnugo/gnugo/patterns/patterns2.db,v retrieving revision 1.71 diff -u -r1.71 patterns2.db --- patterns/patterns2.db 3 Mar 2004 22:14:12 -0000 1.71 +++ patterns/patterns2.db 25 May 2004 01:57:45 -0000 @@ -2748,7 +2748,7 @@ :8,sX,shape(-1) .aXx -.Cb. +.Xb. .*.. ;!dead(a) && !dead(b) && weak(a) && weak(b) && oplay_disconnect(*,a,b) Index: patterns/transpat.c =================================================================== RCS file: /cvsroot/gnugo/gnugo/patterns/transpat.c,v retrieving revision 1.9 diff -u -r1.9 transpat.c --- patterns/transpat.c 25 Jan 2004 21:35:38 -0000 1.9 +++ patterns/transpat.c 25 May 2004 01:57:45 -0000 @@ -63,7 +63,7 @@ static void flippat(Textpattern *tp); -static int match_name(Textpattern *tp, char *patnames); +static int match_name(Textpattern *tp, char *patnames); /* @@ -78,7 +78,7 @@ static void flippat(Textpattern *tp) { - int transno; + int transno; switch (tp->edge_constraints) { case 0: return; /* Nothing to do here */ @@ -130,7 +130,7 @@ Textpattern tp; int val; char *patnames; - int command = 0; + int command = 0; if (argc < 2 || argc > 4) { printf("usage: %s command patnames [patfilename]\n\ @@ -151,7 +151,7 @@ patnames = argv[2]; /* Try to open infile. */ - if (argc == 4){ + if (argc == 4) { if ((infile = fopen(argv[3], "r")) == 0) { perror(argv[3]); exit(1); Index: sgf/sgftree.c =================================================================== RCS file: /cvsroot/gnugo/gnugo/sgf/sgftree.c,v retrieving revision 1.16 diff -u -r1.16 sgftree.c --- sgf/sgftree.c 24 Jan 2004 04:04:57 -0000 1.16 +++ sgf/sgftree.c 25 May 2004 01:57:45 -0000 @@ -63,7 +63,8 @@ return 0; } else - while (sgftreeForward(tree)); + while (sgftreeForward(tree)) + ; return 1; } Index: sgf/sgftree.h =================================================================== RCS file: /cvsroot/gnugo/gnugo/sgf/sgftree.h,v retrieving revision 1.19 diff -u -r1.19 sgftree.h --- sgf/sgftree.h 24 Jan 2004 04:04:57 -0000 1.19 +++ sgf/sgftree.h 25 May 2004 01:57:45 -0000 @@ -20,8 +20,8 @@ * Boston, MA 02111, USA. * \* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef _SGFTREE_H -#define _SGFTREE_H 1 +#ifndef _SGFTREE_H_ +#define _SGFTREE_H_ #include Index: utils/gg_utils.c =================================================================== RCS file: /cvsroot/gnugo/gnugo/utils/gg_utils.c,v retrieving revision 1.34 diff -u -r1.34 gg_utils.c --- utils/gg_utils.c 24 Jan 2004 04:04:57 -0000 1.34 +++ utils/gg_utils.c 25 May 2004 01:57:45 -0000 @@ -74,7 +74,7 @@ /* terminfo attributes */ static char *setaf; /* terminfo string to set color */ -static int max_color; /* terminfo max colour */ +static int max_color; /* terminfo max colour */ static int init = 0; @@ -411,7 +411,7 @@ return f->values[f->sections]; else { ratio = ((float) f->sections) * (x - f->range_lowerbound) - /(f->range_upperbound - f->range_lowerbound); + / (f->range_upperbound - f->range_lowerbound); i = (int) ratio; diff = ratio - ((float) i); if (0) Index: utils/random.c =================================================================== RCS file: /cvsroot/gnugo/gnugo/utils/random.c,v retrieving revision 1.9 diff -u -r1.9 random.c --- utils/random.c 24 Jan 2004 04:04:57 -0000 1.9 +++ utils/random.c 25 May 2004 01:57:45 -0000 @@ -72,10 +72,10 @@ iterate_tgfsr(void) { int i; - for (i=0; i> 1) ^ ((x[i] & 1) ? a : 0); - for (; i> 1) ^ ((x[i] & 1) ? a : 0); + for (i = 0; i < N - m; i++) + x[i] = x[i + m] ^ (x[i] >> 1) ^ ((x[i] & 1) ? a : 0); + for (; i < N; i++) + x[i] = x[i + m - N] ^ (x[i] >> 1) ^ ((x[i] & 1) ? a : 0); }