[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnugo-devel] correction patch inge_3_9.3
From: |
Inge Wallin |
Subject: |
[gnugo-devel] correction patch inge_3_9.3 |
Date: |
Thu, 26 Sep 2002 17:41:09 +0200 (MEST) |
When applying inge_3_9.1 to the CVS, there must have been some error
because suddenly there were a lot of formatting errors in the code.
The error consists of a one-character offset in indentation of some
lines. I can't say if the error was mine or if it was introduced
later.
Anyway, here is a patch that corrects those errors. The patch looks
ridiculous on the surface, but never the less it fixes the indentation
problems.
-Inge
================================================================
Index: engine/aftermath.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/aftermath.c,v
retrieving revision 1.34
diff -u -r1.34 aftermath.c
--- engine/aftermath.c 25 Sep 2002 12:59:58 -0000 1.34
+++ engine/aftermath.c 26 Sep 2002 15:32:52 -0000
@@ -586,7 +586,7 @@
for (r = 0; r < neighbors; r++) {
if (worm[adjs[r]].attack_codes[0] != 0
&& (find_defense(adjs[r], NULL)
- > worm[adjs[r]].defense_codes[0])) {
+ > worm[adjs[r]].defense_codes[0])) {
DEBUG(DEBUG_AFTERMATH,
"Blunder: %1m becomes tactically safer after %1m\n",
adjs[r], move);
Index: engine/combination.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/combination.c,v
retrieving revision 1.35
diff -u -r1.35 combination.c
--- engine/combination.c 25 Sep 2002 12:59:58 -0000 1.35
+++ engine/combination.c 26 Sep 2002 15:32:52 -0000
@@ -447,7 +447,7 @@
else if (dragon[pos].status == CRITICAL)
aa_status[pos] = CRITICAL;
else if (worm[pos].attack_codes[0] != 0) {
- if (worm[pos].defense_codes[0] != 0)
+ if (worm[pos].defense_codes[0] != 0)
aa_status[pos] = CRITICAL;
else
aa_status[pos] = DEAD;
Index: engine/dragon.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/dragon.c,v
retrieving revision 1.81
diff -u -r1.81 dragon.c
--- engine/dragon.c 25 Sep 2002 12:59:58 -0000 1.81
+++ engine/dragon.c 26 Sep 2002 15:32:52 -0000
@@ -538,7 +538,7 @@
dragon2[d].safety = INESSENTIAL;
else if (dragon[origin].size == worm[origin].size
&& worm[origin].attack_codes[0] != 0
- && worm[origin].defense_codes[0] == 0)
+ && worm[origin].defense_codes[0] == 0)
dragon2[d].safety = TACTICALLY_DEAD;
else if (0) /* Seki is detected by the call to semeai() below. */
dragon2[d].safety = ALIVE_IN_SEKI;
@@ -591,7 +591,7 @@
if (ON_BOARD(str)) {
if (is_worm_origin(str, str)
&& worm[str].attack_codes[0] != 0
- && worm[str].defense_codes[0] != 0
+ && worm[str].defense_codes[0] != 0
&& !worm[str].inessential) {
int adjs[MAXCHAIN];
int neighbors;
@@ -1083,11 +1083,11 @@
}
for (k = 0; k < MAX_TACTICAL_POINTS; k++) {
- if (w->defense_codes[k] == 0)
+ if (w->defense_codes[k] == 0)
break;
- if (w->defense_codes[k] != 0)
+ if (w->defense_codes[k] != 0)
gprintf("- defendable at %1m, defend code = %d\n",
- w->defense_points[k], w->defense_codes[k]);
+ w->defense_points[k], w->defense_codes[k]);
}
for (k = 0; k < MAX_TACTICAL_POINTS; k++) {
Index: engine/influence.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/influence.c,v
retrieving revision 1.64
diff -u -r1.64 influence.c
--- engine/influence.c 25 Sep 2002 12:59:58 -0000 1.64
+++ engine/influence.c 26 Sep 2002 15:32:52 -0000
@@ -404,7 +404,7 @@
|| (saved_stones[pos] == INFLUENCE_UNCHANGED_STONE
&& ((worm[pos].attack_codes[0] != 0
&& (OTHER_COLOR(q->p[i][j]) == color
- || worm[pos].defense_codes[0] == 0))
+ || worm[pos].defense_codes[0] == 0))
|| (q->dragons_known
&& dragon[pos].id != -1
&& (DRAGON2(pos).safety == DEAD
Index: engine/move_reasons.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/move_reasons.c,v
retrieving revision 1.95
diff -u -r1.95 move_reasons.c
--- engine/move_reasons.c 25 Sep 2002 12:59:58 -0000 1.95
+++ engine/move_reasons.c 26 Sep 2002 15:32:52 -0000
@@ -430,6 +430,7 @@
*/
gg_assert(k < MAX_REASONS);
gg_assert(next_reason < MAX_MOVE_REASONS);
+
/* Add a new entry. */
move[pos].reason[k] = next_reason;
move_reasons[next_reason].type = type;
@@ -968,7 +969,7 @@
/* If this string is already attacked, and with no defense, then
* there is no additional value of this move reason. */
if (worm[target1].attack_codes[0] != 0
- && worm[target1].defense_codes[0] == 0)
+ && worm[target1].defense_codes[0] == 0)
return;
}
break;
@@ -985,7 +986,7 @@
/* If this string is already attacked, and with no defense, then
* there is no additional value of this move reason. */
if (worm[target2].attack_codes[0] != 0
- && worm[target2].defense_codes[0] == 0)
+ && worm[target2].defense_codes[0] == 0)
return;
}
break;
@@ -1546,7 +1547,7 @@
if (board[pos] == OTHER_COLOR(color)) {
if (dragon[pos].status == DEAD
|| (worm[pos].attack_codes[0] != 0
- && worm[pos].defense_codes[0] == 0))
+ && worm[pos].defense_codes[0] == 0))
safe_stones[pos] = 0;
else
safe_stones[pos] = SAFE_STONE;
@@ -1602,17 +1603,17 @@
case ATTACK_MOVE:
aa = worms[move_reasons[r].what];
gprintf("Move at %1m attacks %1m%s\n", pos, aa,
- (worm[aa].defense_codes[0] == 0) ? " (defenseless)" : "");
+ (worm[aa].defense_codes[0] == 0) ? " (defenseless)" : "");
break;
case ATTACK_MOVE_GOOD_KO:
aa = worms[move_reasons[r].what];
gprintf("Move at %1m attacks %1m%s with good ko\n", pos, aa,
- (worm[aa].defense_codes[0] == 0) ? " (defenseless)" : "");
+ (worm[aa].defense_codes[0] == 0) ? " (defenseless)" : "");
break;
case ATTACK_MOVE_BAD_KO:
aa = worms[move_reasons[r].what];
gprintf("Move at %1m attacks %1m%s with bad ko\n", pos, aa,
- (worm[aa].defense_codes[0] == 0) ? " (defenseless)" : "");
+ (worm[aa].defense_codes[0] == 0) ? " (defenseless)" : "");
break;
case DEFEND_MOVE:
Index: engine/optics.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/optics.c,v
retrieving revision 1.52
diff -u -r1.52 optics.c
--- engine/optics.c 25 Sep 2002 12:59:58 -0000 1.52
+++ engine/optics.c 26 Sep 2002 15:32:52 -0000
@@ -453,7 +453,7 @@
else
result = (!worm[pos].inessential
&& (worm[pos].attack_codes[0] == 0
- || worm[pos].defense_codes[0] != 0));
+ || worm[pos].defense_codes[0] != 0));
return result;
}
Index: engine/reading.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/reading.c,v
retrieving revision 1.75
diff -u -r1.75 reading.c
--- engine/reading.c 25 Sep 2002 19:52:43 -0000 1.75
+++ engine/reading.c 26 Sep 2002 15:32:53 -0000
@@ -981,7 +981,7 @@
if (stackp == 0) {
if (r == -1)
continue;
- if (worm[adjs[k]].defense_codes[r] == 0)
+ if (worm[adjs[k]].defense_codes[r] == 0)
break;
bb = worm[adjs[k]].defense_points[r];
}
Index: engine/utils.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/utils.c,v
retrieving revision 1.56
diff -u -r1.56 utils.c
--- engine/utils.c 25 Sep 2002 12:59:58 -0000 1.56
+++ engine/utils.c 26 Sep 2002 15:32:53 -0000
@@ -105,7 +105,7 @@
if (stackp == 0) {
if (worm[str].attack_codes[0] != 0
- && worm[str].defense_codes[0] == 0)
+ && worm[str].defense_codes[0] == 0)
return 0;
spos = worm[str].defense_points[0];
}
@@ -1023,7 +1023,7 @@
else if (board[pos] == other
&& worm[pos].origin == pos
&& worm[pos].attack_codes[0] != 0
- && worm[pos].defense_codes[0] == 0
+ && worm[pos].defense_codes[0] == 0
&& find_defense(pos, NULL)) {
/* A dead opponent's worm has become defendable.
* Also ask the owl code whether the string can live
Index: engine/value_moves.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/value_moves.c,v
retrieving revision 1.56
diff -u -r1.56 value_moves.c
--- engine/value_moves.c 25 Sep 2002 12:59:58 -0000 1.56
+++ engine/value_moves.c 26 Sep 2002 15:32:53 -0000
@@ -142,7 +142,7 @@
if (board[ii]
&& worm[ii].origin == ii
&& worm[ii].attack_codes[0] != 0
- && worm[ii].defense_codes[0] != 0) {
+ && worm[ii].defense_codes[0] != 0) {
unstable_worms[N] = find_worm(ii);
N++;
}
@@ -208,7 +208,7 @@
&& !attack_move_reason_known(ii, unstable_worms[k])) {
int dcode = find_defense(aa, NULL);
- if (dcode < worm[aa].defense_codes[0]) {
+ if (dcode < worm[aa].defense_codes[0]) {
/* Maybe find_defense() doesn't find the defense. Try to
* defend with the stored defense move.
*/
@@ -220,7 +220,7 @@
int this_dcode = REVERSE_RESULT(attack(aa, NULL));
if (this_dcode > dcode) {
dcode = this_dcode;
- if (dcode >= worm[aa].defense_codes[0])
+ if (dcode >= worm[aa].defense_codes[0])
attack_works = 0;
}
popgo();
@@ -456,7 +456,7 @@
color_to_move = board[aa];
}
- if (worm[aa].defense_codes[0] == 0)
+ if (worm[aa].defense_codes[0] == 0)
continue; /* No defense. */
/* Don't care about inessential dragons. */
@@ -470,7 +470,7 @@
*
* FIXME: We may want to revise this policy.
*/
- if (!attack_move && !move[pos].move_safety)
+ if (!attack_move && !move[pos].move_safety)
continue;
num_adj = extended_chainlinks(aa, adjs, 1);
@@ -1819,7 +1819,7 @@
aa = worms[worm1];
/* Defenseless stone */
- if (worm[aa].defense_codes[0] == 0)
+ if (worm[aa].defense_codes[0] == 0)
break;
/* FIXME: This is totally ad hoc, just guessing the value of
@@ -1927,8 +1927,8 @@
/* Also if there is a combination attack, we assume it covers
* the same thing.
- * FIXME: This is only applicable as long as the only moves
- * handled by EITHER_MOVE are attacks.
+ * FIXME: This is only applicable as long as the only moves
+ * handled by EITHER_MOVE are attacks.
*/
if (move_reason_known(pos, MY_ATARI_ATARI_MOVE, -1))
break;
Index: engine/worm.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/worm.c,v
retrieving revision 1.42
diff -u -r1.42 worm.c
--- engine/worm.c 25 Sep 2002 12:59:58 -0000 1.42
+++ engine/worm.c 26 Sep 2002 15:32:53 -0000
@@ -303,21 +303,21 @@
*/
if (worm[str].color == OTHER_COLOR(color)
&& worm[str].attack_codes[0] != 0
- && worm[str].defense_codes[0] != 0) {
+ && worm[str].defense_codes[0] != 0) {
int dcode = find_defense(str, NULL);
- if (dcode < worm[str].defense_codes[0]) {
+ if (dcode < worm[str].defense_codes[0]) {
int attack_works = 1;
/* Sometimes find_defense() fails to find a
* defense which has been found by other means.
* Try if the old defense move still works.
*/
- if (worm[str].defense_codes[0] != 0
+ if (worm[str].defense_codes[0] != 0
&& trymove(worm[str].defense_points[0],
OTHER_COLOR(color), "make_worms", 0, EMPTY, 0)) {
int this_dcode = REVERSE_RESULT(attack(str, NULL));
if (this_dcode > dcode) {
dcode = this_dcode;
- if (dcode >= worm[str].defense_codes[0])
+ if (dcode >= worm[str].defense_codes[0])
attack_works = 0;
}
popgo();
@@ -381,12 +381,12 @@
&& !is_same_worm(pos, SOUTH(pos))) {
if (worm[pos].attack_codes[0] != 0
&& worm[SOUTH(pos)].attack_codes[0] != 0) {
- if (worm[pos].defense_codes[0] == 0
+ if (worm[pos].defense_codes[0] == 0
&& does_defend(worm[SOUTH(pos)].attack_points[0], pos)) {
/* FIXME: need to check ko relationship here */
change_defense(pos, worm[SOUTH(pos)].attack_points[0], WIN);
}
- if (worm[SOUTH(pos)].defense_codes[0] == 0
+ if (worm[SOUTH(pos)].defense_codes[0] == 0
&& does_defend(worm[pos].attack_points[0], SOUTH(pos))) {
/* FIXME: need to check ko relationship here */
change_defense(SOUTH(pos), worm[pos].attack_points[0], WIN);
@@ -402,12 +402,12 @@
&& !is_same_worm(pos, EAST(pos))) {
if (worm[pos].attack_codes[0] != 0
&& worm[EAST(pos)].attack_codes[0] != 0) {
- if (worm[pos].defense_codes[0] == 0
+ if (worm[pos].defense_codes[0] == 0
&& does_defend(worm[EAST(pos)].attack_points[0], pos)) {
/* FIXME: need to check ko relationship here */
change_defense(pos, worm[EAST(pos)].attack_points[0], WIN);
}
- if (worm[EAST(pos)].defense_codes[0] == 0
+ if (worm[EAST(pos)].defense_codes[0] == 0
&& does_defend(worm[pos].attack_points[0], EAST(pos))) {
/* FIXME: need to check ko relationship here */
change_defense(EAST(pos), worm[pos].attack_points[0], WIN);
@@ -823,7 +823,7 @@
}
/* Try to defend at the liberty. */
if (!defense_move_known(pos, str)) {
- if (worm[str].defense_codes[0] != 0)
+ if (worm[str].defense_codes[0] != 0)
if (trymove(pos, color, "make_worms", NO_MOVE, EMPTY, NO_MOVE)) {
acode = attack(str, NULL);
if (acode != WIN)
@@ -871,11 +871,11 @@
num_adj = chainlinks(str, adjs);
for (k = 0; k < num_adj; k++) {
if (worm[adjs[k]].attack_codes[0] != 0
- && worm[adjs[k]].defense_codes[0] != 0)
+ && worm[adjs[k]].defense_codes[0] != 0)
for (r = 0; r < MAX_TACTICAL_POINTS; r++) {
int bb;
- if (worm[adjs[k]].defense_codes[r] == 0)
+ if (worm[adjs[k]].defense_codes[r] == 0)
break;
bb = worm[adjs[k]].defense_points[r];
if (trymove(bb, other, "threaten attack", str,
@@ -898,7 +898,7 @@
/* 2. Continue with finding defense threats. */
/* Only try those worms that have an attack. */
if (worm[str].attack_codes[0] != 0
- && worm[str].defense_codes[0] == 0) {
+ && worm[str].defense_codes[0] == 0) {
liberties = findlib(str, MAXLIBS, libs);
@@ -1033,7 +1033,7 @@
{
str = worm[str].origin;
change_tactical_point(str, move, dcode,
- worm[str].defense_points, worm[str].defense_codes);
+ worm[str].defense_points, worm[str].defense_codes);
}
@@ -1112,7 +1112,7 @@
{
return movelist_move_known(move, MAX_TACTICAL_POINTS,
worm[str].defense_points,
- worm[str].defense_codes);
+ worm[str].defense_codes);
}
/* Check whether (move) is listed as an attack threat point for (str)
@@ -1231,9 +1231,9 @@
if (board[pos] == color) {
for (k = 0; k < MAX_TACTICAL_POINTS; k++) {
- if (worm[pos].defense_codes[k] != 0)
+ if (worm[pos].defense_codes[k] != 0)
add_defense_move(worm[pos].defense_points[k], pos,
- worm[pos].defense_codes[k]);
+ worm[pos].defense_codes[k]);
if (worm[pos].defense_threat_codes[k] != 0)
add_defense_threat_move(worm[pos].defense_threat_points[k], pos,
@@ -1737,9 +1737,9 @@
i = 0;
while (worm[pos].attack_points[i] != NO_MOVE) {
if (i > 0)
- gprintf(",");
+ gprintf(",");
gprintf(" %1m: %s", worm[pos].attack_points[i],
- result_to_string(worm[pos].attack_codes[i]));
+ result_to_string(worm[pos].attack_codes[i]));
i++;
}
gprintf("\n;");
@@ -1753,9 +1753,9 @@
i = 0;
while (worm[pos].defense_points[i] != NO_MOVE) {
if (i > 0)
- gprintf(",");
+ gprintf(",");
gprintf(" %1m: %s", worm[pos].defense_points[i],
- result_to_string(worm[pos].defense_codes[i]));
+ result_to_string(worm[pos].defense_codes[i]));
i++;
}
gprintf("\n;");
@@ -1769,15 +1769,14 @@
i = 0;
while (worm[pos].attack_threat_points[i] != NO_MOVE) {
if (i > 0)
- gprintf(",");
+ gprintf(",");
gprintf(" %1m: %s", worm[pos].attack_threat_points[i],
- result_to_string(worm[pos].attack_threat_codes[i]));
+ result_to_string(worm[pos].attack_threat_codes[i]));
i++;
}
gprintf("\n;");
}
-
/* List all defense threat points. */
if (worm[pos].defense_threat_points[0] == NO_MOVE)
gprintf("no defense threat point, ");
@@ -1786,9 +1785,9 @@
i = 0;
while (worm[pos].defense_threat_points[i] != NO_MOVE) {
if (i > 0)
- gprintf(",");
+ gprintf(",");
gprintf(" %1m: %s", worm[pos].defense_threat_points[i],
- result_to_string(worm[pos].defense_threat_codes[i]));
+ result_to_string(worm[pos].defense_threat_codes[i]));
i++;
}
gprintf("\n;");
Index: interface/play_gtp.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/interface/play_gtp.c,v
retrieving revision 1.92
diff -u -r1.92 play_gtp.c
--- interface/play_gtp.c 25 Sep 2002 12:59:58 -0000 1.92
+++ interface/play_gtp.c 26 Sep 2002 15:32:54 -0000
@@ -2607,7 +2607,7 @@
I(w->lunch), J(w->lunch));
gtp_mprintf("defense_point %m\n",
I(w->defense_points[0]), J(w->defense_points[0]));
- gtp_printf("defense_code %d\n", w->defense_codes[0]);
+ gtp_printf("defense_code %d\n", w->defense_codes[0]);
gtp_printf("cutstone %d\n", w->cutstone);
gtp_printf("cutstone2 %d\n", w->cutstone2);
gtp_printf("genus %d\n", w->genus);
Index: interface/debugboard/gui.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/interface/debugboard/gui.c,v
retrieving revision 1.20
diff -u -r1.20 gui.c
--- interface/debugboard/gui.c 25 Sep 2002 12:59:58 -0000 1.20
+++ interface/debugboard/gui.c 26 Sep 2002 15:32:54 -0000
@@ -122,7 +122,7 @@
else
gg_wprintw(info_window, "%3s:%d ",
location_to_string(worm[w].defense_points[i]),
- worm[w].defense_codes[i]);
+ worm[w].defense_codes[i]);
wmove(info_window, 11, 19 + i * 6);
if (worm[w].attack_threat_points[i] == 0)
- [gnugo-devel] correction patch inge_3_9.3,
Inge Wallin <=