[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnugo-devel] bugfix patch
From: |
Gunnar Farneback |
Subject: |
[gnugo-devel] bugfix patch |
Date: |
Sun, 02 Dec 2001 22:45:21 +0100 |
User-agent: |
EMH/1.14.1 SEMI/1.14.3 (Ushinoya) FLIM/1.14.2 (Yagi-Nishiguchi) APEL/10.3 Emacs/20.7 (sparc-sun-solaris2.7) (with unibyte mode) |
This patch fixes a bug in trymove() which could cause a segmentation
fault under certain circumstances. The patch also contains some 1D
revisions and cleanups.
- bugfix in trymove()
- 1D revisions and cleaning up
/Gunnar
Index: engine/aftermath.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/aftermath.c,v
retrieving revision 1.14
diff -u -r1.14 aftermath.c
--- engine/aftermath.c 2001/11/25 11:23:40 1.14
+++ engine/aftermath.c 2001/12/02 21:38:35
@@ -339,7 +339,7 @@
score -= 3;
if (0)
- gprintf("Score %m = %d\n", m, n, score);
+ gprintf("Score %1m = %d\n", pos, score);
if (move_ok && score > best_score) {
best_score = score;
Index: engine/board.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/board.c,v
retrieving revision 1.20
diff -u -r1.20 board.c
--- engine/board.c 2001/11/17 00:17:44 1.20
+++ engine/board.c 2001/12/02 21:38:36
@@ -375,6 +375,9 @@
/* Do the real work elsewhere. */
if (!do_trymove(pos, color, 0))
return 0;
+
+ if (message == NULL)
+ message = "UNKNOWN";
/* Store the move in an sgf tree if one is available. */
if (sgf_dumptree) {
@@ -433,8 +436,8 @@
if (sgf_dumptree) {
char buf[100];
- if (!message)
- message = "???";
+ if (message == NULL)
+ message = "UNKNOWN";
if (komaster != EMPTY)
gg_snprintf(buf, 100, "tryko: %s (variation %d, %lx, komaster %s:%s)",
message, count_variations, hashdata.hashval,
Index: engine/dragon.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/dragon.c,v
retrieving revision 1.32
diff -u -r1.32 dragon.c
--- engine/dragon.c 2001/11/30 14:16:54 1.32
+++ engine/dragon.c 2001/12/02 21:38:37
@@ -105,16 +105,16 @@
"Initialising dragon from worm at %1m, size %d\n",
ii, worm[ii].size);
}
- time_report(2, " time to initialize dragons", -1, -1, 1.0);
+ time_report(2, " time to initialize dragons", NO_MOVE, 1.0);
make_domains(black_eye, white_eye, 0);
- time_report(2, " time to make domains", -1, -1, 1.0);
+ time_report(2, " time to make domains", NO_MOVE, 1.0);
/* Find explicit connections patterns in database and amalgamate
* involved dragons.
*/
find_connections();
- time_report(2, " time to find connections", -1, -1, 1.0);
+ time_report(2, " time to find connections", NO_MOVE, 1.0);
/* Amalgamate dragons sharing an eyespace (not ko). At the same time
* we decide to which dragon an eyespace belongs. Ko eyespaces
@@ -153,14 +153,14 @@
}
}
}
- time_report(2, " time to amalgamate dragons", -1, -1, 1.0);
+ time_report(2, " time to amalgamate dragons", NO_MOVE, 1.0);
/* At this time, all dragons have been finalized and we can
* initialize the dragon2[] array. After that we can no longer allow
* amalgamation of dragons.
*/
initialize_supplementary_dragon_data();
- time_report(2, " time to initialize dragon2", -1, -1, 1.0);
+ time_report(2, " time to initialize dragon2", NO_MOVE, 1.0);
/* Find adjacent worms which can be easily captured: */
for (m = 0; m < board_size; m++)
@@ -204,7 +204,7 @@
}
}
}
- time_report(2, " time to find lunches", -1, -1, 1.0);
+ time_report(2, " time to find lunches", NO_MOVE, 1.0);
/* In case origins of dragons got moved, put the dragons of eyes aright. */
for (i = 0; i < board_size; i++)
@@ -221,7 +221,7 @@
white_eye[ii].dragon = dr;
}
}
- time_report(2, " time to fix origins", -1, -1, 1.0);
+ time_report(2, " time to fix origins", NO_MOVE, 1.0);
/* Find topological half eyes and false eyes by analyzing the
* diagonal intersections, as described in the Texinfo
@@ -311,7 +311,7 @@
propagate_eye(ii, white_eye);
}
}
- time_report(2, " time to find eyes", -1, -1, 1.0);
+ time_report(2, " time to find eyes", NO_MOVE, 1.0);
/* Now we compute the genus. */
for (i = 0; i < board_size; i++)
@@ -348,7 +348,7 @@
}
}
}
- time_report(2, " time to compute genus", -1, -1, 1.0);
+ time_report(2, " time to compute genus", NO_MOVE, 1.0);
/* Compute the escape route measure. */
for (m = 0; m < board_size; m++)
@@ -360,7 +360,7 @@
DRAGON2(ii).escape_route = compute_escape(ii, 0);
}
}
- time_report(2, " time to compute escape", -1, -1, 1.0);
+ time_report(2, " time to compute escape", NO_MOVE, 1.0);
/* Update the segmentation of the initial influence before we
* compute the surrounding moyo sizes. The reason for this is that
@@ -368,14 +368,14 @@
* into account.
*/
resegment_initial_influence();
- time_report(2, " resegment_initial_influence", -1, -1, 1.0);
+ time_report(2, " resegment_initial_influence", NO_MOVE, 1.0);
/* Compute the surrounding moyo sizes. */
for (d = 0; d < number_of_dragons; d++) {
dragon2[d].moyo = influence_get_moyo_size(dragon2[d].origin,
DRAGON(d).color);
}
- time_report(2, " influence_get_moyo_size", -1, -1, 1.0);
+ time_report(2, " influence_get_moyo_size", NO_MOVE, 1.0);
/* Determine status: ALIVE, DEAD, CRITICAL or UNKNOWN */
for (m = 0; m < board_size; m++)
@@ -387,7 +387,7 @@
sgffile_dragon_status(I(ii), J(ii), dragon[ii].status);
}
}
- time_report(2, " compute_dragon_status", -1, -1, 1.0);
+ time_report(2, " compute_dragon_status", NO_MOVE, 1.0);
/* We must update the dragon status at every intersection before we
* call the owl code. This updates all fields.
@@ -401,7 +401,7 @@
}
find_neighbor_dragons();
- time_report(2, " find_neighbor_dragons", -1, -1, 1.0);
+ time_report(2, " find_neighbor_dragons", NO_MOVE, 1.0);
if (stop_before_owl)
return;
@@ -512,10 +512,10 @@
dragon[ii].owl_threat_status = ALIVE;
}
}
- time_report(3, " owl reading for dragon at ", m, n, 1.0);
+ time_report(3, " owl reading for dragon at ", ii, 1.0);
}
}
- time_report(2, " owl reading", -1, -1, 1.0);
+ time_report(2, " owl reading", NO_MOVE, 1.0);
/* The dragon data is now correct at the origin of each dragon but
* we need to copy it to every vertex.
@@ -551,7 +551,7 @@
dragon[ii].matcher_status = dragon[ii].status;
}
}
- time_report(2, " compute matcher status", -1, -1, 1.0);
+ time_report(2, " compute matcher status", NO_MOVE, 1.0);
/* Compute the safety value. */
for (d = 0; d < number_of_dragons; d++) {
@@ -597,11 +597,11 @@
else
dragon2[d].safety = ALIVE;
}
- time_report(2, " compute dragon safety", -1, -1, 1.0);
+ time_report(2, " compute dragon safety", NO_MOVE, 1.0);
/* Resolve semeais. This may revise the safety and status fields. */
semeai(color);
- time_report(2, " semeai module", -1, -1, 1.0);
+ time_report(2, " semeai module", NO_MOVE, 1.0);
/* The matcher_status is now correct at the origin of each dragon
* but we need to copy it to every vertex.
@@ -643,7 +643,7 @@
}
}
}
- time_report(2, " revise inessentiality", -1, -1, 1.0);
+ time_report(2, " revise inessentiality", NO_MOVE, 1.0);
/* Count the non-dead dragons. */
lively_white_dragons = 0;
@@ -1611,24 +1611,24 @@
void
report_dragon(int m, int n)
{
+ int pos = POS(m, n);
int i, j;
int ii;
int k;
- struct dragon_data *d = &(dragon[POS(m, n)]);
+ struct dragon_data *d = &(dragon[pos]);
struct dragon_data2 *d2 = &(dragon2[d->id]);
- if (BOARD(m, n) == EMPTY) {
- gprintf("There is no dragon at %m\n", m, n);
+ if (board[pos] == EMPTY) {
+ gprintf("There is no dragon at %1m\n", pos);
return;
}
if (d->id < 0) {
- gprintf("Dragon data not available at %m\n", m, n);
+ gprintf("Dragon data not available at %1m\n", pos);
return;
}
-
- gprintf("*** dragon at %m:\n", m, n);
+ gprintf("*** dragon at %1m:\n", pos);
gprintf("color: %s; origin: %1m; size: %d; effective size: %f\n",
(d->color == WHITE) ? "WHITE" : "BLACK",
d->origin, d->size, d->effective_size);
@@ -1639,8 +1639,8 @@
ii = POS(i, j);
if (worm[ii].origin == ii
- && is_same_dragon(ii, POS(m, n)))
- gprintf(" %m", i, j);
+ && is_same_dragon(ii, pos))
+ gprintf(" %1m", ii);
}
gprintf("\nhalf eyes: %d, ", d2->heyes);
Index: engine/fuseki.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/fuseki.c,v
retrieving revision 1.10
diff -u -r1.10 fuseki.c
--- engine/fuseki.c 2001/11/22 15:37:47 1.10
+++ engine/fuseki.c 2001/12/02 21:38:37
@@ -175,37 +175,35 @@
static void
-announce_move(int i, int j, int val)
+announce_move(int move, int val)
{
/* This shouldn't happen. */
- if (BOARD(i, j))
+ if (board[move] != EMPTY)
return;
- TRACE("Fuseki Player suggests %m with value %d\n", i, j, val);
- set_minimum_move_value(POS(i, j), val);
+ TRACE("Fuseki Player suggests %1m with value %d\n", move, val);
+ set_minimum_move_value(move, val);
}
/* Storage for values collected during pattern matching. */
-static int fuseki_movei[MAX_BOARD * MAX_BOARD];
-static int fuseki_movej[MAX_BOARD * MAX_BOARD];
+static int fuseki_moves[MAX_BOARD * MAX_BOARD];
static int fuseki_value[MAX_BOARD * MAX_BOARD];
-static int fuseki_moves;
+static int num_fuseki_moves;
static int fuseki_total_value;
/* Callback for fuseki database pattern matching. */
static void
fuseki_callback(int ti, int tj, struct fullboard_pattern *pattern, int ll)
{
- TRACE("Fuseki database move at %m with relative weight %d, pattern %s+%d\n",
- ti, tj, (int) pattern->value, pattern->name, ll);
+ TRACE("Fuseki database move at %1m with relative weight %d, pattern %s+%d\n",
+ POS(ti, tj), (int) pattern->value, pattern->name, ll);
/* Store coordinates and relative weight for the found move. */
- fuseki_movei[fuseki_moves] = ti;
- fuseki_movej[fuseki_moves] = tj;
- fuseki_value[fuseki_moves] = pattern->value;
+ fuseki_moves[num_fuseki_moves] = POS(ti, tj);
+ fuseki_value[num_fuseki_moves] = pattern->value;
fuseki_total_value += pattern->value;
- fuseki_moves++;
+ num_fuseki_moves++;
}
/* Full board matching in database for fuseki moves. Return 1 if any
@@ -236,19 +234,19 @@
return 0;
/* Do the matching. */
- fuseki_moves = 0;
+ num_fuseki_moves = 0;
fuseki_total_value = 0;
fullboard_matchpat(fuseki_callback, color, database);
/* No match. */
- if (fuseki_moves == 0)
+ if (num_fuseki_moves == 0)
return 0;
/* Choose randomly with respect to relative weights for matched moves. */
/* do not choose moves with less value than 20% of the best move */
best_fuseki_value = fuseki_value[0];
q = gg_rand() % fuseki_total_value;
- for (k = 0; k < fuseki_moves; k++) {
+ for (k = 0; k < num_fuseki_moves; k++) {
if (fuseki_value[k] < (best_fuseki_value / 5))
break;
q -= fuseki_value[k];
@@ -256,18 +254,18 @@
break;
}
- gg_assert(k < fuseki_moves);
+ gg_assert(k < num_fuseki_moves);
/* Give this move an arbitrary value of 75. The actual value doesn't
* matter much since the intention is that we should play this move
* whatever the rest of the analysis thinks.
*/
- announce_move(fuseki_movei[k], fuseki_movej[k], 75);
+ announce_move(fuseki_moves[k], 75);
/* Also make sure the other considered moves can be seen in the
* traces and in the output file.
*/
- for (k = 0; k < fuseki_moves; k++)
- set_minimum_move_value(POS(fuseki_movei[k], fuseki_movej[k]), 74);
+ for (k = 0; k < num_fuseki_moves; k++)
+ set_minimum_move_value(fuseki_moves[k], 74);
return 1;
}
@@ -299,7 +297,7 @@
/* For boards of size 11x11 or smaller we first go for the center point. */
int middle = board_size/2;
if (openregion(middle-2, middle+2, middle-2, middle+2)) {
- announce_move(middle, middle, 45);
+ announce_move(POS(middle, middle), 45);
}
}
@@ -315,22 +313,22 @@
if (openregion(0, width-1, board_size-width, board_size-1)) {
choose_corner_move(UPPER_RIGHT, &i, &j);
- announce_move(i, j, empty_corner_value);
+ announce_move(POS(i, j), empty_corner_value);
}
if (openregion(board_size-width, board_size-1, 0, width-1)) {
choose_corner_move(LOWER_LEFT, &i, &j);
- announce_move(i, j, empty_corner_value);
+ announce_move(POS(i, j), empty_corner_value);
}
if (openregion(board_size-width, board_size-1,
board_size-width, board_size-1)) {
choose_corner_move(LOWER_RIGHT, &i, &j);
- announce_move(i, j, empty_corner_value);
+ announce_move(POS(i, j), empty_corner_value);
}
if (openregion(0, width-1, 0, width-1)) {
choose_corner_move(UPPER_LEFT, &i, &j);
- announce_move(i, j, empty_corner_value);
+ announce_move(POS(i, j), empty_corner_value);
}
}
Index: engine/genmove.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/genmove.c,v
retrieving revision 1.19
diff -u -r1.19 genmove.c
--- engine/genmove.c 2001/11/25 11:23:40 1.19
+++ engine/genmove.c 2001/12/02 21:38:38
@@ -38,8 +38,7 @@
static int do_genmove(int *move, int color, float pure_threat_value);
static double slowest_time = 0.;
-static int slowest_i = -1;
-static int slowest_j = -1;
+static int slowest_move = NO_MOVE;
static int slowest_movenum = 0;
static double total_time = 0.;
@@ -107,7 +106,7 @@
if (NEEDS_UPDATE(worms_examined)) {
start_timer(0);
make_worms();
- time_report(0, " make worms", -1, -1, 1.0);
+ time_report(0, " make worms", NO_MOVE, 1.0);
}
if (how_much == EXAMINE_WORMS) {
verbose = save_verbose;
@@ -317,7 +316,7 @@
/* Find out information about the worms and dragons. */
start_timer(1);
examine_position(color, EXAMINE_ALL);
- time_report(1, "examine position", -1, -1, 1.0);
+ time_report(1, "examine position", NO_MOVE, 1.0);
/* Make a score estimate. This can be used in later stages of the
* move generation. If we are ahead, we can play safely and if
@@ -334,7 +333,7 @@
lower_bound > 0 ? "W " : "B ", gg_abs(lower_bound),
upper_bound > 0 ? "W " : "B ", gg_abs(upper_bound));
}
- time_report(1, "estimate score", -1, -1, 1.0);
+ time_report(1, "estimate score", NO_MOVE, 1.0);
/* The score will be used to determine when we are safely
* ahead. So we want the most conservative score.
@@ -388,12 +387,12 @@
/* The general pattern database. */
start_timer(1);
shapes(color);
- time_report(1, "shapes", -1, -1, 1.0);
+ time_report(1, "shapes", NO_MOVE, 1.0);
gg_assert(stackp == 0);
/* Look for combination attacks and defenses against them. */
combinations(color);
- time_report(1, "combinations", -1, -1, 1.0);
+ time_report(1, "combinations", NO_MOVE, 1.0);
gg_assert(stackp == 0);
/* Review the move reasons and estimate move values. */
@@ -401,7 +400,7 @@
pure_threat_value, lower_bound))
TRACE("Move generation likes %1m with value %f\n", *move, val);
gg_assert(stackp == 0);
- time_report(1, "review move reasons", -1, -1, 1.0);
+ time_report(1, "review move reasons", NO_MOVE, 1.0);
/* If the move value is 6 or lower, we look for endgame patterns too. */
if (val <= 6.0 && !disable_endgame_patterns) {
@@ -410,7 +409,7 @@
if (review_move_reasons(move, &val, color, pure_threat_value, score))
TRACE("Move generation likes %1m with value %f\n", *move, val);
gg_assert(stackp == 0);
- time_report(1, "endgame", -1, -1, 1.0);
+ time_report(1, "endgame", NO_MOVE, 1.0);
}
/* If no move found yet, revisit any semeai and change the
@@ -426,7 +425,7 @@
*move, val);
}
}
- time_report(1, "move reasons with revised semeai status", -1, -1, 1.0);
+ time_report(1, "move reasons with revised semeai status", NO_MOVE, 1.0);
}
/* If still no move, fill a remaining liberty. This should pick up
@@ -436,8 +435,8 @@
&& fill_liberty(move, color)) {
val = 1.0;
TRACE("Filling a liberty at %1m\n", *move);
- move_considered(I(*move), J(*move), val);
- time_report(1, "fill liberty", -1, -1, 1.0);
+ move_considered(*move, val);
+ time_report(1, "fill liberty", NO_MOVE, 1.0);
}
/* If we're instructed to play out the aftermath or capture all dead
@@ -449,8 +448,8 @@
&& aftermath_genmove(move, color, NULL, 0) > 0) {
val = 1.0;
TRACE("Aftermath move at %1m\n", *move);
- move_considered(I(*move), J(*move), val);
- time_report(1, "aftermath_genmove", -1, -1, 1.0);
+ move_considered(*move, val);
+ time_report(1, "aftermath_genmove", NO_MOVE, 1.0);
}
/* If we're instructed to capture all dead opponent stones, generate
@@ -462,8 +461,8 @@
&& aftermath_genmove(move, color, NULL, 1) > 0) {
val = 1.0;
TRACE("Aftermath move at %1m\n", *move);
- move_considered(I(*move), J(*move), val);
- time_report(1, "aftermath_genmove", -1, -1, 1.0);
+ move_considered(*move, val);
+ time_report(1, "aftermath_genmove", NO_MOVE, 1.0);
}
/* If no move is found then pass. */
@@ -485,18 +484,15 @@
}
if (showtime) {
- double spent = time_report(0, "TIME to generate move at ",
- I(*move), J(*move), 1.0);
+ double spent = time_report(0, "TIME to generate move at ", *move, 1.0);
total_time += spent;
if (spent > slowest_time) {
slowest_time = spent;
- slowest_i = I(*move);
- slowest_j = J(*move);
+ slowest_move = *move;
slowest_movenum = movenum+1;
}
if (*move == NO_MOVE) {
- gprintf("\nSLOWEST MOVE: %d at %m ", slowest_movenum,
- slowest_i, slowest_j);
+ gprintf("\nSLOWEST MOVE: %d at %1m ", slowest_movenum, slowest_move);
fprintf(stderr, "(%.2f seconds)\n", slowest_time);
fprintf(stderr, "\nAVERAGE TIME: %.2f seconds per move\n",
total_time/movenum);
@@ -516,8 +512,10 @@
*/
void
-move_considered(int i, int j, float val)
+move_considered(int move, float val)
{
+ int i = I(move);
+ int j = J(move);
if (val > potential_moves[i][j]) {
potential_moves[i][j] = val;
}
Index: engine/liberty.h
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/liberty.h,v
retrieving revision 1.52
diff -u -r1.52 liberty.h
--- engine/liberty.h 2001/12/02 21:20:57 1.52
+++ engine/liberty.h 2001/12/02 21:38:38
@@ -131,8 +131,7 @@
void start_timer(int n);
-double time_report(int n, const char *occupation, int i, int j,
- double mintime);
+double time_report(int n, const char *occupation, int move, double mintime);
/* Play at (pos) and then count the liberties. */
@@ -300,7 +299,6 @@
int movelist_move_known(int move, int max_points, int points[], int codes[]);
void movelist_change_point(int move, int code, int max_points,
int points[], int codes[]);
-void movelist_sort_points(int max_points, int points[], int codes[]);
/* functions to add (or remove) move reasons */
@@ -488,7 +486,7 @@
/* debugging support */
-void move_considered(int i, int j, float value);
+void move_considered(int move, float value);
/* SGF routines for debugging purposes in sgffile.c */
Index: engine/move_reasons.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/move_reasons.c,v
retrieving revision 1.42
diff -u -r1.42 move_reasons.c
--- engine/move_reasons.c 2001/11/26 14:54:28 1.42
+++ engine/move_reasons.c 2001/12/02 21:38:40
@@ -1864,7 +1864,7 @@
else
move[pos].move_safety = 0;
- time_report(3, " examine_move_safety: ", i, j, 1.0);
+ time_report(3, " examine_move_safety: ", pos, 1.0);
}
}
@@ -3658,7 +3658,7 @@
|| move[pos].territorial_value > 0
|| move[pos].strategical_value > 0) {
TRACE("Move generation values %1m to %f\n", pos, tot_value);
- move_considered(I(pos), J(pos), tot_value);
+ move_considered(pos, tot_value);
}
return tot_value;
@@ -3819,7 +3819,7 @@
start_timer(2);
if (!urgent || allpats) {
find_more_attack_and_defense_moves(color);
- time_report(2, " find_more_attack_and_defense_moves", -1, -1, 1.0);
+ time_report(2, " find_more_attack_and_defense_moves", NO_MOVE, 1.0);
}
save_verbose = verbose;
@@ -3827,17 +3827,17 @@
verbose--;
if (level > 5) {
find_more_owl_attack_and_defense_moves(color);
- time_report(2, " find_more_owl_attack_and_defense_moves", -1, -1, 1.0);
+ time_report(2, " find_more_owl_attack_and_defense_moves", NO_MOVE, 1.0);
}
verbose = save_verbose;
induce_secondary_move_reasons(color);
- time_report(2, " induce_secondary_move_reasons", -1, -1, 1.0);
+ time_report(2, " induce_secondary_move_reasons", NO_MOVE, 1.0);
if (verbose > 0)
verbose--;
examine_move_safety(color);
- time_report(2, " examine_move_safety", -1, -1, 1.0);
+ time_report(2, " examine_move_safety", NO_MOVE, 1.0);
verbose = save_verbose;
if (printworms || verbose)
@@ -3845,7 +3845,7 @@
/* Evaluate all moves with move reasons. */
value_moves(color, pure_threat_value, score);
- time_report(2, " value_moves", -1, -1, 1.0);
+ time_report(2, " value_moves", NO_MOVE, 1.0);
/* Perform point redistribution */
redistribute_points();
@@ -3902,7 +3902,7 @@
TRACE("Move at %1m would be an illegal ko capture.\n", best_move);
reevaluate_ko_threats();
redistribute_points();
- time_report(2, " reevaluate_ko_threats", -1, -1, 1.0);
+ time_report(2, " reevaluate_ko_threats", NO_MOVE, 1.0);
ko_values_have_been_added = 1;
move[best_move].value = 0.0;
move[best_move].final_value = 0.0;
Index: engine/movelist.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/movelist.c,v
retrieving revision 1.1
diff -u -r1.1 movelist.c
--- engine/movelist.c 2001/12/02 21:20:57 1.1
+++ engine/movelist.c 2001/12/02 21:38:40
@@ -27,6 +27,7 @@
#include "liberty.h"
+static void movelist_sort_points(int max_points, int points[], int codes[]);
static void swap_points_and_codes(int points[], int codes[], int m, int n);
@@ -92,7 +93,7 @@
* loop.
*/
-void
+static void
movelist_sort_points(int max_points, int points[], int codes[])
{
int start = 0;
Index: engine/owl.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/owl.c,v
retrieving revision 1.43
diff -u -r1.43 owl.c
--- engine/owl.c 2001/12/02 03:08:32 1.43
+++ engine/owl.c 2001/12/02 21:38:41
@@ -3042,7 +3042,7 @@
/* FIXME: We want to do this after the trymove(), but currently
* owl_mark_dragon() may crash if the trymove() happens to remove
- * some stones from the goal dragon from the board.
+ * some stones of the goal dragon from the board.
*/
#if 1
owl.lunches_are_current = 0;
Index: engine/reading.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/reading.c,v
retrieving revision 1.34
diff -u -r1.34 reading.c
--- engine/reading.c 2001/12/02 21:20:57 1.34
+++ engine/reading.c 2001/12/02 21:38:42
@@ -876,7 +876,6 @@
}
}
}
- movelist_sort_points(max_points, moves, codes);
/* FIXME: Threaten to attack by saving weak neighbors.
Index: engine/sgfdecide.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/sgfdecide.c,v
retrieving revision 1.21
diff -u -r1.21 sgfdecide.c
--- engine/sgfdecide.c 2001/11/30 14:16:54 1.21
+++ engine/sgfdecide.c 2001/12/02 21:38:42
@@ -85,7 +85,7 @@
gprintf("%1m can be defended with ko (good) at %1m (%d variations)\n",
pos, dpos, count_variations);
else if (dcode == KO_B)
- gprintf("%m can be defended with ko (bad) at %1m (%d variations)\n",
+ gprintf("%1m can be defended with ko (bad) at %1m (%d variations)\n",
pos, dpos, count_variations);
}
else
Index: engine/utils.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/utils.c,v
retrieving revision 1.26
diff -u -r1.26 utils.c
--- engine/utils.c 2001/12/02 21:20:57 1.26
+++ engine/utils.c 2001/12/02 21:38:43
@@ -1599,7 +1599,7 @@
* time is less than mintime.
*/
double
-time_report(int n, const char *occupation, int i, int j, double mintime)
+time_report(int n, const char *occupation, int move, double mintime)
{
double t;
double dt;
@@ -1612,8 +1612,8 @@
dt = t - timers[n];
if (dt > mintime) {
gprintf("%s", occupation);
- if (!is_pass(POS(i, j)))
- gprintf("%m", i, j);
+ if (move != NO_MOVE)
+ gprintf("%1m", move);
fprintf(stderr, ": %.2f sec\n", dt);
}
timers[n] = t;
Index: engine/worm.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/worm.c,v
retrieving revision 1.25
diff -u -r1.25 worm.c
--- engine/worm.c 2001/12/02 21:20:57 1.25
+++ engine/worm.c 2001/12/02 21:38:43
@@ -177,7 +177,7 @@
int pos = POS(m, n);
int w1 = NO_MOVE;
int w2 = NO_MOVE;
- int i, j, k, di, dj;
+ int i, j, k;
/* Only work on each worm once. This is easiest done if we only
* work with the origin of each worm.
@@ -190,26 +190,25 @@
*/
for (i = 0; i < board_size; i++)
for (j = 0; j < board_size; j++) {
-
+ int pos2 = POS(i, j);
/* Work only with the opposite color from (pos). */
- if (BOARD(i, j) != OTHER_COLOR(board[pos]))
+ if (board[pos2] != OTHER_COLOR(board[pos]))
continue;
for (k = 0; k < 4; k++) {
- di = i + deltai[k];
- dj = j + deltaj[k];
- if (ON_BOARD2(di, dj) && is_worm_origin(POS(di, dj), pos)) {
-
- ASSERT1(BOARD(di, dj) == board[pos], pos);
-
- /* If we have not already found a worm which meets the criteria,
- * store it into (ti, tj), otherwise store it into (ui, uj).
- */
- if (w1 == NO_MOVE)
- w1 = worm[POS(i, j)].origin;
- else if (!is_same_worm(POS(i, j), w1))
- w2 = worm[POS(i, j)].origin;
- }
+ if (!ON_BOARD(pos2 + delta[k])
+ || worm[pos2 + delta[k]].origin != pos)
+ continue;
+
+ ASSERT1(board[pos2 + delta[k]] == board[pos], pos);
+
+ /* If we have not already found a worm which meets the criteria,
+ * store it into (w1), otherwise store it into (w2).
+ */
+ if (w1 == NO_MOVE)
+ w1 = worm[pos2].origin;
+ else if (!is_same_worm(pos2, w1))
+ w2 = worm[pos2].origin;
} /* loop over k */
} /* loop over i,j */
@@ -239,7 +238,7 @@
for (m = 0; m < board_size; m++)
for (n = 0; n < board_size; n++) {
int pos = POS(m, n);
- if (board[pos] && is_worm_origin(pos, pos)) {
+ if (IS_STONE(board[pos]) && is_worm_origin(pos, pos)) {
worm[pos].genus = genus(pos);
propagate_worm(pos);
}
@@ -831,10 +830,10 @@
if (worm[pos].attack_codes[0] != 0) {
int tpos = NO_MOVE;
- TRACE ("considering defense of %m\n", m, n);
+ TRACE ("considering defense of %1m\n", pos);
dcode = find_defense(pos, &tpos);
if (dcode) {
- TRACE ("worm at %m can be defended at %1m\n", m, n, tpos);
+ TRACE ("worm at %1m can be defended at %1m\n", pos, tpos);
if (tpos != NO_MOVE)
change_defense(pos, tpos, dcode);
}
@@ -1778,7 +1777,8 @@
/* FIXME: Don't try to defend the same string more than once.
* FIXME: For all attacks on this string, we should test whether
* the proposed move happens to refute the attack.
- * Play (move) and see if there is an attack. */
+ * Play (move) and see if there is an attack.
+ */
if (trymove(move, color, "defense_callback", str, EMPTY, NO_MOVE)) {
int acode = attack(str, NULL);
Index: patterns/owl_vital_apats.db
===================================================================
RCS file: /cvsroot/gnugo/gnugo/patterns/owl_vital_apats.db,v
retrieving revision 1.13
diff -u -r1.13 owl_vital_apats.db
--- patterns/owl_vital_apats.db 2001/11/28 21:56:01 1.13
+++ patterns/owl_vital_apats.db 2001/12/02 21:38:43
@@ -637,7 +637,7 @@
-Pattern VA29
+Pattern VA38
# gf New pattern. (3.1.15)
# See trevora:25
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gnugo-devel] bugfix patch,
Gunnar Farneback <=