[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnugo-devel] komaster
From: |
Arend Bayer |
Subject: |
[gnugo-devel] komaster |
Date: |
Sat, 10 Apr 2004 21:02:24 +0200 (CEST) |
This patch makes komaster and kom_pos private variables in board.c. This
means that all the recursive reading functions don't have to keep track
of komaster states anymore, this is done automatically when they call
komaster_trymove() or trymove(). They are kept track of with the the
PUSH_VALUE() machinery. So this gets rid of all the "int new_komaster,
new_kom_pos" etc. in reading.c etc. Altogether, it removes some 130 lines.
There is an implied change in behaviour. E.g. when a black gets komaster
in owl reading, and a reading helper function is called, then this
reading will be done under the same komaster state. I think this change
is beneficial, and while the breakage is bad, I think close analysis shows
that it is in fact useful. nngs4:270 is the only problem.
Reading+owl nodes are increased by about 1% by the owl attack move patch
and this patch together. But this is offset by a speedup (of the reading
functions, I suppose).
Arend
owl:232 PASS 3 C6 [3 C6]
Not accidental, very basic situation.
strategy:50 FAIL Q11 [Q9]
Owl reading improved: S11 is now owl critical.
owl1:298 FAIL 1 Q3 [2 Q3]
Fixed by next patch.
nngs4:230 FAIL L18 [Q18]
Accidental (running out of owl nodes by 5 nodes)
nngs4:270 FAIL P5 [!P5]
Bad, requires a fix.
ninestones:570 PASS J15 [A9|B10|D11|F11|J15|A16]
Good. Semeai between H10 and J9 now considered critical.
Total nodes: 1557560569 2844625 11009807
19 PASS
15 FAIL
Index: engine/aftermath.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/aftermath.c,v
retrieving revision 1.47
diff -u -p -r1.47 aftermath.c
--- engine/aftermath.c 24 Jan 2004 04:04:56 -0000 1.47
+++ engine/aftermath.c 10 Apr 2004 15:02:35 -0000
@@ -578,8 +578,7 @@ aftermath_genmove(int *aftermath_move, i
break;
}
if (k < 4) {
- if (trymove(move, color, "aftermath-B", move + delta[k],
- EMPTY, NO_MOVE)) {
+ if (trymove(move, color, "aftermath-B", move + delta[k])) {
int adjs[MAXCHAIN];
int neighbors;
int r;
@@ -649,7 +648,7 @@ aftermath_genmove(int *aftermath_move, i
* a dead opponent string at (target).
*/
- if (!trymove(pos, color, "aftermath-A", target, EMPTY, NO_MOVE))
+ if (!trymove(pos, color, "aftermath-A", target))
continue;
/* It is frequently necessary to sacrifice own stones in order
@@ -697,7 +696,7 @@ aftermath_genmove(int *aftermath_move, i
int lib;
findlib(pos, 1, &lib);
move = lib;
- if (!trymove(move, color, "aftermath-B", target, EMPTY, NO_MOVE))
+ if (!trymove(move, color, "aftermath-B", target))
break;
}
Index: engine/board.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/board.c,v
retrieving revision 1.91
diff -u -p -r1.91 board.c
--- engine/board.c 24 Jan 2004 04:04:56 -0000 1.91
+++ engine/board.c 10 Apr 2004 15:02:50 -0000
@@ -304,6 +304,8 @@ static int do_remove_string(int s);
static void do_commit_suicide(int pos, int color);
static void do_play_move(int pos, int color);
+static int komaster, kom_pos;
+
/* Statistics. */
static int trymove_counter = 0;
@@ -417,6 +419,9 @@ clear_board(void)
white_captured = 0;
black_captured = 0;
+ komaster = EMPTY;
+ kom_pos = NO_MOVE;
+
initial_board_ko_pos = NO_MOVE;
initial_white_captured = 0;
initial_black_captured = 0;
@@ -477,8 +482,7 @@ static Hash_data hashdata_stack[MAXSTACK
*/
int
-trymove(int pos, int color, const char *message, int str,
- int komaster, int kom_pos)
+trymove(int pos, int color, const char *message, int str)
{
/* Do the real work elsewhere. */
if (!do_trymove(pos, color, 0))
@@ -537,8 +541,7 @@ trymove(int pos, int color, const char *
*/
int
-tryko(int pos, int color, const char *message, int komaster,
- int kom_pos)
+tryko(int pos, int color, const char *message)
{
/* Do the real work elsewhere. */
if (!do_trymove(pos, color, 1))
@@ -906,6 +909,7 @@ play_move(int pos, int color)
ASSERT1(color == WHITE || color == BLACK, pos);
ASSERT1(pos == PASS_MOVE || ON_BOARD1(pos), pos);
ASSERT1(pos == PASS_MOVE || board[pos] == EMPTY, pos);
+ ASSERT1(komaster == EMPTY && kom_pos == NO_MOVE, pos);
if (move_history_pointer >= MAX_MOVE_HISTORY) {
/* The move history is full. We resolve this by collapsing the
@@ -1173,8 +1177,6 @@ is_illegal_ko_capture(int pos, int color
*/
int
komaster_trymove(int pos, int color, const char *message, int str,
- int komaster, int kom_pos,
- int *new_komaster, int *new_kom_pos,
int *is_conditional_ko, int consider_conditional_ko)
{
int other = OTHER_COLOR(color);
@@ -1197,21 +1199,21 @@ komaster_trymove(int pos, int color, con
&& (IS_STONE(board[kom_pos])
|| (!is_ko(kom_pos, WHITE, NULL)
&& is_suicide(kom_pos, WHITE))))) {
+ PUSH_VALUE(komaster);
+ PUSH_VALUE(kom_pos);
komaster = EMPTY;
kom_pos = NO_MOVE;
}
- /* Usually the komaster parameters are unchanged. */
- *new_komaster = komaster;
- *new_kom_pos = kom_pos;
-
*is_conditional_ko = 0;
ko_move = is_ko(pos, color, &kpos);
if (!ko_move) {
if (komaster == WEAK_KO) {
- *new_komaster = EMPTY;
- *new_kom_pos = NO_MOVE;
+ PUSH_VALUE(komaster);
+ PUSH_VALUE(kom_pos);
+ komaster = EMPTY;
+ kom_pos = NO_MOVE;
}
}
else {
@@ -1236,19 +1238,21 @@ komaster_trymove(int pos, int color, con
}
}
- if (!trymove(pos, color, message, str, komaster, kom_pos)) {
+ if (!trymove(pos, color, message, str)) {
if (!consider_conditional_ko)
return 0;
- if (!tryko(pos, color, message, komaster, kom_pos))
+ if (!tryko(pos, color, message))
return 0; /* Suicide. */
*is_conditional_ko = 1;
/* Conditional ko capture, set komaster parameters. */
if (komaster == EMPTY || komaster == WEAK_KO) {
- *new_komaster = color;
- *new_kom_pos = kpos;
+ PUSH_VALUE(komaster);
+ PUSH_VALUE(kom_pos);
+ komaster = color;
+ kom_pos = kpos;
return 1;
}
}
@@ -1256,28 +1260,43 @@ komaster_trymove(int pos, int color, con
if (!ko_move)
return 1;
+ PUSH_VALUE(komaster);
+ PUSH_VALUE(kom_pos);
+
if (komaster == other) {
if (color == WHITE)
- *new_komaster = GRAY_BLACK;
+ komaster = GRAY_BLACK;
else
- *new_komaster = GRAY_WHITE;
+ komaster = GRAY_WHITE;
}
else if (komaster == color) {
/* This is where we update kom_pos after a nested capture. */
- *new_kom_pos = kpos;
+ kom_pos = kpos;
}
else {
/* We can reach here when komaster is EMPTY or WEAK_KO. If previous
* move was also a ko capture, we now set komaster to WEAK_KO.
*/
if (previous_board_ko_pos != NO_MOVE) {
- *new_komaster = WEAK_KO;
- *new_kom_pos = previous_board_ko_pos;
+ komaster = WEAK_KO;
+ kom_pos = previous_board_ko_pos;
}
}
return 1;
}
+
+int
+get_komaster()
+{
+ return komaster;
+}
+
+int get_kom_pos()
+{
+ return kom_pos;
+}
+
/* Determine whether vertex is on the edge. */
int
Index: engine/board.h
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/board.h,v
retrieving revision 1.8
diff -u -p -r1.8 board.h
--- engine/board.h 24 Jan 2004 04:04:56 -0000 1.8
+++ engine/board.h 10 Apr 2004 15:02:50 -0000
@@ -239,16 +239,14 @@ int get_last_opponent_move(int color);
int stones_on_board(int color);
/* Functions handling the variable board state. */
-int trymove(int pos, int color, const char *message, int str,
- int komaster, int kom_pos);
-int tryko(int pos, int color, const char *message,
- int komaster, int kom_pos);
+int trymove(int pos, int color, const char *message, int str);
+int tryko(int pos, int color, const char *message);
void popgo(void);
int komaster_trymove(int pos, int color,
const char *message, int str,
- int komaster, int kom_pos,
- int *new_komaster, int *new_kom_pos,
int *is_conditional_ko, int consider_conditional_ko);
+int get_komaster(void);
+int get_kom_pos(void);
int move_in_stack(int pos, int cutoff);
void get_move_from_stack(int k, int *move, int *color);
Index: engine/cache.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/cache.c,v
retrieving revision 1.38
diff -u -p -r1.38 cache.c
--- engine/cache.c 5 Feb 2004 22:54:42 -0000 1.38
+++ engine/cache.c 10 Apr 2004 15:02:50 -0000
@@ -92,13 +92,12 @@ keyhash_init(void)
}
static void
-calculate_hashval_for_tt(int komaster, int kom_pos, int routine,
- int target1, int target2,
+calculate_hashval_for_tt(int routine, int target1, int target2,
Hash_data *hashdata2)
{
*hashdata2 = hashdata; /* from globals.c */
- hashdata_xor(*hashdata2, komaster_hash[komaster]);
- hashdata_xor(*hashdata2, kom_pos_hash[kom_pos]);
+ hashdata_xor(*hashdata2, komaster_hash[get_komaster()]);
+ hashdata_xor(*hashdata2, kom_pos_hash[get_kom_pos()]);
hashdata_xor(*hashdata2, routine_hash[routine]);
hashdata_xor(*hashdata2, target1_hash[target1]);
if (target2 != NO_MOVE)
@@ -177,7 +176,7 @@ tt_free(Transposition_table *table)
int
tt_get(Transposition_table *table,
- int komaster, int kom_pos, enum routine_id routine,
+ enum routine_id routine,
int target1, int target2, int remaining_depth,
Hash_data *extra_hash,
int *value1, int *value2, int *move)
@@ -187,8 +186,7 @@ tt_get(Transposition_table *table,
Hashnode_ng *node;
/* Get the combined hash value. */
- calculate_hashval_for_tt(komaster, kom_pos, routine, target1, target2,
- &hashval);
+ calculate_hashval_for_tt(routine, target1, target2, &hashval);
if (extra_hash)
hashdata_xor(hashval, *extra_hash);
@@ -230,8 +228,7 @@ tt_get(Transposition_table *table,
void
tt_update(Transposition_table *table,
- int komaster, int kom_pos, enum routine_id routine,
- int target1, int target2,
+ enum routine_id routine, int target1, int target2,
int remaining_depth,
Hash_data *extra_hash,
int value1, int value2, int move)
@@ -243,7 +240,7 @@ tt_update(Transposition_table *table,
unsigned int data;
/* Get the combined hash value. */
- calculate_hashval_for_tt(komaster, kom_pos, routine, target1, target2,
+ calculate_hashval_for_tt(routine, target1, target2,
&hashval);
if (extra_hash)
hashdata_xor(hashval, *extra_hash);
@@ -343,7 +340,6 @@ static void hashnode_unlink_closed_resul
int statistics[][20]);
static void hashtable_partially_clear(Hashtable *table);
static int do_get_read_result(enum routine_id routine,
- int komaster, int kom_pos,
int str1, int str2, Read_result **read_result,
Hash_data *hashmodifier);
@@ -971,7 +967,6 @@ reading_cache_clear()
int
get_read_result_hash_modified(enum routine_id routine,
- int komaster, int kom_pos,
int *str, Hash_data *hashmodifier,
Read_result **read_result)
{
@@ -988,7 +983,7 @@ get_read_result_hash_modified(enum routi
*/
*str = find_origin(*str);
- return do_get_read_result(routine, komaster, kom_pos, *str, NO_MOVE,
+ return do_get_read_result(routine, *str, NO_MOVE,
read_result, hashmodifier);
}
@@ -997,7 +992,7 @@ get_read_result_hash_modified(enum routi
* For performance, the location is changed to the origin of the string.
*/
int
-get_read_result(enum routine_id routine, int komaster, int kom_pos, int *str,
+get_read_result(enum routine_id routine, int *str,
Read_result **read_result)
{
/* Only store the result if stackp <= depth. Above that, there
@@ -1013,8 +1008,7 @@ get_read_result(enum routine_id routine,
*/
*str = find_origin(*str);
- return do_get_read_result(routine, komaster, kom_pos, *str, NO_MOVE,
- read_result, NULL);
+ return do_get_read_result(routine, *str, NO_MOVE, read_result, NULL);
}
@@ -1022,8 +1016,7 @@ get_read_result(enum routine_id routine,
* Variant with two calling strings.
*/
int
-get_read_result2(enum routine_id routine, int komaster, int kom_pos,
- int *str1, int *str2,
+get_read_result2(enum routine_id routine, int *str1, int *str2,
Read_result **read_result)
{
/* Only store the result if stackp <= depth. Above that, there
@@ -1040,18 +1033,18 @@ get_read_result2(enum routine_id routine
*str1 = find_origin(*str1);
*str2 = find_origin(*str2);
- return do_get_read_result(routine, komaster, kom_pos, *str1, *str2,
+ return do_get_read_result(routine, *str1, *str2,
read_result, NULL);
}
static int
-do_get_read_result(enum routine_id routine, int komaster, int kom_pos,
+do_get_read_result(enum routine_id routine,
int str1, int str2, Read_result **read_result,
Hash_data *hashmodifier)
{
Hashnode *node;
- unsigned int data1 = rr_input_data1(routine, komaster, kom_pos,
+ unsigned int data1 = rr_input_data1(routine, get_komaster(), get_kom_pos(),
str1, depth - stackp);
unsigned int data2 = rr_input_data2(str2);
Hash_data modified_hash;
Index: engine/cache.h
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/cache.h,v
retrieving revision 1.44
diff -u -p -r1.44 cache.h
--- engine/cache.h 5 Feb 2004 22:54:42 -0000 1.44
+++ engine/cache.h 10 Apr 2004 15:02:50 -0000
@@ -98,13 +98,11 @@ extern Transposition_table ttable;
void tt_init(Transposition_table *table, int memsize);
void tt_clear(Transposition_table *table);
void tt_free(Transposition_table *table);
-int tt_get(Transposition_table *table,
- int komaster, int kom_pos, enum routine_id routine,
+int tt_get(Transposition_table *table, enum routine_id routine,
int target1, int target2, int remaining_depth,
Hash_data *extra_hash,
int *value1, int *value2, int *move);
-void tt_update(Transposition_table *table,
- int komaster, int kom_pos, enum routine_id routine,
+void tt_update(Transposition_table *table, enum routine_id routine,
int target, int target2, int remaining_depth,
Hash_data *extra_hash,
int value1, int value2, int move);
@@ -337,13 +335,12 @@ void sgf_trace_semeai(const char *func,
result1, result2, message)
-int get_read_result(enum routine_id routine, int komaster, int kom_pos,
+int get_read_result(enum routine_id routine,
int *str, Read_result **read_result);
int get_read_result_hash_modified(enum routine_id routine,
- int komaster, int kom_pos,
int *str, Hash_data *hash_modifier,
Read_result **read_result);
-int get_read_result2(enum routine_id routine, int komaster, int kom_pos,
+int get_read_result2(enum routine_id routine,
int *str1, int *str2, Read_result **read_result);
@@ -355,53 +352,53 @@ int get_read_result2(enum routine_id rou
* store the result in the hash table at the same time.
*/
-#define READ_RETURN0_NG(komaster, kom_pos, routine, str, remaining_depth) \
+#define READ_RETURN0_NG(routine, str, remaining_depth) \
do { \
- tt_update(&ttable, komaster, kom_pos, routine, str, NO_MOVE, \
+ tt_update(&ttable, routine, str, NO_MOVE, \
remaining_depth, NULL,\
0, 0, NO_MOVE);\
return 0; \
} while (0)
-#define READ_RETURN_NG(komaster, kom_pos, routine, str, remaining_depth,
point, move, value) \
+#define READ_RETURN_NG(routine, str, remaining_depth, point, move, value) \
do { \
- tt_update(&ttable, komaster, kom_pos, routine, str, NO_MOVE, \
+ tt_update(&ttable, routine, str, NO_MOVE, \
remaining_depth, NULL,\
value, 0, move);\
if ((value) != 0 && (point) != 0) *(point) = (move); \
return (value); \
} while (0)
-#define READ_RETURN_SEMEAI_NG(komaster, kom_pos, routine, str1, str2,
remaining_depth, point, move, value1, value2) \
+#define READ_RETURN_SEMEAI_NG(routine, str1, str2, remaining_depth, point,
move, value1, value2) \
do { \
- tt_update(&ttable, komaster, kom_pos, routine, str1, str2, \
+ tt_update(&ttable, routine, str1, str2, \
remaining_depth, NULL, \
value1, value2, move); \
if ((value1) != 0 && (point) != 0) *(point) = (move); \
return; \
} while (0)
-#define READ_RETURN_CONN_NG(komaster, kom_pos, routine, str1, str2,
remaining_depth, point, move, value) \
+#define READ_RETURN_CONN_NG(routine, str1, str2, remaining_depth, point, move,
value) \
do { \
- tt_update(&ttable, komaster, kom_pos, routine, str1, str2, \
+ tt_update(&ttable, routine, str1, str2, \
remaining_depth, NULL,\
value, 0, move);\
if ((value) != 0 && (point) != 0) *(point) = (move); \
return (value); \
} while (0)
-#define READ_RETURN_HASH_NG(komaster, kom_pos, routine, str, remaining_depth,
hash, point, move, value) \
+#define READ_RETURN_HASH_NG(routine, str, remaining_depth, hash, point, move,
value) \
do { \
- tt_update(&ttable, komaster, kom_pos, routine, str, NO_MOVE, \
+ tt_update(&ttable, routine, str, NO_MOVE, \
remaining_depth, hash,\
value, 0, move);\
if ((value) != 0 && (point) != 0) *(point) = (move); \
return (value); \
} while (0)
-#define READ_RETURN2_NG(komaster, kom_pos, routine, str, remaining_depth,
point, move, value1, value2) \
+#define READ_RETURN2_NG(routine, str, remaining_depth, point, move, value1,
value2) \
do { \
- tt_update(&ttable, komaster, kom_pos, routine, str, NO_MOVE, \
+ tt_update(&ttable, routine, str, NO_MOVE, \
remaining_depth, NULL,\
value1, value2, move);\
if ((value1) != 0 && (point) != 0) *(point) = (move); \
Index: engine/combination.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/combination.c,v
retrieving revision 1.49
diff -u -p -r1.49 combination.c
--- engine/combination.c 24 Jan 2004 04:04:56 -0000 1.49
+++ engine/combination.c 10 Apr 2004 15:02:50 -0000
@@ -121,7 +121,7 @@ find_double_threats(int color)
num_a_threatened_groups = get_attack_threats(ii, MAX_THREATENED_STRINGS,
a_threatened_groups);
if (num_a_threatened_groups > 1) {
- if (trymove(ii, color, "find_double_threats-A", ii, EMPTY, NO_MOVE)) {
+ if (trymove(ii, color, "find_double_threats-A", ii)) {
for (k = 0; k < num_a_threatened_groups - 1; ++k)
for (l = k + 1; l < num_a_threatened_groups; ++l) {
/* Note: If we used attack_either() here instead of trymove()
@@ -314,7 +314,7 @@ atari_atari(int color, int *attack_move,
if (!ON_BOARD(pos) || !defense_moves[pos])
continue;
- if (!trymove(pos, other, "atari_atari", NO_MOVE, EMPTY, NO_MOVE)) {
+ if (!trymove(pos, other, "atari_atari", NO_MOVE)) {
defense_moves[pos] = 0;
if (save_verbose)
gprintf("%1m deleted defense point, illegal\n", pos);
@@ -390,7 +390,7 @@ atari_atari_blunder_size(int color, int
compute_aa_values(other);
/* Accept illegal ko capture here. */
- if (!tryko(move, color, NULL, EMPTY, NO_MOVE))
+ if (!tryko(move, color, NULL))
/* Really shouldn't happen. */
abortgo(__FILE__, __LINE__, "trymove", move);
increase_depth_values();
@@ -682,7 +682,7 @@ do_atari_atari(int color, int *attack_po
int bpos;
int r;
- if (!trymove(apos, color, "do_atari_atari-A", str, EMPTY, NO_MOVE))
+ if (!trymove(apos, color, "do_atari_atari-A", str))
continue;
if (all_potential_defenses) {
@@ -723,7 +723,7 @@ do_atari_atari(int color, int *attack_po
if (all_potential_defenses)
all_potential_defenses[bpos] = 1;
- if (trymove(bpos, other, "do_atari_atari-B", str, EMPTY, NO_MOVE)) {
+ if (trymove(bpos, other, "do_atari_atari-B", str)) {
int new_aa_val;
char new_goal[BOARDMAX];
/* These moves may have been irrelevant for later
@@ -992,7 +992,7 @@ atari_atari_attack_callback(int anchor,
/*
* Play (move) and see if there is an attack.
*/
- if (trymove(move, color, "attack_callback", str, EMPTY, NO_MOVE)) {
+ if (trymove(move, color, "attack_callback", str)) {
int acode;
int attack_point = NO_MOVE;
@@ -1071,8 +1071,7 @@ atari_atari_find_defense_moves(int targe
liberties = findlib(str, 4, libs);
for (k = 0; k < liberties; k++) {
if (!mx[libs[k]]
- && trymove(libs[k], board[str], "aa_defend-A", str,
- EMPTY, NO_MOVE)) {
+ && trymove(libs[k], board[str], "aa_defend-A", str)) {
if (attack(str, NULL) == 0) {
moves[num_moves++] = libs[k];
mx[libs[k]] = 1;
@@ -1102,8 +1101,7 @@ atari_atari_find_defense_moves(int targe
for (s = 0; s < liberties; s++) {
if (!mx[libs[s]]
&& !is_self_atari(libs[s], board[str])
- && trymove(libs[s], board[str], "aa_defend-B", str,
- EMPTY, NO_MOVE)) {
+ && trymove(libs[s], board[str], "aa_defend-B", str)) {
if (attack(str, NULL) == 0) {
moves[num_moves++] = libs[s];
mx[libs[s]] = 1;
Index: engine/endgame.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/endgame.c,v
retrieving revision 1.8
diff -u -p -r1.8 endgame.c
--- engine/endgame.c 24 Jan 2004 04:04:56 -0000 1.8
+++ engine/endgame.c 10 Apr 2004 15:02:50 -0000
@@ -137,7 +137,7 @@ endgame_analyze_worm_liberties(int pos,
*/
for (k = 0; k < inessential_liberties; k++) {
if (!safe_move(inessential_libs[k], other)
- || !trymove(inessential_libs[k], other, "endgame", pos, EMPTY, 0))
+ || !trymove(inessential_libs[k], other, "endgame", pos))
break;
}
@@ -154,7 +154,7 @@ endgame_analyze_worm_liberties(int pos,
int lib = essential_libs[k];
if (safe_move(lib, worm_color) && safe_move(lib, other)
- && trymove(lib, other, "endgame", pos, EMPTY, 0)) {
+ && trymove(lib, other, "endgame", pos)) {
if (attack(pos, NULL) != 0) {
int dpos;
@@ -326,7 +326,7 @@ endgame_analyze_worm_liberties(int pos,
* trust them.
*/
for (k = 0; k < inessential_liberties; k++) {
- if (!trymove(inessential_libs[k], worm_color, "endgame", pos, EMPTY, 0))
+ if (!trymove(inessential_libs[k], worm_color, "endgame", pos))
break;
}
@@ -334,7 +334,7 @@ endgame_analyze_worm_liberties(int pos,
if (k == inessential_liberties && board[pos] != EMPTY) {
if (countlib(pos) > 1) {
for (k = 0; k < num_attacks2; k++) {
- if (trymove(attacks[k], other, "endgame", pos, EMPTY, 0)) {
+ if (trymove(attacks[k], other, "endgame", pos)) {
if (attack(pos, NULL) != 0) {
TRACE(" endgame move with territorial value %d.0 found at %1m\n",
1, attacks[k]);
@@ -409,8 +409,7 @@ endgame_find_backfilling_dame(int str, i
break;
for (k = 0; k < inessential_liberties; k++) {
if (!safe_move(inessential_libs[k], other)
- || !trymove(inessential_libs[k], other,
- "endgame", str, EMPTY, NO_MOVE))
+ || !trymove(inessential_libs[k], other, "endgame", str))
continue;
if (board[str] == EMPTY)
break;
@@ -418,7 +417,7 @@ endgame_find_backfilling_dame(int str, i
if (worm[dpos].color == EMPTY)
move = dpos;
forced_backfilling_moves[dpos] = 1;
- trymove(dpos, color, "endgame", str, EMPTY, NO_MOVE);
+ trymove(dpos, color, "endgame", str);
loop_again = 1;
break;
}
Index: engine/filllib.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/filllib.c,v
retrieving revision 1.31
diff -u -p -r1.31 filllib.c
--- engine/filllib.c 24 Jan 2004 04:04:56 -0000 1.31
+++ engine/filllib.c 10 Apr 2004 15:02:50 -0000
@@ -225,7 +225,7 @@ fill_liberty(int *move, int color)
}
/* Try to play the move. */
- if (trymove(pos, color, "fill_liberty", NO_MOVE, EMPTY, NO_MOVE)) {
+ if (trymove(pos, color, "fill_liberty", NO_MOVE)) {
popgo();
/* Legal, but not safe. Look for backfilling move. */
DEBUG(DEBUG_FILLLIB,
@@ -368,7 +368,7 @@ find_backfilling_move(int move, int colo
int opponent_libs;
/* Play (move) and identify all liberties and adjacent strings. */
- if (!trymove(move, color, "find_backfilling_move", move, EMPTY, NO_MOVE))
+ if (!trymove(move, color, "find_backfilling_move", move))
return 0; /* This shouldn't happen, I believe. */
/* The move wasn't safe, so there must be an attack for the
@@ -455,7 +455,7 @@ find_backfilling_move(int move, int colo
/* If no luck so far, try with superstring liberties. */
if (!found_one) {
- trymove(move, color, "find_backfilling_move", move, EMPTY, NO_MOVE);
+ trymove(move, color, "find_backfilling_move", move);
find_proper_superstring_liberties(move, &liberties, libs, 0);
popgo();
for (k = 0; k < liberties; k++) {
@@ -469,7 +469,7 @@ find_backfilling_move(int move, int colo
/* If no luck so far, try attacking superstring neighbors. */
if (!found_one) {
- trymove(move, color, "find_backfilling_move", move, EMPTY, NO_MOVE);
+ trymove(move, color, "find_backfilling_move", move);
superstring_chainlinks(move, &neighbors, adjs, 4);
popgo();
for (k = 0; k < neighbors; k++) {
@@ -484,13 +484,11 @@ find_backfilling_move(int move, int colo
if (found_one) {
- if (!trymove(*backfill_move, color, "find_backfilling_move", move,
- EMPTY, NO_MOVE))
+ if (!trymove(*backfill_move, color, "find_backfilling_move", move))
return 0; /* This really shouldn't happen. */
/* Allow opponent to get a move in here. */
- if (trymove(apos, OTHER_COLOR(color), "find_backfilling_move", move,
- EMPTY, NO_MOVE))
+ if (trymove(apos, OTHER_COLOR(color), "find_backfilling_move", move))
extra_pop = 1;
/* If still not safe, recurse to find a new backfilling move. */
Index: engine/genmove.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/genmove.c,v
retrieving revision 1.87
diff -u -p -r1.87 genmove.c
--- engine/genmove.c 10 Apr 2004 14:30:03 -0000 1.87
+++ engine/genmove.c 10 Apr 2004 15:02:50 -0000
@@ -760,7 +760,7 @@ test_symmetry_after_move(int move, int c
if (board[move] != EMPTY)
return 0;
- if (!trymove(move, color, "find_mirror_move", NO_MOVE, EMPTY, NO_MOVE))
+ if (!trymove(move, color, "find_mirror_move", NO_MOVE))
return 0;
for (pos = BOARDMIN; pos <= MIRROR_MOVE(pos); pos++) {
Index: engine/liberty.h
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/liberty.h,v
retrieving revision 1.210
diff -u -p -r1.210 liberty.h
--- engine/liberty.h 10 Apr 2004 14:30:03 -0000 1.210
+++ engine/liberty.h 10 Apr 2004 15:02:50 -0000
@@ -204,9 +204,9 @@ int defend_both(int astr, int bstr);
int break_through(int apos, int bpos, int cpos);
int attack_threats(int pos, int max_points, int moves[], int codes[]);
-int restricted_defend1(int str, int *move, int komaster, int kom_pos,
+int restricted_defend1(int str, int *move,
int num_forbidden_moves, int *forbidden_moves);
-int restricted_attack2(int str, int *move, int komaster, int kom_pos,
+int restricted_attack2(int str, int *move,
int num_forbidden_moves, int *forbidden_moves);
int simple_ladder(int str, int *move);
Index: engine/move_reasons.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/move_reasons.c,v
retrieving revision 1.124
diff -u -p -r1.124 move_reasons.c
--- engine/move_reasons.c 10 Apr 2004 14:30:03 -0000 1.124
+++ engine/move_reasons.c 10 Apr 2004 15:02:52 -0000
@@ -1518,8 +1518,7 @@ mark_changed_dragon(int pos, int color,
if (worm[ii].attack_codes[0] == NO_MOVE
|| defense_move_reason_known(pos, ii))
worm_is_safe = 1;
- else if (trymove(pos, color, "mark-changed-dragon", ii,
- EMPTY, NO_MOVE)) {
+ else if (trymove(pos, color, "mark-changed-dragon", ii)) {
if (REVERSE_RESULT(attack(ii, NULL)) >= result_to_beat)
worm_is_safe = 1;
popgo();
Index: engine/optics.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/optics.c,v
retrieving revision 1.86
diff -u -p -r1.86 optics.c
--- engine/optics.c 8 Apr 2004 19:07:35 -0000 1.86
+++ engine/optics.c 10 Apr 2004 15:02:57 -0000
@@ -2551,8 +2551,7 @@ test_eyeshape(int eyesize, int *eye_vert
* does not capture any stones.
*/
static int
-eyegraph_trymove(int pos, int color, const char *message, int str,
- int komaster, int kom_pos)
+eyegraph_trymove(int pos, int color, const char *message, int str)
{
static Hash_data remembered_board_hashes[MAXSTACK];
int k;
@@ -2560,7 +2559,7 @@ eyegraph_trymove(int pos, int color, con
remembered_board_hashes[stackp] = hashdata;
- if (!trymove(pos, color, message, str, komaster, kom_pos))
+ if (!trymove(pos, color, message, str))
return 0;
if (does_capture)
@@ -2779,8 +2778,8 @@ tactical_life_attack(int str, int num_ve
OTHER_COLOR(board[str]), moves);
for (k = 0; k < num_moves; k++) {
int move = moves[k];
- if (eyegraph_trymove(move, OTHER_COLOR(board[str]), "tactical_life_attack",
- str, EMPTY, NO_MOVE)) {
+ if (eyegraph_trymove(move, OTHER_COLOR(board[str]),
+ "tactical_life_attack", str)) {
/* We were successful if the white stones were captured or if no
* defense can be found.
*/
@@ -2849,8 +2848,7 @@ tactical_life_defend(int str, int num_ve
int move = moves[k];
if ((!is_suicide(move, OTHER_COLOR(board[str]))
|| does_capture_something(move, board[str]))
- && eyegraph_trymove(move, board[str], "tactical_life_defend", str,
- EMPTY, NO_MOVE)) {
+ && eyegraph_trymove(move, board[str], "tactical_life_defend", str)) {
/* We were successful if no attack can be found. */
result = !tactical_life_attack(str, num_vertices, vertices, results);
@@ -2911,8 +2909,7 @@ tactical_life(int have_eye, int num_vert
* suicide the white stones can be considered dead.
*/
if (!have_eye) {
- if (!eyegraph_trymove(POS(0, 0), WHITE, "tactical_life-A", NO_MOVE,
- EMPTY, NO_MOVE)) {
+ if (!eyegraph_trymove(POS(0, 0), WHITE, "tactical_life-A", NO_MOVE)) {
*attack_code = WIN;
*defense_code = 0;
return;
@@ -2946,7 +2943,7 @@ tactical_life(int have_eye, int num_vert
for (k = 0; k < num_moves; k++) {
int move = moves[k];
if (eyegraph_trymove(move, OTHER_COLOR(board[str]), "tactical_life-B",
- str, EMPTY, NO_MOVE)) {
+ str)) {
if (board[str] == EMPTY
|| !tactical_life_defend(str, num_vertices, vertices, results))
attack_points[(*num_attacks)++] = move;
@@ -2961,8 +2958,7 @@ tactical_life(int have_eye, int num_vert
moves);
for (k = 0; k < num_moves; k++) {
int move = moves[k];
- if (eyegraph_trymove(move, board[str], "tactical_life-C", str, EMPTY,
- NO_MOVE)) {
+ if (eyegraph_trymove(move, board[str], "tactical_life-C", str)) {
if (!tactical_life_attack(str, num_vertices, vertices, results))
defense_points[(*num_defenses)++] = move;
popgo();
@@ -3036,8 +3032,7 @@ evaluate_eyespace(struct eyevalue *resul
for (k = 0; k < num_moves; k++) {
int acode, dcode;
int move = moves[k];
- if (eyegraph_trymove(move, BLACK, "evaluate_eyespace-A", NO_MOVE,
- EMPTY, NO_MOVE)) {
+ if (eyegraph_trymove(move, BLACK, "evaluate_eyespace-A", NO_MOVE)) {
tactical_life(0, num_vertices, vertices, &acode, NULL, NULL,
&dcode, NULL, NULL, tactical_life_results);
if (acode != 0) {
@@ -3097,8 +3092,7 @@ evaluate_eyespace(struct eyevalue *resul
int a = 1;
for (k = 0; k < num_attacks; k++) {
int move = attack_points[k];
- if (eyegraph_trymove(move, BLACK, "evaluate_eyespace-B", NO_MOVE,
- EMPTY, NO_MOVE)) {
+ if (eyegraph_trymove(move, BLACK, "evaluate_eyespace-B", NO_MOVE)) {
evaluate_eyespace(&result2, num_vertices, vertices,
&num_vital_attacks2, vital_attacks2,
&num_vital_defenses2, vital_defenses2,
@@ -3152,8 +3146,7 @@ evaluate_eyespace(struct eyevalue *resul
for (k = 0; k < num_moves; k++) {
int acode, dcode;
int move = moves[k];
- if (eyegraph_trymove(move, BLACK, "evaluate_eyespace-C", NO_MOVE,
- EMPTY, NO_MOVE)) {
+ if (eyegraph_trymove(move, BLACK, "evaluate_eyespace-C", NO_MOVE)) {
tactical_life(1, num_vertices, vertices, &acode, NULL, NULL,
&dcode, NULL, NULL, tactical_life_results);
if (acode != 0) {
@@ -3177,8 +3170,7 @@ evaluate_eyespace(struct eyevalue *resul
for (k = 0; k < num_moves; k++) {
int acode, dcode;
int move = moves[k];
- if (eyegraph_trymove(move, WHITE, "evaluate_eyespace-D", NO_MOVE,
- EMPTY, NO_MOVE)) {
+ if (eyegraph_trymove(move, WHITE, "evaluate_eyespace-D", NO_MOVE)) {
tactical_life(0, num_vertices, vertices, &acode, NULL, NULL,
&dcode, NULL, NULL, tactical_life_results);
if (dcode != 0) {
@@ -3220,8 +3212,7 @@ evaluate_eyespace(struct eyevalue *resul
vital_attacks[(*num_vital_attacks)++] = attack_points[k];
for (k = 0; k < num_defenses; k++) {
int move = defense_points[k];
- if (eyegraph_trymove(move, WHITE, "evaluate_eyespace-E", NO_MOVE,
- EMPTY, NO_MOVE)) {
+ if (eyegraph_trymove(move, WHITE, "evaluate_eyespace-E", NO_MOVE)) {
evaluate_eyespace(&result2, num_vertices, vertices,
&num_vital_attacks2, vital_attacks2,
&num_vital_defenses2, vital_defenses2,
@@ -3263,8 +3254,7 @@ evaluate_eyespace(struct eyevalue *resul
for (k = 0; k < num_moves; k++) {
int acode, dcode;
int move = moves[k];
- if (eyegraph_trymove(move, WHITE, "evaluate_eyespace-F", NO_MOVE,
- EMPTY, NO_MOVE)) {
+ if (eyegraph_trymove(move, WHITE, "evaluate_eyespace-F", NO_MOVE)) {
tactical_life(1, num_vertices, vertices, &acode, NULL, NULL,
&dcode, NULL, NULL, tactical_life_results);
if (dcode != 0) {
Index: engine/oracle.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/oracle.c,v
retrieving revision 1.13
diff -u -p -r1.13 oracle.c
--- engine/oracle.c 24 Jan 2004 04:04:56 -0000 1.13
+++ engine/oracle.c 10 Apr 2004 15:02:57 -0000
@@ -172,7 +172,7 @@ static int
oracle_trymove(int pos, int color, const char *message, int str,
int komaster, int kom_pos)
{
- if (!trymove(pos, color, message, str, komaster, kom_pos))
+ if (!trymove(pos, color, message, str))
return 0;
if (debug & DEBUG_ORACLE_STREAM)
gfprintf(stderr, "%o%s %1m\n",
Index: engine/owl.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/owl.c,v
retrieving revision 1.202
diff -u -p -r1.202 owl.c
--- engine/owl.c 10 Apr 2004 14:30:03 -0000 1.202
+++ engine/owl.c 10 Apr 2004 15:03:18 -0000
@@ -153,11 +153,9 @@ void dump_pattern_list(struct matched_pa
static int do_owl_attack(int str, int *move, int *wormid,
- struct local_owl_data *owl,
- int komaster, int kom_pos, int escape);
+ struct local_owl_data *owl, int escape);
static int do_owl_defend(int str, int *move, int *wormid,
- struct local_owl_data *owl,
- int komaster, int kom_pos, int escape);
+ struct local_owl_data *owl, int escape);
static void owl_shapes(struct matched_patterns_list_data *list,
struct owl_move_data moves[MAX_MOVES], int color,
struct local_owl_data *owl, struct pattern_db *type);
@@ -185,7 +183,7 @@ static void owl_add_move(struct owl_move
int defense_pos, int max_moves);
static void owl_determine_life(struct local_owl_data *owl,
struct local_owl_data *second_owl,
- int komaster, int does_attack,
+ int does_attack,
struct owl_move_data *moves,
struct eyevalue *probable_eyes,
int *eyemin, int *eyemax);
@@ -195,7 +193,7 @@ static int owl_estimate_life(struct loca
struct local_owl_data *second_owl,
struct owl_move_data vital_moves[MAX_MOVES],
const char **live_reason,
- int komaster, int does_attack,
+ int does_attack,
struct eyevalue *probable_eyes,
int *eyemin, int *eyemax);
static int modify_stupid_eye_vital_point(struct local_owl_data *owl,
@@ -224,13 +222,13 @@ static int owl_escape_route(struct local
static void do_owl_analyze_semeai(int apos, int bpos,
struct local_owl_data *owla,
struct local_owl_data *owlb,
- int komaster, int kom_pos,
+
int *resulta, int *resultb,
int *move, int pass, int owl_phase);
static int semeai_trymove_and_recurse(int apos, int bpos,
struct local_owl_data *owla,
struct local_owl_data *owlb,
- int komaster, int kom_pos, int owl_phase,
+ int owl_phase,
int move, int color, int ko_allowed,
int move_value, const char *move_name,
int same_dragon, int *semeai_move,
@@ -475,10 +473,10 @@ owl_analyze_semeai_after_move(int move,
prefer_ko = EMPTY;
if (move == PASS_MOVE)
- do_owl_analyze_semeai(apos, bpos, owla, owlb, EMPTY, NO_MOVE,
+ do_owl_analyze_semeai(apos, bpos, owla, owlb,
resulta, resultb, semeai_move, 0, owl);
else {
- semeai_trymove_and_recurse(bpos, apos, owlb, owla, EMPTY, NO_MOVE, owl,
+ semeai_trymove_and_recurse(bpos, apos, owlb, owla, owl,
move, color, 1, 0, "mandatory move", 1,
semeai_move, resultb, resulta);
*resulta = REVERSE_RESULT(*resulta);
@@ -520,7 +518,6 @@ static void
do_owl_analyze_semeai(int apos, int bpos,
struct local_owl_data *owla,
struct local_owl_data *owlb,
- int komaster, int kom_pos,
int *resulta, int *resultb,
int *move, int pass, int owl_phase)
{
@@ -588,7 +585,7 @@ do_owl_analyze_semeai(int apos, int bpos
if (stackp <= semeai_branch_depth && (hashflags & HASH_SEMEAI)
&& !pass && owl_phase
- && tt_get(&ttable, komaster, kom_pos, SEMEAI, apos, bpos,
+ && tt_get(&ttable, SEMEAI, apos, bpos,
depth - stackp, NULL,
&value1, &value2, &xpos)) {
/* TRACE_CACHED_RESULT2(*read_result);*/
@@ -610,7 +607,7 @@ do_owl_analyze_semeai(int apos, int bpos
#else
if (stackp <= semeai_branch_depth && (hashflags & HASH_SEMEAI)
&& !pass && owl_phase) {
- if (get_read_result2(SEMEAI, EMPTY, NO_MOVE, &apos, &bpos, &read_result)) {
+ if (get_read_result2(SEMEAI, &apos, &bpos, &read_result)) {
TRACE_CACHED_RESULT2(*read_result);
if (rr_get_result1(*read_result) != 0)
@@ -683,7 +680,7 @@ do_owl_analyze_semeai(int apos, int bpos
count_variations = save_count_variations;
SGFTRACE_SEMEAI(upos, WIN, WIN, "tactical win found");
#if USE_HASHTABLE_NG
- READ_RETURN_SEMEAI_NG(komaster, kom_pos, SEMEAI, apos, bpos,
+ READ_RETURN_SEMEAI_NG(SEMEAI, apos, bpos,
depth - stackp, move, upos, WIN, WIN);
#else
READ_RETURN_SEMEAI(read_result, move, upos, WIN, WIN);
@@ -766,7 +763,7 @@ do_owl_analyze_semeai(int apos, int bpos
if (owl_estimate_life(owla, owlb, vital_defensive_moves,
- &live_reasona, komaster, 0, &probable_eyes_a,
+ &live_reasona, 0, &probable_eyes_a,
&eyemin_a, &eyemax_a))
I_look_alive = 1;
else if (stackp > 2 && owl_escape_route(owla) >= 5) {
@@ -775,7 +772,7 @@ do_owl_analyze_semeai(int apos, int bpos
}
if (owl_estimate_life(owlb, owla, vital_offensive_moves,
- &live_reasonb, komaster, 1, &probable_eyes_b,
+ &live_reasonb, 1, &probable_eyes_b,
&eyemin_b, &eyemax_b))
you_look_alive = 1;
else if (stackp > 2 && owl_escape_route(owlb) >= 5) {
@@ -806,7 +803,7 @@ do_owl_analyze_semeai(int apos, int bpos
TRACE("Both live\n");
SGFTRACE_SEMEAI(PASS_MOVE, WIN, 0, "Both live");
#if USE_HASHTABLE_NG
- READ_RETURN_SEMEAI_NG(komaster, kom_pos, SEMEAI, apos, bpos,
+ READ_RETURN_SEMEAI_NG(SEMEAI, apos, bpos,
depth - stackp, move, PASS_MOVE, WIN, 0);
#else
READ_RETURN_SEMEAI(read_result, move, PASS_MOVE, WIN, 0);
@@ -868,7 +865,7 @@ do_owl_analyze_semeai(int apos, int bpos
if (moves[0].pos == NO_MOVE || we_might_be_inessential) {
include_semeai_worms_in_eyespace = 1;
if (!owl_estimate_life(owlb, owla, vital_offensive_moves,
- &live_reasonb, komaster, 1, &dummy_eyes,
+ &live_reasonb, 1, &dummy_eyes,
&eyemin_b, &eyemax_b))
semeai_review_owl_moves(vital_offensive_moves, owla, owlb, color,
&safe_outside_liberty_found,
@@ -1013,7 +1010,7 @@ do_owl_analyze_semeai(int apos, int bpos
/* If allpats, try and pop to get the move in the sgf record. */
if (!allpats)
break;
- else if (trymove(mpos, color, moves[k].name, apos, komaster, kom_pos)) {
+ else if (trymove(mpos, color, moves[k].name, apos)) {
semeai_add_sgf_comment(moves[k].value, owl_phase);
popgo();
}
@@ -1027,8 +1024,8 @@ do_owl_analyze_semeai(int apos, int bpos
/* Try playing the move at mpos and call ourselves recursively to
* determine the result obtained by this move.
*/
- if (semeai_trymove_and_recurse(apos, bpos, owla, owlb, komaster,
- kom_pos, owl_phase, mpos, color,
+ if (semeai_trymove_and_recurse(apos, bpos, owla, owlb,
+ owl_phase, mpos, color,
best_resulta == 0 || best_resultb == 0,
moves[k].value, moves[k].name,
moves[k].same_dragon, NULL,
@@ -1044,7 +1041,7 @@ do_owl_analyze_semeai(int apos, int bpos
close_pattern_list(color, &shape_defensive_patterns);
close_pattern_list(color, &shape_offensive_patterns);
#if USE_HASHTABLE_NG
- READ_RETURN_SEMEAI_NG(komaster, kom_pos, SEMEAI, apos, bpos,
+ READ_RETURN_SEMEAI_NG(SEMEAI, apos, bpos,
depth - stackp, move, mpos, WIN, WIN);
#else
READ_RETURN_SEMEAI(read_result, move, mpos, WIN, WIN);
@@ -1083,7 +1080,7 @@ do_owl_analyze_semeai(int apos, int bpos
*move = PASS_MOVE;
SGFTRACE_SEMEAI(PASS_MOVE, 0, 0, "You live, I die");
#if USE_HASHTABLE_NG
- READ_RETURN_SEMEAI_NG(komaster, kom_pos, SEMEAI, apos, bpos,
+ READ_RETURN_SEMEAI_NG(SEMEAI, apos, bpos,
depth - stackp, move, PASS_MOVE, 0, 0);
#else
READ_RETURN_SEMEAI(read_result, move, PASS_MOVE, 0, 0);
@@ -1107,7 +1104,7 @@ do_owl_analyze_semeai(int apos, int bpos
if (sworm == s_worms) {
include_semeai_worms_in_eyespace = 1;
if (!owl_estimate_life(owla, owlb, vital_defensive_moves,
- &live_reasona, komaster, 0, &dummy_eyes,
+ &live_reasona, 0, &dummy_eyes,
&eyemin_a, &eyemax_a)) {
include_semeai_worms_in_eyespace = 0;
*resulta = 0;
@@ -1115,7 +1112,7 @@ do_owl_analyze_semeai(int apos, int bpos
*move = PASS_MOVE;
SGFTRACE_SEMEAI(PASS_MOVE, 0, 0, "You live, I die - 2");
#if USE_HASHTABLE_NG
- READ_RETURN_SEMEAI_NG(komaster, kom_pos, SEMEAI, apos, bpos,
+ READ_RETURN_SEMEAI_NG(SEMEAI, apos, bpos,
depth - stackp, move, PASS_MOVE, 0, 0);
#else
READ_RETURN_SEMEAI(read_result, move, PASS_MOVE, 0, 0);
@@ -1136,7 +1133,7 @@ do_owl_analyze_semeai(int apos, int bpos
TRACE("You have more eyes.\n");
SGFTRACE_SEMEAI(PASS_MOVE, 0, 0, "You have more eyes");
#if USE_HASHTABLE_NG
- READ_RETURN_SEMEAI_NG(komaster, kom_pos, SEMEAI, apos, bpos,
+ READ_RETURN_SEMEAI_NG(SEMEAI, apos, bpos,
depth - stackp, move, PASS_MOVE, 0, 0);
#else
READ_RETURN_SEMEAI(read_result, move, PASS_MOVE, 0, 0);
@@ -1149,7 +1146,7 @@ do_owl_analyze_semeai(int apos, int bpos
TRACE("I have more eyes\n");
SGFTRACE_SEMEAI(PASS_MOVE, WIN, WIN, "I have more eyes");
#if USE_HASHTABLE_NG
- READ_RETURN_SEMEAI_NG(komaster, kom_pos, SEMEAI, apos, bpos,
+ READ_RETURN_SEMEAI_NG(SEMEAI, apos, bpos,
depth - stackp, move, PASS_MOVE, WIN, WIN);
#else
READ_RETURN_SEMEAI(read_result, move, PASS_MOVE, WIN, WIN);
@@ -1162,7 +1159,7 @@ do_owl_analyze_semeai(int apos, int bpos
TRACE("Seki\n");
SGFTRACE_SEMEAI(PASS_MOVE, WIN, 0, "Seki");
#if USE_HASHTABLE_NG
- READ_RETURN_SEMEAI_NG(komaster, kom_pos, SEMEAI, apos, bpos,
+ READ_RETURN_SEMEAI_NG(SEMEAI, apos, bpos,
depth - stackp, move, PASS_MOVE, WIN, 0);
#else
READ_RETURN_SEMEAI(read_result, move, PASS_MOVE, WIN, 0);
@@ -1172,7 +1169,7 @@ do_owl_analyze_semeai(int apos, int bpos
/* If no move was found, then pass. */
if (tested_moves == 0) {
- do_owl_analyze_semeai(bpos, apos, owlb, owla, komaster, kom_pos,
+ do_owl_analyze_semeai(bpos, apos, owlb, owla,
resultb, resulta, NULL, 1, owl_phase);
*resulta = REVERSE_RESULT(*resulta);
*resultb = REVERSE_RESULT(*resultb);
@@ -1180,7 +1177,7 @@ do_owl_analyze_semeai(int apos, int bpos
SGFTRACE_SEMEAI(PASS_MOVE, *resulta, *resultb, "No move found");
*move = PASS_MOVE;
#if USE_HASHTABLE_NG
- READ_RETURN_SEMEAI_NG(komaster, kom_pos, SEMEAI, apos, bpos,
+ READ_RETURN_SEMEAI_NG(SEMEAI, apos, bpos,
depth - stackp, move, PASS_MOVE, *resulta, *resultb);
#else
READ_RETURN_SEMEAI(read_result, move, PASS_MOVE, *resulta, *resultb);
@@ -1194,7 +1191,7 @@ do_owl_analyze_semeai(int apos, int bpos
*move = best_move;
SGFTRACE_SEMEAI(best_move, best_resulta, best_resultb, best_move_name);
#if USE_HASHTABLE_NG
- READ_RETURN_SEMEAI_NG(komaster, kom_pos, SEMEAI, apos, bpos, depth - stackp,
+ READ_RETURN_SEMEAI_NG(SEMEAI, apos, bpos, depth - stackp,
move, best_move, best_resulta, best_resultb);
#else
READ_RETURN_SEMEAI(read_result, move, best_move, best_resulta, best_resultb);
@@ -1207,22 +1204,18 @@ do_owl_analyze_semeai(int apos, int bpos
*/
static int
semeai_trymove_and_recurse(int apos, int bpos, struct local_owl_data *owla,
- struct local_owl_data *owlb,
- int komaster, int kom_pos, int owl_phase,
+ struct local_owl_data *owlb, int owl_phase,
int move, int color, int ko_allowed,
int move_value, const char *move_name,
int same_dragon, int *semeai_move,
int *this_resulta, int *this_resultb)
{
- int new_komaster = EMPTY;
- int new_kom_pos = NO_MOVE;
int ko_move = 0;
gg_assert(this_resulta != NULL && this_resultb != NULL);
*this_resulta = 0;
*this_resultb = 0;
- if (!komaster_trymove(move, color, move_name, apos, komaster, kom_pos,
- &new_komaster, &new_kom_pos, &ko_move, ko_allowed))
+ if (!komaster_trymove(move, color, move_name, apos, &ko_move, ko_allowed))
return 0;
semeai_add_sgf_comment(move_value, owl_phase);
@@ -1256,13 +1249,11 @@ semeai_trymove_and_recurse(int apos, int
/* FIXME: Are all owl_data fields and relevant static
* variables properly set up for a call to do_owl_attack()?
*/
- *this_resulta = REVERSE_RESULT(do_owl_attack(apos, NULL, NULL, owla,
- new_komaster, new_kom_pos,
- 0));
+ *this_resulta = REVERSE_RESULT(do_owl_attack(apos, NULL, NULL, owla, 0));
*this_resultb = *this_resulta;
}
else {
- do_owl_analyze_semeai(bpos, apos, owlb, owla, new_komaster, new_kom_pos,
+ do_owl_analyze_semeai(bpos, apos, owlb, owla,
this_resultb, this_resulta, semeai_move, 0,
owl_phase);
*this_resulta = REVERSE_RESULT(*this_resulta);
@@ -1441,7 +1432,7 @@ semeai_propose_eyespace_filling_move(str
&& min_eyes(&owlb->my_eye[origin].value) == 1) {
int good_move = 0;
- if (trymove(pos, color, "eyespace_filling", NO_MOVE, EMPTY, NO_MOVE)) {
+ if (trymove(pos, color, "eyespace_filling", NO_MOVE)) {
struct eyevalue new_value;
int dummy_attack;
int dummy_defense;
@@ -1494,7 +1485,7 @@ semeai_move_value(int move, struct local
net += 100*countlib(pos);
}
}
- if (!trymove(move, color, NULL, 0, 0, NO_MOVE)) {
+ if (!trymove(move, color, NULL, 0)) {
verbose = save_verbose;
return 0;
}
@@ -1593,8 +1584,7 @@ find_semeai_backfilling_move(int worm, i
if (is_self_atari(liberty, other)) {
int fill;
if (approxlib(liberty, other, 1, &fill) > 0
- && trymove(fill, other, "find_semeai_backfilling_move", worm,
- EMPTY, NO_MOVE)) {
+ && trymove(fill, other, "find_semeai_backfilling_move", worm)) {
if (safe_move(liberty, other))
result = fill;
else if (board[worm] != EMPTY)
@@ -1722,7 +1712,7 @@ owl_attack(int target, int *attack_point
owl_make_domains(owl, NULL);
prepare_goal_list(target, owl, owl_goal_worm, &goal_worms_computed,
kworm, 1);
- result = do_owl_attack(target, &move, &wid, owl, EMPTY, 0, 0);
+ result = do_owl_attack(target, &move, &wid, owl, 0);
finish_goal_list(&goal_worms_computed, &wpos, owl_goal_worm, wid);
tactical_nodes = get_reading_node_counter() - reading_nodes_when_called;
@@ -1752,8 +1742,7 @@ owl_attack(int target, int *attack_point
static int
do_owl_attack(int str, int *move, int *wormid,
- struct local_owl_data *owl,
- int komaster, int kom_pos, int escape)
+ struct local_owl_data *owl, int escape)
{
int color = board[str];
int other = OTHER_COLOR(color);
@@ -1793,7 +1782,7 @@ do_owl_attack(int str, int *move, int *w
#if USE_HASHTABLE_NG
if ((hashflags & HASH_OWL_ATTACK)
- && tt_get(&ttable, komaster, kom_pos, OWL_ATTACK, str, NO_MOVE,
+ && tt_get(&ttable, OWL_ATTACK, str, NO_MOVE,
depth - stackp, NULL,
&value1, &value2, &xpos) == 2) {
@@ -1825,7 +1814,7 @@ do_owl_attack(int str, int *move, int *w
#else
if (hashflags & HASH_OWL_ATTACK) {
- found_read_result = get_read_result(OWL_ATTACK, komaster, kom_pos,
+ found_read_result = get_read_result(OWL_ATTACK,
&str, &read_result);
if (found_read_result) {
TRACE_CACHED_RESULT(*read_result);
@@ -1860,7 +1849,7 @@ do_owl_attack(int str, int *move, int *w
if (reading_limit_reached(&live_reason, this_variation_number)) {
SGFTRACE(0, 0, live_reason);
#if USE_HASHTABLE_NG
- READ_RETURN_NG(komaster, kom_pos, OWL_ATTACK, str, depth - stackp,
+ READ_RETURN_NG(OWL_ATTACK, str, depth - stackp,
move, 0, 0);
#else
READ_RETURN(read_result, move, 0, 0);
@@ -1875,7 +1864,7 @@ do_owl_attack(int str, int *move, int *w
memset(owl->safe_move_cache, 0, sizeof(owl->safe_move_cache));
/* First see whether there is any chance to kill. */
- if (owl_estimate_life(owl, NULL, vital_moves, &live_reason, komaster, 1,
+ if (owl_estimate_life(owl, NULL, vital_moves, &live_reason, 1,
&probable_eyes, &eyemin, &eyemax)) {
/*
* We need to check here if there's a worm under atari. If yes,
@@ -1907,7 +1896,7 @@ do_owl_attack(int str, int *move, int *w
TRACE("%oVariation %d: ALIVE (%s)\n", this_variation_number, live_reason);
if (acode == 0)
#if USE_HASHTABLE_NG
- READ_RETURN_NG(komaster, kom_pos, OWL_ATTACK, str, depth - stackp,
+ READ_RETURN_NG(OWL_ATTACK, str, depth - stackp,
move, 0, 0);
#else
READ_RETURN(read_result, move, 0, 0);
@@ -1916,7 +1905,7 @@ do_owl_attack(int str, int *move, int *w
if (wormid)
*wormid = saveworm;
#if USE_HASHTABLE_NG
- READ_RETURN2_NG(komaster, kom_pos, OWL_ATTACK, str, depth - stackp,
+ READ_RETURN2_NG(OWL_ATTACK, str, depth - stackp,
move, mpos, acode, saveworm);
#else
READ_RETURN2(read_result, move, mpos, acode, saveworm);
@@ -2002,8 +1991,7 @@ do_owl_attack(int str, int *move, int *w
case 4:
if (number_tried_moves == 0) {
int dpos;
- int dcode = do_owl_defend(str, &dpos, NULL, owl, komaster,
- kom_pos, escape);
+ int dcode = do_owl_defend(str, &dpos, NULL, owl, escape);
/* No defense, we won. */
if (dcode == 0) {
TRACE("%oVariation %d: DEAD (no defense)\n",
@@ -2011,7 +1999,7 @@ do_owl_attack(int str, int *move, int *w
SGFTRACE(0, WIN, "no defense");
close_pattern_list(other, &shape_patterns);
#if USE_HASHTABLE_NG
- READ_RETURN_NG(komaster, kom_pos, OWL_ATTACK, str, depth - stackp,
+ READ_RETURN_NG(OWL_ATTACK, str, depth - stackp,
move, 0, WIN);
#else
READ_RETURN(read_result, move, 0, WIN);
@@ -2062,7 +2050,7 @@ do_owl_attack(int str, int *move, int *w
SGFTRACE(0, 0, "escaped");
close_pattern_list(other, &shape_patterns);
#if USE_HASHTABLE_NG
- READ_RETURN0_NG(komaster, kom_pos, OWL_ATTACK, str, depth - stackp)
+ READ_RETURN0_NG(OWL_ATTACK, str, depth - stackp)
#else
READ_RETURN0(read_result);
#endif
@@ -2079,8 +2067,6 @@ do_owl_attack(int str, int *move, int *w
for (k = 0; k < MAX_MOVES; k++) {
int mpos;
int ko_move = -1;
- int new_komaster;
- int new_kom_pos;
int origin = NO_MOVE;
int captured;
int wid = MAX_GOAL_WORMS;
@@ -2118,7 +2104,6 @@ do_owl_attack(int str, int *move, int *w
/* Try to make the move. */
if (!komaster_trymove(mpos, other, moves[k].name, str,
- komaster, kom_pos, &new_komaster, &new_kom_pos,
&ko_move, savecode == 0))
continue;
@@ -2156,8 +2141,7 @@ do_owl_attack(int str, int *move, int *w
if (origin == NO_MOVE)
dcode = 0;
else
- dcode = do_owl_defend(origin, NULL, &wid, owl,
- new_komaster, new_kom_pos, escape);
+ dcode = do_owl_defend(origin, NULL, &wid, owl, escape);
if (!ko_move) {
if (dcode == 0) {
@@ -2176,7 +2160,7 @@ do_owl_attack(int str, int *move, int *w
}
close_pattern_list(other, &shape_patterns);
#if USE_HASHTABLE_NG
- READ_RETURN_NG(komaster, kom_pos, OWL_ATTACK, str, depth - stackp,
+ READ_RETURN_NG(OWL_ATTACK, str, depth - stackp,
move, mpos, WIN);
#else
READ_RETURN(read_result, move, mpos, WIN);
@@ -2260,7 +2244,7 @@ do_owl_attack(int str, int *move, int *w
if (wormid)
*wormid = saveworm;
#if USE_HASHTABLE_NG
- READ_RETURN2_NG(komaster, kom_pos, OWL_ATTACK, str, depth - stackp,
+ READ_RETURN2_NG(OWL_ATTACK, str, depth - stackp,
move, savemove, savecode, saveworm);
#else
READ_RETURN2(read_result, move, savemove, savecode, saveworm);
@@ -2269,7 +2253,7 @@ do_owl_attack(int str, int *move, int *w
else {
SGFTRACE(savemove, savecode, "attack effective (ko) - E");
#if USE_HASHTABLE_NG
- READ_RETURN_NG(komaster, kom_pos, OWL_ATTACK, str, depth - stackp,
+ READ_RETURN_NG(OWL_ATTACK, str, depth - stackp,
move, savemove, savecode);
#else
READ_RETURN(read_result, move, savemove, savecode);
@@ -2284,7 +2268,7 @@ do_owl_attack(int str, int *move, int *w
SGFTRACE(0, 0, winstr);
}
#if USE_HASHTABLE_NG
- READ_RETURN0_NG(komaster, kom_pos, OWL_ATTACK, str, depth - stackp);
+ READ_RETURN0_NG(OWL_ATTACK, str, depth - stackp);
#else
READ_RETURN0(read_result);
#endif
@@ -2335,7 +2319,7 @@ owl_threaten_attack(int target, int *att
int mpos = moves[k].pos;
if (mpos != NO_MOVE && moves[k].value > 0)
- if (trymove(mpos, other, moves[k].name, target, EMPTY, 0)) {
+ if (trymove(mpos, other, moves[k].name, target)) {
int pos;
int origin = NO_MOVE;
owl->lunches_are_current = 0;
@@ -2356,7 +2340,7 @@ owl_threaten_attack(int target, int *att
}
if (origin == NO_MOVE
- || do_owl_attack(origin, NULL, NULL, owl, EMPTY, 0, 0)) {
+ || do_owl_attack(origin, NULL, NULL, owl, 0)) {
/* probably this can't happen */
popgo();
gg_assert(stackp == 0);
@@ -2364,8 +2348,7 @@ owl_threaten_attack(int target, int *att
break;
}
}
- else if (do_owl_attack(target, &move2, NULL,
- owl, EMPTY, 0, 0) == WIN) {
+ else if (do_owl_attack(target, &move2, NULL, owl, 0) == WIN) {
move = moves[k].pos;
popgo();
gg_assert(stackp == 0);
@@ -2454,7 +2437,7 @@ owl_defend(int target, int *defense_poin
owl_make_domains(owl, NULL);
prepare_goal_list(target, owl, owl_goal_worm, &goal_worms_computed,
kworm, 1);
- result = do_owl_defend(target, &move, &wid, owl, EMPTY, 0, 0);
+ result = do_owl_defend(target, &move, &wid, owl, 0);
finish_goal_list(&goal_worms_computed, &wpos, owl_goal_worm, wid);
tactical_nodes = get_reading_node_counter() - reading_nodes_when_called;
@@ -2484,7 +2467,7 @@ owl_defend(int target, int *defense_poin
static int
do_owl_defend(int str, int *move, int *wormid,
struct local_owl_data *owl,
- int komaster, int kom_pos, int escape)
+ int escape)
{
int color = board[str];
struct owl_move_data shape_moves[MAX_MOVES];
@@ -2521,7 +2504,7 @@ do_owl_defend(int str, int *move, int *w
#if USE_HASHTABLE_NG
if ((hashflags & HASH_OWL_DEFEND)
- && tt_get(&ttable, komaster, kom_pos, OWL_DEFEND, str, NO_MOVE,
+ && tt_get(&ttable, OWL_DEFEND, str, NO_MOVE,
depth - stackp, NULL,
&value1, &value2, &xpos) == 2) {
@@ -2553,7 +2536,7 @@ do_owl_defend(int str, int *move, int *w
#else
if (hashflags & HASH_OWL_DEFEND) {
- found_read_result = get_read_result(OWL_DEFEND, komaster, kom_pos,
+ found_read_result = get_read_result(OWL_DEFEND,
&str, &read_result);
if (found_read_result) {
TRACE_CACHED_RESULT(*read_result);
@@ -2600,7 +2583,7 @@ do_owl_defend(int str, int *move, int *w
TRACE("%oVariation %d: ALIVE (escaped)\n", this_variation_number);
SGFTRACE(0, WIN, "escaped");
#if USE_HASHTABLE_NG
- READ_RETURN_NG(komaster, kom_pos, OWL_DEFEND, str, depth - stackp,
+ READ_RETURN_NG(OWL_DEFEND, str, depth - stackp,
move, 0, WIN);
#else
READ_RETURN(read_result, move, 0, WIN);
@@ -2611,7 +2594,7 @@ do_owl_defend(int str, int *move, int *w
if (reading_limit_reached(&live_reason, this_variation_number)) {
SGFTRACE(0, WIN, live_reason);
#if USE_HASHTABLE_NG
- READ_RETURN_NG(komaster, kom_pos, OWL_DEFEND, str, depth - stackp,
+ READ_RETURN_NG(OWL_DEFEND, str, depth - stackp,
move, 0, WIN);
#else
READ_RETURN(read_result, move, 0, WIN);
@@ -2627,13 +2610,13 @@ do_owl_defend(int str, int *move, int *w
/* First see whether we might already be alife. */
if (escape < MAX_ESCAPE) {
- if (owl_estimate_life(owl, NULL, vital_moves, &live_reason, komaster, 0,
+ if (owl_estimate_life(owl, NULL, vital_moves, &live_reason, 0,
&probable_eyes, &eyemin, &eyemax)) {
SGFTRACE(0, WIN, live_reason);
TRACE("%oVariation %d: ALIVE (%s)\n",
this_variation_number, live_reason);
#if USE_HASHTABLE_NG
- READ_RETURN_NG(komaster, kom_pos, OWL_DEFEND, str, depth - stackp,
+ READ_RETURN_NG(OWL_DEFEND, str, depth - stackp,
move, 0, WIN);
#else
READ_RETURN(read_result, move, 0, WIN);
@@ -2746,7 +2729,6 @@ do_owl_defend(int str, int *move, int *w
*/
for (k = 0; k < MAX_MOVES; k++) {
int mpos;
- int new_komaster, new_kom_pos;
int ko_move = -1;
int new_escape;
int wid = MAX_GOAL_WORMS;
@@ -2780,7 +2762,6 @@ do_owl_defend(int str, int *move, int *w
/* Try to make the move. */
if (!komaster_trymove(mpos, color, moves[k].name, str,
- komaster, kom_pos, &new_komaster, &new_kom_pos,
&ko_move, savecode == 0))
continue;
@@ -2804,8 +2785,7 @@ do_owl_defend(int str, int *move, int *w
owl_update_goal(mpos, moves[k].same_dragon, owl, 0);
if (!ko_move) {
- int acode = do_owl_attack(str, NULL, &wid, owl, new_komaster,
- new_kom_pos, new_escape);
+ int acode = do_owl_attack(str, NULL, &wid, owl, new_escape);
if (!acode) {
pop_owl(&owl);
popgo();
@@ -2817,7 +2797,7 @@ do_owl_defend(int str, int *move, int *w
}
close_pattern_list(color, &shape_patterns);
#if USE_HASHTABLE_NG
- READ_RETURN_NG(komaster, kom_pos, OWL_DEFEND, str, depth - stackp,
+ READ_RETURN_NG(OWL_DEFEND, str, depth - stackp,
move, mpos, WIN);
#else
READ_RETURN(read_result, move, mpos, WIN);
@@ -2828,8 +2808,7 @@ do_owl_defend(int str, int *move, int *w
UPDATE_SAVED_KO_RESULT(savecode, savemove, acode, mpos);
}
else {
- if (do_owl_attack(str, NULL, NULL, owl,
- new_komaster, new_kom_pos, new_escape) != WIN) {
+ if (do_owl_attack(str, NULL, NULL, owl, new_escape) != WIN) {
savemove = mpos;
savecode = KO_B;
}
@@ -2849,7 +2828,7 @@ do_owl_defend(int str, int *move, int *w
if (wormid)
*wormid = saveworm;
#if USE_HASHTABLE_NG
- READ_RETURN2_NG(komaster, kom_pos, OWL_DEFEND, str, depth - stackp,
+ READ_RETURN2_NG(OWL_DEFEND, str, depth - stackp,
move, savemove, savecode, saveworm);
#else
READ_RETURN2(read_result, move, savemove, savecode, saveworm);
@@ -2858,7 +2837,7 @@ do_owl_defend(int str, int *move, int *w
else {
SGFTRACE(savemove, savecode, "defense effective (ko) - B");
#if USE_HASHTABLE_NG
- READ_RETURN_NG(komaster, kom_pos, OWL_DEFEND, str, depth - stackp,
+ READ_RETURN_NG(OWL_DEFEND, str, depth - stackp,
move, savemove, savecode);
#else
READ_RETURN(read_result, move, savemove, savecode);
@@ -2869,7 +2848,7 @@ do_owl_defend(int str, int *move, int *w
if (number_tried_moves == 0 && min_eyes(&probable_eyes) >= 2) {
SGFTRACE(0, WIN, "genus probably >= 2");
#if USE_HASHTABLE_NG
- READ_RETURN_NG(komaster, kom_pos, OWL_DEFEND, str, depth - stackp,
+ READ_RETURN_NG(OWL_DEFEND, str, depth - stackp,
move, 0, WIN);
#else
READ_RETURN(read_result, move, 0, WIN);
@@ -2886,7 +2865,7 @@ do_owl_defend(int str, int *move, int *w
}
#if USE_HASHTABLE_NG
- READ_RETURN0_NG(komaster, kom_pos, OWL_DEFEND, str, depth - stackp);
+ READ_RETURN0_NG(OWL_DEFEND, str, depth - stackp);
#else
READ_RETURN0(read_result);
#endif
@@ -2938,10 +2917,10 @@ owl_threaten_defense(int target, int *de
break;
else {
if (moves[k].pos != NO_MOVE && moves[k].value > 0)
- if (trymove(moves[k].pos, color, moves[k].name, target, EMPTY, 0)) {
+ if (trymove(moves[k].pos, color, moves[k].name, target)) {
owl->lunches_are_current = 0;
owl_update_goal(moves[k].pos, moves[k].same_dragon, owl, 0);
- if (do_owl_defend(target, &move2, NULL, owl, EMPTY, 0, 0) == WIN) {
+ if (do_owl_defend(target, &move2, NULL, owl, 0) == WIN) {
move = moves[k].pos;
popgo();
/* Don't return the second move if occupied before trymove */
@@ -2989,7 +2968,7 @@ static int
owl_estimate_life(struct local_owl_data *owl,
struct local_owl_data *second_owl,
struct owl_move_data vital_moves[MAX_MOVES],
- const char **live_reason, int komaster, int does_attack,
+ const char **live_reason, int does_attack,
struct eyevalue *probable_eyes, int *eyemin, int *eyemax)
{
SGFTree *save_sgf_dumptree = sgf_dumptree;
@@ -3000,7 +2979,7 @@ owl_estimate_life(struct local_owl_data
sgf_dumptree = NULL;
count_variations = 0;
- owl_determine_life(owl, second_owl, komaster, does_attack, vital_moves,
+ owl_determine_life(owl, second_owl, does_attack, vital_moves,
probable_eyes, eyemin, eyemax);
matches_found = 0;
@@ -3097,16 +3076,12 @@ owl_estimate_life(struct local_owl_data
*
* For use in the semeai code, a second dragon can be provided. Set
* this to NULL when only one dragon is involved.
- *
- * The parameter komaster is currently unused. It is included to
- * prepare better handling of ko once the optics code becomes more ko
- * aware.
*/
static void
owl_determine_life(struct local_owl_data *owl,
struct local_owl_data *second_owl,
- int komaster, int does_attack,
+ int does_attack,
struct owl_move_data *moves,
struct eyevalue *probable_eyes, int *eyemin, int *eyemax)
{
@@ -3130,7 +3105,6 @@ owl_determine_life(struct local_owl_data
int num_lunches = 0;
int save_debug = debug;
memset(vital_values, 0, sizeof(vital_values));
- UNUSED(komaster);
if (!eyemin)
eyemin = &dummy_eyemin;
@@ -5004,7 +4978,7 @@ owl_does_defend(int move, int target, in
&result, kworm, NULL, NULL))
return result;
- if (trymove(move, color, "owl_does_defend", target, EMPTY, 0)) {
+ if (trymove(move, color, "owl_does_defend", target)) {
/* Check if a compatible owl_attack() is cached. */
if (search_persistent_owl_cache(OWL_ATTACK, origin, 0, 0,
&result, NULL, kworm, NULL)) {
@@ -5019,7 +4993,7 @@ owl_does_defend(int move, int target, in
init_owl(&owl, target, NO_MOVE, move, 1);
prepare_goal_list(target, owl, owl_goal_worm, &goal_worms_computed,
kworm, 0);
- acode = do_owl_attack(target, NULL, &wid, owl, EMPTY, 0, 0);
+ acode = do_owl_attack(target, NULL, &wid, owl, 0);
finish_goal_list(&goal_worms_computed, &wpos, owl_goal_worm, wid);
result = REVERSE_RESULT(acode);
popgo();
@@ -5080,7 +5054,7 @@ owl_confirm_safety(int move, int target,
&result, defense_point, kworm, NULL))
return result;
- if (trymove(move, color, "owl_confirm_safety", target, EMPTY, NO_MOVE)) {
+ if (trymove(move, color, "owl_confirm_safety", target)) {
/* Check if a compatible owl_attack() is cached. */
if (search_persistent_owl_cache(OWL_ATTACK, origin, 0, 0,
&result, defense_point, kworm, NULL)) {
@@ -5096,7 +5070,7 @@ owl_confirm_safety(int move, int target,
init_owl(&owl, target, NO_MOVE, move, 1);
prepare_goal_list(target, owl, owl_goal_worm, &goal_worms_computed,
kworm, 0);
- acode = do_owl_attack(target, &defense, &wid, owl, EMPTY, NO_MOVE, 0);
+ acode = do_owl_attack(target, &defense, &wid, owl, 0);
finish_goal_list(&goal_worms_computed, &wpos, owl_goal_worm, wid);
if (acode == 0)
result = WIN;
@@ -5170,7 +5144,7 @@ owl_does_attack(int move, int target, in
init_owl(&owl, target, NO_MOVE, NO_MOVE, 1);
#endif
- if (trymove(move, other, "owl_does_attack", target, EMPTY, 0)) {
+ 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)) {
@@ -5195,7 +5169,7 @@ owl_does_attack(int move, int target, in
else {
prepare_goal_list(target, owl, owl_goal_worm, &goal_worms_computed,
kworm, 0);
- dcode = do_owl_defend(target, NULL, &wid, owl, EMPTY, 0, 0);
+ dcode = do_owl_defend(target, NULL, &wid, owl, 0);
finish_goal_list(&goal_worms_computed, &wpos, owl_goal_worm, wid);
}
result = REVERSE_RESULT(dcode);
@@ -5254,9 +5228,9 @@ owl_connection_defends(int move, int tar
init_owl(&owl, target1, target2, NO_MOVE, 1);
- if (trymove(move, color, "owl_connection_defends", target1, EMPTY, 0)) {
+ if (trymove(move, color, "owl_connection_defends", target1)) {
owl_update_goal(move, 1, owl, 0);
- if (!do_owl_attack(move, NULL, NULL, owl, EMPTY, 0, 0))
+ if (!do_owl_attack(move, NULL, NULL, owl, 0))
result = WIN;
owl->lunches_are_current = 0;
popgo();
@@ -5738,7 +5712,7 @@ owl_safe_move(int move, int color)
{
int acode, safe = 0;
- if (trymove(move, color, "owl_safe_move", 0, EMPTY, 0)) {
+ if (trymove(move, color, "owl_safe_move", 0)) {
acode = attack(move, NULL);
if (acode != WIN)
safe = 1;
@@ -5815,7 +5789,7 @@ owl_substantial(int str)
/* fill all the liberties */
for (k = 0; k < liberties; k++) {
- if (trymove(libs[k], owl->color, NULL, 0, EMPTY, 0)) {
+ if (trymove(libs[k], owl->color, NULL, 0)) {
if (level >= 8)
increase_depth_values();
owl->goal[libs[k]] = 1;
@@ -5823,7 +5797,7 @@ owl_substantial(int str)
else {
/* if we can't fill, try swapping with the next liberty */
if (k < liberties-1
- && trymove(libs[k+1], owl->color, NULL, 0, EMPTY, 0)) {
+ && trymove(libs[k+1], owl->color, NULL, 0)) {
if (level >= 8)
increase_depth_values();
owl->goal[libs[k+1]] = 1;
@@ -5847,7 +5821,7 @@ owl_substantial(int str)
owl_mark_boundary(owl);
owl->lunches_are_current = 0;
- if (do_owl_attack(libs[0], NULL, NULL, owl, EMPTY, 0, 0))
+ if (do_owl_attack(libs[0], NULL, NULL, owl, 0))
result = 0;
else
result = 1;
Index: engine/persistent.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/persistent.c,v
retrieving revision 1.21
diff -u -p -r1.21 persistent.c
--- engine/persistent.c 24 Jan 2004 04:04:56 -0000 1.21
+++ engine/persistent.c 10 Apr 2004 15:03:18 -0000
@@ -297,8 +297,7 @@ purge_persistent_reading_cache()
if (apos == 0)
break;
if (board[apos] == EMPTY
- && trymove(apos, color, "purge_persistent_reading_cache", 0,
- EMPTY, 0))
+ && trymove(apos, color, "purge_persistent_reading_cache", 0))
played_moves++;
else {
entry_ok = 0;
@@ -729,8 +728,7 @@ purge_persistent_connection_cache()
if (apos == 0)
break;
if (board[apos] == EMPTY
- && trymove(apos, color, "purge_persistent_connection_cache", 0,
- EMPTY, 0))
+ && trymove(apos, color, "purge_persistent_connection_cache", 0))
played_moves++;
else {
entry_ok = 0;
@@ -1079,8 +1077,7 @@ purge_persistent_breakin_cache()
if (apos == 0)
break;
if (board[apos] == EMPTY
- && trymove(apos, color, "purge_persistent_breakin_cache", 0,
- EMPTY, 0))
+ && trymove(apos, color, "purge_persistent_breakin_cache", 0))
played_moves++;
else {
entry_ok = 0;
Index: engine/readconnect.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/readconnect.c,v
retrieving revision 1.72
diff -u -p -r1.72 readconnect.c
--- engine/readconnect.c 6 Apr 2004 19:49:17 -0000 1.72
+++ engine/readconnect.c 10 Apr 2004 15:03:18 -0000
@@ -44,14 +44,14 @@ typedef struct _zone {
} zone;
static int recursive_connect2(int str1, int str2, int *move,
- int komaster, int kom_pos, int has_passed);
+ int has_passed);
static int recursive_disconnect2(int str1, int str2, int *move,
- int komaster, int kom_pos, int has_passed);
+ int has_passed);
static int recursive_break(int str, const char goal[BOARDMAX], int *move,
- int komaster, int kom_pos, int has_passed,
+ int has_passed,
Hash_data *goal_hash);
static int recursive_block(int str, const char goal[BOARDMAX], int *move,
- int komaster, int kom_pos, int has_passed,
+ int has_passed,
Hash_data *goal_hash);
static int add_array(int *array, int elt);
@@ -247,7 +247,7 @@ snapback(int str)
sgf_dumptree = NULL;
/* if only one liberty after capture */
- if (trymove(lib, OTHER_COLOR(board[str]), "snapback", str, EMPTY, 0)) {
+ if (trymove(lib, OTHER_COLOR(board[str]), "snapback", str)) {
liberties = 0;
if (IS_STONE(board[lib]))
liberties = countlib(lib);
@@ -441,7 +441,7 @@ connected_one_move(int str1, int str2)
res = WIN;
for (r = 1; ((r < moves[0] + 1) && res); r++) {
if (trymove(moves[r], OTHER_COLOR(board[str1]),
- "connected_one_move", str1, EMPTY, 0)) {
+ "connected_one_move", str1)) {
if (!connection_one_move(str1, str2))
res = 0;
popgo();
@@ -623,8 +623,7 @@ connection_two_moves(int str1, int str2)
sgf_dumptree = NULL;
for (r = 1; ((r < moves[0] + 1) && !res); r++) {
- if (trymove(moves[r], board[str1],
- "connection_two_moves", str1, EMPTY, 0)) {
+ if (trymove(moves[r], board[str1], "connection_two_moves", str1)) {
if (connected_one_move(str1, str2))
res = WIN;
popgo();
@@ -681,7 +680,7 @@ prevent_connection_two_moves(int *moves,
"prevent_connection_two_moves");
for (r = 1; r < possible_moves[0] + 1; r++) {
if (trymove(possible_moves[r], OTHER_COLOR(board[str1]),
- "prevent_connection_two_moves", str1, EMPTY, 0)) {
+ "prevent_connection_two_moves", str1)) {
if (!connection_one_move(str1, str2))
if (!connection_two_moves(str1, str2))
add_array(moves, possible_moves[r]);
@@ -922,7 +921,7 @@ simply_connected_two_moves(int str1, int
"simply_connected_two_moves");
for (r = 1; ((r < moves[0] + 1) && res); r++) {
if (trymove(moves[r], OTHER_COLOR(board[str1]),
- "simply_connected_two_moves", str1, EMPTY, 0)) {
+ "simply_connected_two_moves", str1)) {
if (!connection_one_move(str1, str2))
if (!connection_two_moves(str1, str2))
res = 0;
@@ -959,7 +958,7 @@ simple_connection_three_moves(int str1,
"simple_connection_three_moves");
for (r = 1; ((r < moves[0] + 1) && !res); r++) {
if (trymove(moves[r], board[str1],
- "simple_connection_three_moves", str1, EMPTY, 0)) {
+ "simple_connection_three_moves", str1)) {
if (simply_connected_two_moves(str1, str2))
res = WIN;
popgo();
@@ -1009,7 +1008,7 @@ prevent_simple_connection_three_moves(in
"prevent_simple_connection_three_moves");
for (r = 1; r < possible_moves[0] + 1; r++) {
if (trymove(possible_moves[r], OTHER_COLOR(board[str1]),
- "prevent_simple_connection_three_moves", str1, EMPTY, 0)) {
+ "prevent_simple_connection_three_moves", str1)) {
if (!connection_one_move(str1, str2))
if (!connection_two_moves(str1, str2))
if (!simple_connection_three_moves(str1, str2))
@@ -1135,7 +1134,7 @@ string_connect(int str1, int str2, int *
verbose--;
start = gg_cputime();
memset(connection_shadow, 0, sizeof(connection_shadow));
- result = recursive_connect2(str1, str2, move, EMPTY, NO_MOVE, 0);
+ result = recursive_connect2(str1, str2, move, 0);
verbose = save_verbose;
tactical_nodes = get_reading_node_counter() - reading_nodes_when_called;
@@ -1241,7 +1240,7 @@ recursive_connect(int str1, int str2, in
order_connection_moves(Moves, str1, str2, board[str1],
"recursive_connect");
for (i = 1; ((i < Moves[0] + 1) && (res == 0)); i++) {
- if (trymove(Moves[i], board[str1], "recursive_connect", str1, EMPTY, 0)) {
+ if (trymove(Moves[i], board[str1], "recursive_connect", str1)) {
if (!recursive_disconnect(str1, str2, move)) {
*move = Moves[i];
res = WIN;
@@ -1317,7 +1316,7 @@ disconnect(int str1, int str2, int *move
verbose--;
start = gg_cputime();
memset(connection_shadow, 0, sizeof(connection_shadow));
- result = recursive_disconnect2(str1, str2, move, EMPTY, NO_MOVE, 0);
+ result = recursive_disconnect2(str1, str2, move, 0);
verbose = save_verbose;
tactical_nodes = get_reading_node_counter() - reading_nodes_when_called;
@@ -1356,7 +1355,7 @@ disconnect(int str1, int str2, int *move
"disconnect");
for (i = 1; ((i < Moves[0] + 1) && (res == 0)); i++)
if (trymove(Moves[i], OTHER_COLOR(board[str1]),
- "disconnect", str1, EMPTY, 0)) {
+ "disconnect", str1)) {
if (!recursive_connect(str1, str2, move)) {
*move = Moves[i];
res = WIN;
@@ -1427,7 +1426,7 @@ recursive_disconnect(int str1, int str2,
"recursive_disconnect");
for (i = 1; ((i < Moves[0] + 1) && (res == 0)); i++)
if (trymove(Moves[i], OTHER_COLOR(board[str1]),
- "recursive_disconnect", str1, EMPTY, 0)) {
+ "recursive_disconnect", str1)) {
if (!recursive_connect(str1, str2, move)) {
*move = Moves[i];
res = WIN;
@@ -1587,8 +1586,7 @@ recursive_transitivity(int str1, int str
order_connection_moves(Moves, str1, str2, board[str1],
"recursive_transitivity");
for (i = 1; ((i < Moves[0] + 1) && (res == 0)); i++) {
- if (trymove(Moves[i], board[str1], "recursive_transitivity",
- str1, EMPTY, 0)) {
+ if (trymove(Moves[i], board[str1], "recursive_transitivity", str1)) {
if (!recursive_non_transitivity(str1, str2, str3, move)) {
*move = Moves[i];
res = WIN;
@@ -1638,7 +1636,7 @@ non_transitivity(int str1, int str2, int
"non_transitivity");
for (i = 1; ((i < Moves[0] + 1) && (res == 0)); i++)
if (trymove(Moves[i], OTHER_COLOR(board[str1]),
- "non_transitivity", str1, EMPTY, 0)) {
+ "non_transitivity", str1)) {
if (!recursive_transitivity(str1, str2, str3, move)) {
*move = Moves[i];
res = WIN;
@@ -1708,7 +1706,7 @@ recursive_non_transitivity(int str1, int
"recursive_non_transitivity");
for (i = 1; ((i < Moves[0] + 1) && (res == 0)); i++)
if (trymove(Moves[i], OTHER_COLOR(board[str1]),
- "recursive_non_transitivity", str1, EMPTY, 0)) {
+ "recursive_non_transitivity", str1)) {
if (!recursive_transitivity(str1, str2, str3, move)) {
*move = Moves[i];
res = WIN;
@@ -1912,9 +1910,8 @@ static int common_vulnerabilities(int a1
static int common_vulnerability(int apos, int bpos, int color);
/* Try to connect two strings. This function is called in a mutual
- * recursion with recursive_disconnect2(). Return codes and the
- * meaning of komaster and kom_pos is identical to the tactical
- * reading functions. For the has_passed parameter, see the
+ * recursion with recursive_disconnect2(). Return codes is identical to
+ * the tactical reading functions. For the has_passed parameter, see the
* documentation of recursive_disconnect2().
*
* The algorithm is
@@ -1927,8 +1924,7 @@ static int common_vulnerability(int apos
* distance was small and failure otherwise.
*/
static int
-recursive_connect2(int str1, int str2, int *move, int komaster, int kom_pos,
- int has_passed)
+recursive_connect2(int str1, int str2, int *move, int has_passed)
{
int color = board[str1];
int moves[MAX_MOVES];
@@ -1981,7 +1977,7 @@ recursive_connect2(int str1, int str2, i
if (stackp <= depth && (hashflags & HASH_CONNECT)
&& !has_passed
- && tt_get(&ttable, komaster, kom_pos, CONNECT, str1, str2,
+ && tt_get(&ttable, CONNECT, str1, str2,
depth - stackp, NULL,
&value, NULL, &xpos) == 2) {
/*TRACE_CACHED_RESULT2(*read_result);*/
@@ -1998,7 +1994,7 @@ recursive_connect2(int str1, int str2, i
if (stackp <= depth
&& (hashflags & HASH_CONNECT)
&& !has_passed) {
- found_read_result = get_read_result2(CONNECT, komaster, kom_pos,
+ found_read_result = get_read_result2(CONNECT,
&str1, &str2, &read_result);
if (found_read_result) {
TRACE_CACHED_RESULT2(*read_result);
@@ -2017,7 +2013,7 @@ recursive_connect2(int str1, int str2, i
if (trivial_connection(str1, str2, &xpos) == WIN) {
SGFTRACE2(xpos, WIN, "trivial connection");
#if USE_HASHTABLE_NG
- READ_RETURN_CONN_NG(komaster, kom_pos, CONNECT, str1, str2,
+ READ_RETURN_CONN_NG(CONNECT, str1, str2,
depth - stackp,
move, xpos, WIN);
#else
@@ -2029,25 +2025,21 @@ recursive_connect2(int str1, int str2, i
moves, &distance);
for (k = 0; k < num_moves; k++) {
- int new_komaster;
- int new_kom_pos;
int ko_move;
-
xpos = moves[k];
if (komaster_trymove(xpos, color, "recursive_connect2", str1,
- komaster, kom_pos, &new_komaster, &new_kom_pos,
&ko_move, stackp <= ko_depth && savecode == 0)) {
tried_moves++;
if (!ko_move) {
int acode = recursive_disconnect2(str1, str2, NULL,
- new_komaster, new_kom_pos,
+
has_passed);
popgo();
if (acode == 0) {
SGFTRACE2(xpos, WIN, "connection effective");
#if USE_HASHTABLE_NG
- READ_RETURN_CONN_NG(komaster, kom_pos, CONNECT, str1, str2,
+ READ_RETURN_CONN_NG(CONNECT, str1, str2,
depth - stackp,
move, xpos, WIN);
#else
@@ -2061,7 +2053,7 @@ recursive_connect2(int str1, int str2, i
}
else {
if (recursive_disconnect2(str1, str2, NULL,
- new_komaster, new_kom_pos,
+
has_passed) != WIN) {
savemove = xpos;
savecode = KO_B;
@@ -2074,7 +2066,7 @@ recursive_connect2(int str1, int str2, i
if (tried_moves == 0 && distance < 1.0) {
SGFTRACE2(NO_MOVE, WIN, "no move, probably connected");
#if USE_HASHTABLE_NG
- READ_RETURN_CONN_NG(komaster, kom_pos, CONNECT, str1, str2,
+ READ_RETURN_CONN_NG(CONNECT, str1, str2,
depth - stackp,
move, NO_MOVE, WIN);
#else
@@ -2085,7 +2077,7 @@ recursive_connect2(int str1, int str2, i
if (savecode != 0) {
SGFTRACE2(savemove, savecode, "saved move");
#if USE_HASHTABLE_NG
- READ_RETURN_CONN_NG(komaster, kom_pos, CONNECT, str1, str2,
+ READ_RETURN_CONN_NG(CONNECT, str1, str2,
depth - stackp,
move, savemove, savecode);
#else
@@ -2095,7 +2087,7 @@ recursive_connect2(int str1, int str2, i
SGFTRACE2(0, 0, NULL);
#if USE_HASHTABLE_NG
- READ_RETURN_CONN_NG(komaster, kom_pos, CONNECT, str1, str2,
+ READ_RETURN_CONN_NG(CONNECT, str1, str2,
depth - stackp,
move, NO_MOVE, 0);
#else
@@ -2105,9 +2097,8 @@ recursive_connect2(int str1, int str2, i
/* Try to disconnect two strings. This function is called in a mutual
- * recursion with recursive_connect2(). Return codes and the meaning
- * of komaster and kom_pos is identical to the tactical reading
- * functions.
+ * recursion with recursive_connect2(). Return codes is identical to
+ * the tactical reading functions.
*
* The algorithm is
* 1. Check if the strings are trivially connected or disconnected or
@@ -2122,8 +2113,7 @@ recursive_connect2(int str1, int str2, i
* been made is indicated by the has_passed parameter.
*/
static int
-recursive_disconnect2(int str1, int str2, int *move, int komaster, int kom_pos,
- int has_passed)
+recursive_disconnect2(int str1, int str2, int *move, int has_passed)
{
int color = board[str1];
int other = OTHER_COLOR(color);
@@ -2208,7 +2198,7 @@ recursive_disconnect2(int str1, int str2
#if USE_HASHTABLE_NG
if ((stackp <= depth) && (hashflags & HASH_DISCONNECT)
- && tt_get(&ttable, komaster, kom_pos, DISCONNECT, str1, str2,
+ && tt_get(&ttable, DISCONNECT, str1, str2,
depth - stackp, NULL,
&value, NULL, &xpos) == 2) {
/*TRACE_CACHED_RESULT2(*read_result);*/
@@ -2223,7 +2213,7 @@ recursive_disconnect2(int str1, int str2
#else
if ((stackp <= depth) && (hashflags & HASH_DISCONNECT)) {
- found_read_result = get_read_result2(DISCONNECT, komaster, kom_pos,
+ found_read_result = get_read_result2(DISCONNECT,
&str1, &str2, &read_result);
if (found_read_result) {
TRACE_CACHED_RESULT2(*read_result);
@@ -2242,7 +2232,7 @@ recursive_disconnect2(int str1, int str2
if (ladder_capture(str1, &xpos) == WIN) {
SGFTRACE2(xpos, WIN, "first string capturable");
#if USE_HASHTABLE_NG
- READ_RETURN_CONN_NG(komaster, kom_pos, DISCONNECT, str1, str2,
+ READ_RETURN_CONN_NG(DISCONNECT, str1, str2,
depth - stackp,
move, xpos, WIN);
#else
@@ -2253,7 +2243,7 @@ recursive_disconnect2(int str1, int str2
if (ladder_capture(str2, &xpos) == WIN) {
SGFTRACE2(xpos, WIN, "second string capturable");
#if USE_HASHTABLE_NG
- READ_RETURN_CONN_NG(komaster, kom_pos, DISCONNECT, str1, str2,
+ READ_RETURN_CONN_NG(DISCONNECT, str1, str2,
depth - stackp,
move, xpos, WIN);
#else
@@ -2285,24 +2275,20 @@ recursive_disconnect2(int str1, int str2
}
for (k = 0; k < num_moves; k++) {
- int new_komaster;
- int new_kom_pos;
int ko_move;
-
xpos = moves[k];
if (komaster_trymove(xpos, other, "recursive_disconnect2", str1,
- komaster, kom_pos, &new_komaster, &new_kom_pos,
&ko_move, stackp <= ko_depth && savecode == 0)) {
tried_moves++;
if (!ko_move) {
int dcode = recursive_connect2(str1, str2, NULL,
- new_komaster, new_kom_pos, has_passed);
+ has_passed);
popgo();
if (dcode == 0) {
SGFTRACE2(xpos, WIN, "disconnection effective");
#if USE_HASHTABLE_NG
- READ_RETURN_CONN_NG(komaster, kom_pos, DISCONNECT, str1, str2,
+ READ_RETURN_CONN_NG(DISCONNECT, str1, str2,
depth - stackp,
move, xpos, WIN);
#else
@@ -2316,7 +2302,7 @@ recursive_disconnect2(int str1, int str2
}
else {
if (recursive_connect2(str1, str2, NULL,
- new_komaster, new_kom_pos,
+
has_passed) != WIN) {
savemove = xpos;
savecode = KO_B;
@@ -2329,10 +2315,10 @@ recursive_disconnect2(int str1, int str2
if (tried_moves == 0
&& distance >= 1.0
&& (has_passed
- || !recursive_connect2(str1, str2, NULL, komaster, kom_pos, 1))) {
+ || !recursive_connect2(str1, str2, NULL, 1))) {
SGFTRACE2(NO_MOVE, WIN, "no move, probably disconnected");
#if USE_HASHTABLE_NG
- READ_RETURN_CONN_NG(komaster, kom_pos, DISCONNECT, str1, str2,
+ READ_RETURN_CONN_NG(DISCONNECT, str1, str2,
depth - stackp,
move, NO_MOVE, WIN);
#else
@@ -2343,7 +2329,7 @@ recursive_disconnect2(int str1, int str2
if (savecode != 0) {
SGFTRACE2(savemove, savecode, "saved move");
#if USE_HASHTABLE_NG
- READ_RETURN_CONN_NG(komaster, kom_pos, DISCONNECT, str1, str2,
+ READ_RETURN_CONN_NG(DISCONNECT, str1, str2,
depth - stackp,
move, savemove, savecode);
#else
@@ -2353,7 +2339,7 @@ recursive_disconnect2(int str1, int str2
SGFTRACE2(0, 0, NULL);
#if USE_HASHTABLE_NG
- READ_RETURN_CONN_NG(komaster, kom_pos, DISCONNECT, str1, str2,
+ READ_RETURN_CONN_NG(DISCONNECT, str1, str2,
depth - stackp,
move, NO_MOVE, 0);
#else
@@ -2886,7 +2872,7 @@ find_break_moves(int str, const char goa
/* Can (str) connect to goal[] if the other color moves first? */
static int
recursive_break(int str, const char goal[BOARDMAX], int *move,
- int komaster, int kom_pos, int has_passed,
+ int has_passed,
Hash_data *goal_hash)
{
int color = board[str];
@@ -2936,7 +2922,7 @@ recursive_break(int str, const char goal
if (stackp <= depth
&& (hashflags & HASH_BREAK_IN)
&& !has_passed
- && tt_get(&ttable, komaster, kom_pos, BREAK_IN, str, NO_MOVE,
+ && tt_get(&ttable, BREAK_IN, str, NO_MOVE,
depth - stackp, goal_hash,
&retval, NULL, &xpos) == 2) {
/* FIXME: Use move for move ordering if tt_get() returned 1 */
@@ -2950,7 +2936,7 @@ recursive_break(int str, const char goal
&& (hashflags & HASH_BREAK_IN)
&& !has_passed) {
found_read_result
- = get_read_result_hash_modified(BREAK_IN, komaster, kom_pos,
+ = get_read_result_hash_modified(BREAK_IN,
&str, goal_hash, &read_result);
if (found_read_result) {
TRACE_CACHED_RESULT(*read_result);
@@ -2975,25 +2961,21 @@ recursive_break(int str, const char goal
num_moves = find_break_moves(str, goal, color, moves, &distance);
for (k = 0; k < num_moves; k++) {
- int new_komaster;
- int new_kom_pos;
int ko_move;
-
xpos = moves[k];
if (komaster_trymove(xpos, color, "recursive_break", str,
- komaster, kom_pos, &new_komaster, &new_kom_pos,
&ko_move, stackp <= ko_depth && savecode == 0)) {
tried_moves++;
if (!ko_move) {
int acode = recursive_block(str, goal, NULL,
- new_komaster, new_kom_pos,
+
has_passed, goal_hash);
popgo();
if (acode == 0) {
SGFTRACE(xpos, WIN, "break effective");
#if USE_HASHTABLE_NG
- READ_RETURN_HASH_NG(komaster, kom_pos, BREAK_IN, str, depth - stackp,
+ READ_RETURN_HASH_NG(BREAK_IN, str, depth - stackp,
goal_hash, move, xpos, WIN);
#else
READ_RETURN(read_result, move, xpos, WIN);
@@ -3005,7 +2987,7 @@ recursive_break(int str, const char goal
UPDATE_SAVED_KO_RESULT(savecode, savemove, acode, xpos);
}
else {
- if (recursive_block(str, goal, NULL, new_komaster, new_kom_pos,
+ if (recursive_block(str, goal, NULL,
has_passed, goal_hash) != WIN) {
savemove = xpos;
savecode = KO_B;
@@ -3018,7 +3000,7 @@ recursive_break(int str, const char goal
if (tried_moves == 0 && distance < 1.0) {
SGFTRACE(NO_MOVE, WIN, "no move, probably connected");
#if USE_HASHTABLE_NG
- READ_RETURN_HASH_NG(komaster, kom_pos, BREAK_IN, str, depth - stackp,
+ READ_RETURN_HASH_NG(BREAK_IN, str, depth - stackp,
goal_hash, move, xpos, WIN);
#else
READ_RETURN(read_result, move, NO_MOVE, WIN);
@@ -3028,7 +3010,7 @@ recursive_break(int str, const char goal
if (savecode != 0) {
SGFTRACE(savemove, savecode, "saved move");
#if USE_HASHTABLE_NG
- READ_RETURN_HASH_NG(komaster, kom_pos, BREAK_IN, str, depth - stackp,
+ READ_RETURN_HASH_NG(BREAK_IN, str, depth - stackp,
goal_hash, move, xpos, savecode);
#else
READ_RETURN(read_result, move, savemove, savecode);
@@ -3037,7 +3019,7 @@ recursive_break(int str, const char goal
SGFTRACE(0, 0, NULL);
#if USE_HASHTABLE_NG
- READ_RETURN_HASH_NG(komaster, kom_pos, BREAK_IN, str, depth - stackp,
+ READ_RETURN_HASH_NG(BREAK_IN, str, depth - stackp,
goal_hash, move, xpos, 0);
#else
READ_RETURN(read_result, move, NO_MOVE, 0);
@@ -3048,7 +3030,7 @@ recursive_break(int str, const char goal
/* Can (str) connect to goal[] if the other color moves first? */
static int
recursive_block(int str, const char goal[BOARDMAX], int *move,
- int komaster, int kom_pos, int has_passed,
+ int has_passed,
Hash_data *goal_hash)
{
int color = board[str];
@@ -3101,7 +3083,7 @@ recursive_block(int str, const char goal
str = find_origin(str);
if ((stackp <= depth)
&& (hashflags & HASH_BLOCK_OFF)
- && (tt_get(&ttable, komaster, kom_pos, BLOCK_OFF, str, NO_MOVE,
+ && (tt_get(&ttable, BLOCK_OFF, str, NO_MOVE,
depth - stackp, goal_hash, &retval, NULL, &xpos) == 2)) {
SGFTRACE(xpos, retval, "cached");
if (move)
@@ -3111,7 +3093,7 @@ recursive_block(int str, const char goal
#else
if ((stackp <= depth) && (hashflags & HASH_BLOCK_OFF)) {
found_read_result
- = get_read_result_hash_modified(BLOCK_OFF, komaster, kom_pos,
+ = get_read_result_hash_modified(BLOCK_OFF,
&str, goal_hash, &read_result);
if (found_read_result) {
TRACE_CACHED_RESULT(*read_result);
@@ -3129,7 +3111,7 @@ recursive_block(int str, const char goal
if (ladder_capture(str, &xpos) == WIN) {
SGFTRACE(xpos, WIN, "string capturable");
#if USE_HASHTABLE_NG
- READ_RETURN_HASH_NG(komaster, kom_pos, BLOCK_OFF, str, depth - stackp,
+ READ_RETURN_HASH_NG(BLOCK_OFF, str, depth - stackp,
goal_hash, move, xpos, WIN);
#else
READ_RETURN(read_result, move, xpos, WIN);
@@ -3139,25 +3121,21 @@ recursive_block(int str, const char goal
num_moves = find_break_moves(str, goal, other, moves, &distance);
for (k = 0; k < num_moves; k++) {
- int new_komaster;
- int new_kom_pos;
int ko_move;
-
xpos = moves[k];
if (komaster_trymove(xpos, other, "recursive_block", str,
- komaster, kom_pos, &new_komaster, &new_kom_pos,
&ko_move, stackp <= ko_depth && savecode == 0)) {
tried_moves++;
if (!ko_move) {
int dcode = recursive_break(str, goal, NULL,
- new_komaster, new_kom_pos, has_passed,
+ has_passed,
goal_hash);
popgo();
if (dcode == 0) {
SGFTRACE(xpos, WIN, "block effective");
#if USE_HASHTABLE_NG
- READ_RETURN_HASH_NG(komaster, kom_pos, BLOCK_OFF, str,
+ READ_RETURN_HASH_NG(BLOCK_OFF, str,
depth - stackp, goal_hash, move, xpos, WIN);
#else
READ_RETURN(read_result, move, xpos, WIN);
@@ -3169,7 +3147,7 @@ recursive_block(int str, const char goal
UPDATE_SAVED_KO_RESULT(savecode, savemove, dcode, xpos);
}
else {
- if (recursive_break(str, goal, NULL, new_komaster, new_kom_pos,
+ if (recursive_break(str, goal, NULL,
has_passed, goal_hash) != WIN) {
savemove = xpos;
savecode = KO_B;
@@ -3182,11 +3160,11 @@ recursive_block(int str, const char goal
if (tried_moves == 0
&& distance >= 1.0
&& (has_passed
- || !recursive_break(str, goal, NULL, komaster, kom_pos, 1,
+ || !recursive_break(str, goal, NULL, 1,
goal_hash))) {
SGFTRACE(NO_MOVE, WIN, "no move, probably disconnected");
#if USE_HASHTABLE_NG
- READ_RETURN_HASH_NG(komaster, kom_pos, BLOCK_OFF, str,
+ READ_RETURN_HASH_NG(BLOCK_OFF, str,
depth - stackp, goal_hash, move, NO_MOVE, WIN);
#else
READ_RETURN(read_result, move, NO_MOVE, WIN);
@@ -3196,7 +3174,7 @@ recursive_block(int str, const char goal
if (savecode != 0) {
SGFTRACE(savemove, savecode, "saved move");
#if USE_HASHTABLE_NG
- READ_RETURN_HASH_NG(komaster, kom_pos, BLOCK_OFF, str,
+ READ_RETURN_HASH_NG(BLOCK_OFF, str,
depth - stackp, goal_hash, move, savemove, savecode);
#else
READ_RETURN(read_result, move, savemove, savecode);
@@ -3205,7 +3183,7 @@ recursive_block(int str, const char goal
SGFTRACE(0, 0, NULL);
#if USE_HASHTABLE_NG
- READ_RETURN_HASH_NG(komaster, kom_pos, BLOCK_OFF, str,
+ READ_RETURN_HASH_NG(BLOCK_OFF, str,
depth - stackp, goal_hash, move, NO_MOVE, 0);
#else
READ_RETURN(read_result, move, NO_MOVE, 0);
@@ -3254,7 +3232,7 @@ break_in(int str, const char goal[BOARDM
verbose--;
start = gg_cputime();
memcpy(breakin_shadow, goal, sizeof(breakin_shadow));
- result = recursive_break(str, goal, move, EMPTY, NO_MOVE, 0, &goal_hash);
+ result = recursive_break(str, goal, move, 0, &goal_hash);
verbose = save_verbose;
tactical_nodes = get_reading_node_counter() - reading_nodes_when_called;
if (debug & DEBUG_BREAKIN) {
@@ -3313,8 +3291,7 @@ block_off(int str, const char goal[BOARD
verbose--;
start = gg_cputime();
memcpy(breakin_shadow, goal, sizeof(breakin_shadow));
- result = recursive_block(str, goal, move, EMPTY, NO_MOVE, 0,
- &goal_hash);
+ result = recursive_block(str, goal, move, 0, &goal_hash);
verbose = save_verbose;
tactical_nodes = get_reading_node_counter() - reading_nodes_when_called;
@@ -3709,8 +3686,7 @@ spread_connection_distances(int color, s
if (board[lib + delta[i]] == EMPTY
&& lib + delta[i] != apos
&& trymove(lib + delta[i], other,
- "compute_connection_distances", pos,
- EMPTY, NO_MOVE)) {
+ "compute_connection_distances", pos)) {
if (ladder_capture(pos, NULL)) {
vulnerable2 = lib + delta[i];
popgo();
@@ -4268,7 +4244,7 @@ does_secure_through_ladder(int color, in
{
int result = 0;
- if (trymove(move, color, NULL, NO_MOVE, EMPTY, NO_MOVE)) {
+ if (trymove(move, color, NULL, NO_MOVE)) {
if (ladder_capturable(pos, OTHER_COLOR(color)))
result = 1;
popgo();
@@ -4315,7 +4291,7 @@ ladder_capturable(int pos, int color)
{
int result = 0;
- if (trymove(pos, color, NULL, NO_MOVE, EMPTY, NO_MOVE)) {
+ if (trymove(pos, color, NULL, NO_MOVE)) {
int liberties = countlib(pos);
if (liberties == 1 && attack(pos, NULL) == WIN)
result = 1;
Index: engine/reading.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/reading.c,v
retrieving revision 1.138
diff -u -p -r1.138 reading.c
--- engine/reading.c 5 Feb 2004 22:54:42 -0000 1.138
+++ engine/reading.c 10 Apr 2004 15:03:18 -0000
@@ -57,9 +57,9 @@ int defend_by_pattern = 0;
int attack_by_pattern = 1;
static int do_tactical_pat(int is_attack, int str, int *move,
- int komaster, int kom_pos);
-static int do_defend_pat(int str, int *move, int komaster, int kom_pos);
-static int do_attack_pat(int str, int *move, int komaster, int kom_pos);
+ int kom_pos);
+static int do_defend_pat(int str, int *move);
+static int do_attack_pat(int str, int *move);
#endif
@@ -148,17 +148,12 @@ static int do_attack_pat(int str, int *m
int k; \
\
for (k = moves.num_tried; k < moves.num; k++) { \
- int new_komaster;
\
- int new_kom_pos; \
int ko_move; \
int dpos = moves.pos[k]; \
\
- if (komaster_trymove(dpos, color, moves.message[k], str, \
- komaster, kom_pos, \
- &new_komaster, &new_kom_pos, &ko_move, \
+ if (komaster_trymove(dpos, color, moves.message[k], str, &ko_move,\
stackp <= ko_depth && savecode == 0)) { \
- int acode = do_attack(str, (attack_hint), \
- new_komaster, new_kom_pos); \
+ int acode = do_attack(str, (attack_hint)); \
popgo(); \
\
if (!ko_move) { \
@@ -190,20 +185,15 @@ static int do_attack_pat(int str, int *m
int k; \
\
for (k = moves.num_tried; k < moves.num; k++) { \
- int new_komaster;
\
- int new_kom_pos; \
int ko_move; \
int apos = moves.pos[k]; \
\
- if (komaster_trymove(apos, other, moves.message[k], str, \
- komaster, kom_pos, \
- &new_komaster, &new_kom_pos, &ko_move, \
+ if (komaster_trymove(apos, other, moves.message[k], str,&ko_move,
\
stackp <= ko_depth && savecode == 0)) { \
- int dcode = do_find_defense(str, (defense_hint), \
- new_komaster, new_kom_pos); \
+ int dcode = do_find_defense(str, (defense_hint)); \
\
if (REVERSE_RESULT(dcode) > savecode \
- && do_attack(str, NULL, new_komaster, new_kom_pos)) { \
+ && do_attack(str, NULL)) { \
if (!ko_move) { \
if (dcode == 0) { \
popgo(); \
@@ -250,11 +240,11 @@ struct reading_moves
* set NULL in which case these values are not returned.
*/
-static int do_find_defense(int str, int *move, int komaster, int kom_pos);
-static int defend1(int str, int *move, int komaster, int kom_pos);
-static int defend2(int str, int *move, int komaster, int kom_pos);
-static int defend3(int str, int *move, int komaster, int kom_pos);
-static int defend4(int str, int *move, int komaster, int kom_pos);
+static int do_find_defense(int str, int *move);
+static int defend1(int str, int *move);
+static int defend2(int str, int *move);
+static int defend3(int str, int *move);
+static int defend4(int str, int *move);
static void special_rescue_moves(int str, int lib,
struct reading_moves *moves);
static void bamboo_rescue_moves(int str, int num_libs, int libs[],
@@ -272,11 +262,11 @@ static void special_rescue6_moves(int st
static void set_up_snapback_moves(int str, int lib,
struct reading_moves *moves);
static void edge_clamp_moves(int str, struct reading_moves *moves);
-static int do_attack(int str, int *move, int komaster, int kom_pos);
-static int attack1(int str, int *move, int komaster, int kom_pos);
-static int attack2(int str, int *move, int komaster, int kom_pos);
-static int attack3(int str, int *move, int komaster, int kom_pos);
-static int attack4(int str, int *move, int komaster, int kom_pos);
+static int do_attack(int str, int *move);
+static int attack1(int str, int *move);
+static int attack2(int str, int *move);
+static int attack3(int str, int *move);
+static int attack4(int str, int *move);
static void find_cap_moves(int str, struct reading_moves *moves);
static void special_attack2_moves(int str, int libs[2],
struct reading_moves *moves);
@@ -314,8 +304,7 @@ static void double_atari_chain2_moves(in
struct reading_moves *moves);
static void order_moves(int str, struct reading_moves *moves,
int color, const char *funcname, int killer);
-static int simple_ladder_attack(int str, int *move, int komaster, int kom_pos);
-static int simple_ladder_defend(int str, int *move, int komaster, int kom_pos);
+static int simple_ladder_defend(int str, int *move);
static int in_list(int move, int num_moves, int *moves);
@@ -380,7 +369,7 @@ attack(int str, int *move)
}
memset(shadow, 0, sizeof(shadow));
- result = do_attack(str, &the_move, EMPTY, 0);
+ result = do_attack(str, &the_move);
nodes = reading_node_counter - nodes_when_called;
if (debug & DEBUG_READING_PERFORMANCE) {
@@ -449,7 +438,7 @@ find_defense(int str, int *move)
}
memset(shadow, 0, sizeof(shadow));
- result = do_find_defense(str, &the_move, EMPTY, 0);
+ result = do_find_defense(str, &the_move);
nodes = reading_node_counter - nodes_when_called;
if (debug & DEBUG_READING_PERFORMANCE) {
@@ -598,14 +587,12 @@ attack_either(int astr, int bstr)
* has only 2, and try each atari in turn.
*/
if (alib == 2) {
- if (trymove(alibs[0], other, "attack_either-A", astr,
- EMPTY, NO_MOVE)) {
+ if (trymove(alibs[0], other, "attack_either-A", astr)) {
defended0 = defend_both(astr, bstr);
popgo();
}
if (defended0
- && trymove(alibs[1], other, "attack_either-B", astr,
- EMPTY, NO_MOVE)) {
+ && trymove(alibs[1], other, "attack_either-B", astr)) {
defended1 = defend_both(astr, bstr);
popgo();
}
@@ -626,16 +613,14 @@ attack_either(int astr, int bstr)
alibs[1] = NO_MOVE;
if (blibs[0] != alibs[0] && blibs[0] != alibs[1]
- && trymove(blibs[0], other, "attack_either-C", bstr,
- EMPTY, NO_MOVE)) {
+ && trymove(blibs[0], other, "attack_either-C", bstr)) {
int defended = defend_both(astr, bstr);
defended0 = gg_min(defended0, defended);
popgo();
}
if (defended0
&& blibs[1] != alibs[0] && blibs[1] != alibs[1]
- && trymove(blibs[1], other, "attack_either-D", bstr,
- EMPTY, NO_MOVE)) {
+ && trymove(blibs[1], other, "attack_either-D", bstr)) {
int defended = defend_both(astr, bstr);
defended1 = gg_min(defended1, defended);
popgo();
@@ -718,7 +703,7 @@ defend_both(int astr, int bstr)
* somewhat pessimistic estimation.
*/
- if (trymove(a_savepos, color, "defend_both-A", astr, EMPTY, NO_MOVE)) {
+ if (trymove(a_savepos, color, "defend_both-A", astr)) {
if (board[bstr] && !attack(bstr, NULL)) {
popgo();
return WIN;
@@ -726,7 +711,7 @@ defend_both(int astr, int bstr)
popgo();
}
- if (trymove(b_savepos, color, "defend_both-B", bstr, EMPTY, NO_MOVE)) {
+ if (trymove(b_savepos, color, "defend_both-B", bstr)) {
if (board[astr] && !attack(astr, NULL)) {
popgo();
return WIN;
@@ -762,7 +747,7 @@ defend_both(int astr, int bstr)
continue; /* No, it wasn't. */
if (attack(epos, &fpos)) {
- if (trymove(fpos, color, "defend_both-C", astr, EMPTY, NO_MOVE)) {
+ if (trymove(fpos, color, "defend_both-C", astr)) {
if (board[astr] && board[bstr]
&& !attack(astr, NULL)
&& !attack(bstr, NULL)) {
@@ -867,11 +852,11 @@ break_through(int apos, int bpos, int cp
*/
success2 = 0;
if (attack_and_defend(Fpos, NULL, NULL, NULL, &gpos)) {
- if (trymove(gpos, other, "break_through-A", Fpos, EMPTY, NO_MOVE)) {
+ if (trymove(gpos, other, "break_through-A", Fpos)) {
/* Now we let O defend his position by playing either d or e.
* FIXME: There may be other plausible moves too.
*/
- if (trymove(dpos, color, "break_through-B", Fpos, EMPTY, NO_MOVE)) {
+ if (trymove(dpos, color, "break_through-B", Fpos)) {
/* O connects at d, so X cuts at e. */
if (safe_move(epos, other)) {
success2 = CUT;
@@ -881,8 +866,7 @@ break_through(int apos, int bpos, int cp
popgo();
}
- if (success2 > 0 && trymove(epos, color, "break_through-C", Fpos,
- EMPTY, NO_MOVE)) {
+ if (success2 > 0 && trymove(epos, color, "break_through-C", Fpos)) {
/* O connects at e, so X cuts at d. */
if (safe_move(dpos, other)) {
/* success2 is already WIN or CUT. */
@@ -915,7 +899,7 @@ break_through_helper(int apos, int bpos,
int success = 0;
int gpos;
- if (trymove(dpos, other, "break_through_helper-A", Fpos, EMPTY, NO_MOVE)) {
+ if (trymove(dpos, other, "break_through_helper-A", Fpos)) {
/* If F can be attacked we can't start in this way. */
if (!attack(Fpos, NULL)) {
/* If d is safe too, we have at least managed to break through. */
@@ -927,8 +911,7 @@ break_through_helper(int apos, int bpos,
* O at e is sufficient to capture d.
*/
else {
- if (trymove(epos, color, "break_through_helper-E", Fpos,
- EMPTY, NO_MOVE)) {
+ if (trymove(epos, color, "break_through_helper-E", Fpos)) {
if (!board[dpos] || !find_defense(dpos, NULL)) {
popgo();
popgo();
@@ -942,10 +925,8 @@ break_through_helper(int apos, int bpos,
return 0;
}
- if (trymove(gpos, color, "break_through_helper-F", Fpos,
- EMPTY, NO_MOVE)) {
- if (trymove(epos, other, "break_through_helper-G", Fpos,
- EMPTY, NO_MOVE)) {
+ if (trymove(gpos, color, "break_through_helper-F", Fpos)) {
+ if (trymove(epos, other, "break_through_helper-G", Fpos)) {
if (!attack(epos, NULL)) {
success = CUT;
/* Make sure b and c are safe. If not, back up & let O try
@@ -991,8 +972,7 @@ break_through_helper(int apos, int bpos,
int attack_on_b = 0;
int attack_on_a = 0;
- if (trymove(epos, color, "break_through_helper-B", Fpos,
- EMPTY, NO_MOVE)) {
+ if (trymove(epos, color, "break_through_helper-B", Fpos)) {
if (attack(bpos, NULL))
attack_on_b = 1;
else if (attack(apos, NULL))
@@ -1007,13 +987,11 @@ break_through_helper(int apos, int bpos,
if (((attack_on_a && find_defense(apos, &hpos))
|| (attack_on_b && find_defense(bpos, &hpos)))
&& hpos != NO_MOVE
- && trymove(hpos, color, "break_through_helper-C", Fpos,
- EMPTY, NO_MOVE)) {
+ && trymove(hpos, color, "break_through_helper-C", Fpos)) {
/* Now we make a second cut at e, trying to capture
* either b or c.
*/
- if (trymove(epos, other, "break_through_helper-D", Fpos,
- EMPTY, NO_MOVE)) {
+ if (trymove(epos, other, "break_through_helper-D", Fpos)) {
if (!board[bpos]
|| !board[cpos]
|| !defend_both(bpos, cpos))
@@ -1087,7 +1065,7 @@ attack_threats(int str, int max_points,
int aa = libs[k];
/* Try to threaten on the liberty. */
- if (trymove(aa, other, "attack_threats-A", str, EMPTY, NO_MOVE)) {
+ if (trymove(aa, other, "attack_threats-A", str)) {
int acode = attack(str, NULL);
if (acode != 0)
movelist_change_point(aa, acode, max_points, moves, codes);
@@ -1103,7 +1081,7 @@ attack_threats(int str, int max_points,
|| liberty_of_string(bb, str))
continue;
- if (trymove(bb, other, "attack_threats-B", str, EMPTY, NO_MOVE)) {
+ if (trymove(bb, other, "attack_threats-B", str)) {
int acode = attack(str, NULL);
if (acode != 0)
movelist_change_point(bb, acode, max_points, moves, codes);
@@ -1146,7 +1124,7 @@ attack_threats(int str, int max_points,
}
/* Test the move and see if it is a threat. */
- if (trymove(bb, other, "attack_threats-C", str, EMPTY, NO_MOVE)) {
+ if (trymove(bb, other, "attack_threats-C", str)) {
if (board[str] == EMPTY)
acode = WIN;
else
@@ -1174,12 +1152,12 @@ attack_threats(int str, int max_points,
/* Like find_defense, but takes the komaster argument. If the
- * opponent is komaster, reading functions will not try
+ * opponent is reading functions will not try
* to take ko.
*/
static int
-do_find_defense(int str, int *move, int komaster, int kom_pos)
+do_find_defense(int str, int *move)
{
int xpos = NO_MOVE;
int dcode = 0;
@@ -1223,7 +1201,7 @@ do_find_defense(int str, int *move, int
#if USE_HASHTABLE_NG
if ((stackp <= depth) && (hashflags & HASH_FIND_DEFENSE)
- && tt_get(&ttable, komaster, kom_pos, FIND_DEFENSE, str, NO_MOVE,
+ && tt_get(&ttable, FIND_DEFENSE, str, NO_MOVE,
depth - stackp, NULL,
&retval, NULL, &xpos) == 2) {
/* Note that if return value is 1 (too small depth), the move will
@@ -1238,7 +1216,7 @@ do_find_defense(int str, int *move, int
#else
if ((stackp <= depth) && (hashflags & HASH_FIND_DEFENSE)) {
- found_read_result = get_read_result(FIND_DEFENSE, komaster, kom_pos,
+ found_read_result = get_read_result(FIND_DEFENSE,
&str, &read_result);
if (found_read_result) {
TRACE_CACHED_RESULT(*read_result);
@@ -1256,24 +1234,24 @@ do_find_defense(int str, int *move, int
#if EXPERIMENTAL_READING
if (defend_by_pattern) {
- dcode = do_defend_pat(str, &xpos, komaster, kom_pos);
+ dcode = do_defend_pat(str, &xpos);
/* We set liberties to 0 to pass over the non-pattern code below. */
liberties = 0;
}
#endif
if (liberties == 1)
- dcode = defend1(str, &xpos, komaster, kom_pos);
+ dcode = defend1(str, &xpos);
else if (liberties == 2)
- dcode = defend2(str, &xpos, komaster, kom_pos);
+ dcode = defend2(str, &xpos);
else if (liberties == 3)
- dcode = defend3(str, &xpos, komaster, kom_pos);
+ dcode = defend3(str, &xpos);
else if (liberties == 4)
- dcode = defend4(str, &xpos, komaster, kom_pos);
+ dcode = defend4(str, &xpos);
if (dcode) {
#if USE_HASHTABLE_NG
- READ_RETURN_NG(komaster, kom_pos, FIND_DEFENSE, str, depth - stackp,
+ READ_RETURN_NG(FIND_DEFENSE, str, depth - stackp,
move, xpos, dcode);
#else
READ_RETURN(read_result, move, xpos, dcode);
@@ -1281,7 +1259,7 @@ do_find_defense(int str, int *move, int
}
#if USE_HASHTABLE_NG
- READ_RETURN0_NG(komaster, kom_pos, FIND_DEFENSE, str, depth - stackp);
+ READ_RETURN0_NG(FIND_DEFENSE, str, depth - stackp);
#else
READ_RETURN0(read_result);
#endif
@@ -1332,7 +1310,7 @@ fast_defense(int str, int liberties, int
* */
static int
-defend1(int str, int *move, int komaster, int kom_pos)
+defend1(int str, int *move)
{
int color = board[str];
int other = OTHER_COLOR(color);
@@ -1389,8 +1367,8 @@ defend1(int str, int *move, int komaster
for (k = 0; k < liberties; k++) {
int apos = libs2[k];
if ((liberties == 1 || !is_self_atari(apos, other))
- && trymove(apos, color, "defend1-C", str, komaster, kom_pos)) {
- int acode = do_attack(str, NULL, komaster, kom_pos);
+ && trymove(apos, color, "defend1-C", str)) {
+ int acode = do_attack(str, NULL);
popgo();
CHECK_RESULT(savecode, savemove, acode, apos, move, "backfilling");
}
@@ -1415,7 +1393,7 @@ defend1(int str, int *move, int komaster
*/
static int
-defend2(int str, int *move, int komaster, int kom_pos)
+defend2(int str, int *move)
{
int color, other;
int xpos = NO_MOVE;
@@ -1554,7 +1532,7 @@ defend2(int str, int *move, int komaster
*/
static int
-defend3(int str, int *move, int komaster, int kom_pos)
+defend3(int str, int *move)
{
int color, other;
int xpos = NO_MOVE;
@@ -1626,7 +1604,7 @@ defend3(int str, int *move, int komaster
if (s < moves.num)
continue;
- if (trymove(xpos, color, "defend3-D", str, komaster, kom_pos)) {
+ if (trymove(xpos, color, "defend3-D", str)) {
int acode;
/* If the newly placed stone is in atari, we give up
* without fight.
@@ -1634,7 +1612,7 @@ defend3(int str, int *move, int komaster
if (countlib(xpos) == 1)
acode = WIN;
else
- acode = do_attack(str, NULL, komaster, kom_pos);
+ acode = do_attack(str, NULL);
popgo();
CHECK_RESULT(savecode, savemove, acode, xpos, move,
@@ -1655,8 +1633,8 @@ defend3(int str, int *move, int komaster
continue;
if (!is_self_atari(xpos, color)
- && trymove(xpos, color, "defend2-G", str, komaster, kom_pos)) {
- int acode = do_attack(str, NULL, komaster, kom_pos);
+ && trymove(xpos, color, "defend2-G", str)) {
+ int acode = do_attack(str, NULL);
popgo();
CHECK_RESULT(savecode, savemove, acode, xpos, move
"backfill effective");
@@ -1718,7 +1696,7 @@ defend3(int str, int *move, int komaster
*/
static int
-defend4(int str, int *move, int komaster, int kom_pos)
+defend4(int str, int *move)
{
int color, other;
int xpos = NO_MOVE;
@@ -2744,20 +2722,20 @@ set_larger_goal_worm(int str, char goal[
}
static int
-do_attack_pat(int str, int *move, int komaster, int kom_pos)
+do_attack_pat(int str, int *move)
{
- return do_tactical_pat(1, str, move, komaster, kom_pos);
+ return do_tactical_pat(1, str, move);
}
static int
-do_defend_pat(int str, int *move, int komaster, int kom_pos)
+do_defend_pat(int str, int *move)
{
- return do_tactical_pat(0, str, move, komaster, kom_pos);
+ return do_tactical_pat(0, str, move);
}
static int
-do_tactical_pat(int is_attack, int str, int *move, int komaster, int kom_pos)
+do_tactical_pat(int is_attack, int str, int *move)
{
char goal[BOARDMAX];
struct reading_move_data moves[MAX_READING_MOVES];
@@ -2766,8 +2744,6 @@ do_tactical_pat(int is_attack, int str,
int next_color = is_attack ? OTHER_COLOR(color) : color;
int best_other_tactic = WIN;
int best_move = 0;
- int new_komaster = 0;
- int new_kom_pos = 0;
int ko_move = 0;
int libs;
int skipped = 0;
@@ -2793,16 +2769,16 @@ do_tactical_pat(int is_attack, int str,
if (libs == 1) {
if (is_attack)
- return attack1(str, move, komaster, kom_pos);
+ return attack1(str, move);
else
- return defend1(str, move, komaster, kom_pos);
+ return defend1(str, move);
}
if (libs == 4) {
if (is_attack)
- return attack4(str, move, komaster, kom_pos);
+ return attack4(str, move);
else
- return defend4(str, move, komaster, kom_pos);
+ return defend4(str, move);
}
memset(goal, 0, BOARDMAX);
@@ -2859,7 +2835,7 @@ do_tactical_pat(int is_attack, int str,
gg_snprintf(namebuf, 128, "%s(%d)", moves[k].name, moves[k].value);
if (k > 3 + skipped && k > 12 - stackp + skipped) {
if (sgf_dumptree) {
- if (trymove(moves[k].pos, next_color, namebuf, str, 0, 0)) {
+ if (trymove(moves[k].pos, next_color, namebuf, str)) {
sgftreeAddComment(sgf_dumptree, "move trimmed to reduce variations");
popgo();
}
@@ -2867,32 +2843,28 @@ do_tactical_pat(int is_attack, int str,
continue;
}
- if (komaster_trymove(moves[k].pos, next_color, namebuf, str,
- komaster, kom_pos,
- &new_komaster, &new_kom_pos,
- &ko_move,
+ if (komaster_trymove(moves[k].pos, next_color, namebuf, str, &ko_move,
stackp <= ko_depth && best_other_tactic == WIN)) {
int other_tactic;
ASSERT1(countlib(str) >= 1, str);
if (sgf_dumptree) {
char buf[500];
- sprintf(buf, "tactical_pat komaster: %d %s new_komaster: %d %s
ko_move: %d",
- komaster, location_to_string(kom_pos), new_komaster,
- location_to_string(new_kom_pos), ko_move);
+ sprintf(buf, "tactical_pat komaster: %d %1m ko_move: %d",
+ get_komaster(), get_kom_pos(), ko_move);
sgftreeAddComment(sgf_dumptree, buf);
}
if (stackp > 100) {
popgo();
- gprintf("komaster: %d %1m new_komaster: %d %1m ko_move: %d\n",
- komaster, kom_pos, new_komaster, new_kom_pos, ko_move);
+ gprintf("komaster: %d %1m ko_move: %d\n",
+ get_komaster(), get_kom_pos(), ko_move);
continue; /* Short circuit */
}
if (is_attack)
- other_tactic = do_find_defense(str, 0, new_komaster, new_kom_pos);
+ other_tactic = do_find_defense(str, 0);
else
- other_tactic = do_attack(str, 0, new_komaster, new_kom_pos);
+ other_tactic = do_attack(str, 0);
if (is_attack && other_tactic != WIN) {
int same_tactic;
@@ -2900,9 +2872,9 @@ do_tactical_pat(int is_attack, int str,
* (not positive of problem number) */
if (stackp < depth + 6 || countlib(str) <= 2) {
if (is_attack)
- same_tactic = do_attack(str, 0, new_komaster, new_kom_pos);
+ same_tactic = do_attack(str, 0);
else
- same_tactic = do_find_defense(str, 0, new_komaster, new_kom_pos);
+ same_tactic = do_find_defense(str, 0);
if (!ko_move && other_tactic == 0 && same_tactic != 0) {
*move = moves[k].pos;
@@ -2954,7 +2926,7 @@ do_tactical_pat(int is_attack, int str,
if (!is_attack) {
/* Force attacker to capture - i.e. might be seki. */
int attack;
- attack = do_attack(str, 0, new_komaster, new_kom_pos);
+ attack = do_attack(str, 0);
if (attack < best_other_tactic) {
best_move = PASS_MOVE;
best_other_tactic = attack;
@@ -2971,12 +2943,11 @@ do_tactical_pat(int is_attack, int str,
#endif /*EXPERIMENTAL_READING*/
-/* Like attack, but takes the komaster argument. If the
- * opponent is komaster, reading functions will not try
+/* Like attack. If the opponent is komaster reading functions will not try
* to take ko.
*/
static int
-do_attack(int str, int *move, int komaster, int kom_pos)
+do_attack(int str, int *move)
{
int color = board[str];
int xpos = NO_MOVE;
@@ -3025,7 +2996,7 @@ do_attack(int str, int *move, int komast
* still be used for move ordering.
*/
if ((stackp <= depth) && (hashflags & HASH_ATTACK)
- && tt_get(&ttable, komaster, kom_pos, ATTACK, str, NO_MOVE,
+ && tt_get(&ttable, ATTACK, str, NO_MOVE,
depth - stackp, NULL,
&retval, NULL, &xpos) == 2) {
SGFTRACE(xpos, retval, "cached");
@@ -3037,7 +3008,7 @@ do_attack(int str, int *move, int komast
#else
if ((stackp <= depth) && (hashflags & HASH_ATTACK)) {
- found_read_result = get_read_result(ATTACK, komaster, kom_pos,
+ found_read_result = get_read_result(ATTACK,
&str, &read_result);
if (found_read_result) {
TRACE_CACHED_RESULT(*read_result);
@@ -3055,7 +3026,7 @@ do_attack(int str, int *move, int komast
#if EXPERIMENTAL_READING
if (attack_by_pattern) {
- result = do_attack_pat(str, &xpos, komaster, kom_pos);
+ result = do_attack_pat(str, &xpos);
/* Set liberties to 0 to pass over the non-pattern code below. */
liberties = 0;
}
@@ -3064,31 +3035,31 @@ do_attack(int str, int *move, int komast
/* Treat the attack differently depending on how many liberties the
string at (str) has. */
if (liberties == 1)
- result = attack1(str, &xpos, komaster, kom_pos);
+ result = attack1(str, &xpos);
else if (liberties == 2) {
if (stackp > depth + 10)
- result = simple_ladder_attack(str, &xpos, komaster, kom_pos);
+ result = simple_ladder(str, &xpos);
else
- result = attack2(str, &xpos, komaster, kom_pos);
+ result = attack2(str, &xpos);
}
else if (liberties == 3)
- result = attack3(str, &xpos, komaster, kom_pos);
+ result = attack3(str, &xpos);
else if (liberties == 4)
- result = attack4(str, &xpos, komaster, kom_pos);
+ result = attack4(str, &xpos);
ASSERT1(result >= 0 && result <= WIN, str);
if (result)
#if USE_HASHTABLE_NG
- READ_RETURN_NG(komaster, kom_pos, ATTACK, str, depth - stackp,
+ READ_RETURN_NG(ATTACK, str, depth - stackp,
move, xpos, result);
#else
READ_RETURN(read_result, move, xpos, result);
#endif
#if USE_HASHTABLE_NG
- READ_RETURN0_NG(komaster, kom_pos, ATTACK, str, depth - stackp);
+ READ_RETURN0_NG(ATTACK, str, depth - stackp);
#else
READ_RETURN0(read_result);
#endif
@@ -3143,7 +3114,7 @@ do_attack(int str, int *move, int komast
*/
static int
-attack1(int str, int *move, int komaster, int kom_pos)
+attack1(int str, int *move)
{
int color = board[str];
int other = OTHER_COLOR(color);
@@ -3174,7 +3145,7 @@ attack1(int str, int *move, int komaster
/* Try to play on the liberty. This fails if and only if it is an
* illegal ko capture.
*/
- if (trymove(xpos, other, "attack1-A", str, komaster, kom_pos)) {
+ if (trymove(xpos, other, "attack1-A", str)) {
/* Is the attacker in atari? If not the attack was successful. */
if (countlib(xpos) > 1) {
popgo();
@@ -3186,13 +3157,13 @@ attack1(int str, int *move, int komaster
* a ko threat first.
*/
else if (countstones(xpos) == 1) {
- if (komaster != other) {
+ if (get_komaster() != other) {
/* If the defender is allowed to take the ko the result is KO_A. */
CHECK_RESULT_UNREVERSED(savecode, savemove, KO_A, xpos, move,
"last liberty - ko");
}
else {
- /* But if the attacker is komaster, the attack was successful. */
+ /* But if the attacker is the attack was successful. */
popgo();
RETURN_RESULT(WIN, xpos, move, "last liberty");
}
@@ -3202,7 +3173,7 @@ attack1(int str, int *move, int komaster
* at (str) since we have already established that this string
* was a single stone.
*/
- else if (trymove(str, color, "attack1-B", str, komaster, kom_pos)) {
+ else if (trymove(str, color, "attack1-B", str)) {
/* If this was a proper snapback, (str) will now have more
* than one liberty.
*/
@@ -3219,7 +3190,7 @@ attack1(int str, int *move, int komaster
popgo();
}
else {/* Illegal ko capture. */
- if (komaster != color) {
+ if (get_komaster() != color) {
CHECK_RESULT_UNREVERSED(savecode, savemove, KO_B, xpos, move,
"last liberty - ko");
}
@@ -3233,9 +3204,9 @@ attack1(int str, int *move, int komaster
for (k = 0; k < liberties; k++) {
apos = libs[k];
if (!is_self_atari(apos, other)
- && trymove(apos, other, "attack1-C", str, komaster, kom_pos)) {
- int dcode = do_find_defense(str, NULL, komaster, kom_pos);
- if (dcode != WIN && do_attack(str, NULL, komaster, kom_pos)) {
+ && trymove(apos, other, "attack1-C", str)) {
+ int dcode = do_find_defense(str, NULL);
+ if (dcode != WIN && do_attack(str, NULL)) {
if (dcode == 0) {
popgo();
RETURN_RESULT(WIN, apos, move, "backfilling");
@@ -3251,20 +3222,16 @@ attack1(int str, int *move, int komaster
int adj2;
adj2 = chainlinks2(adjs[0], adjs2, 1);
for (k = 0; k < adj2; k++) {
- int new_komaster;
- int new_kom_pos;
int ko_move;
if (adjs2[k] == str)
continue;
findlib(adjs2[k], 1, &apos);
- if (komaster_trymove(apos, other, "attack1-D", str, komaster,
- kom_pos, &new_komaster, &new_kom_pos,
+ if (komaster_trymove(apos, other, "attack1-D", str,
&ko_move, stackp <= ko_depth && savecode == 0)) {
if (!ko_move) {
- int dcode = do_find_defense(str, NULL, new_komaster,
- new_kom_pos);
+ int dcode = do_find_defense(str, NULL);
if (dcode != WIN
- && do_attack(str, NULL, new_komaster, new_kom_pos)) {
+ && do_attack(str, NULL)) {
popgo();
CHECK_RESULT(savecode, savemove, dcode, apos, move,
"attack effective");
@@ -3273,9 +3240,8 @@ attack1(int str, int *move, int komaster
popgo();
}
else {
- if (do_find_defense(str, NULL, new_komaster,
- new_kom_pos) != WIN
- && do_attack(str, NULL, new_komaster, new_kom_pos) != 0) {
+ if (do_find_defense(str, NULL) != WIN
+ && do_attack(str, NULL) != 0) {
savemove = apos;
savecode = KO_B;
}
@@ -3310,7 +3276,7 @@ attack1(int str, int *move, int komaster
*/
static int
-attack2(int str, int *move, int komaster, int kom_pos)
+attack2(int str, int *move)
{
int color = board[str];
int other = OTHER_COLOR(color);
@@ -3493,7 +3459,7 @@ attack2(int str, int *move, int komaster
*/
static int
-attack3(int str, int *move, int komaster, int kom_pos)
+attack3(int str, int *move)
{
int color = board[str];
int other = OTHER_COLOR(color);
@@ -3623,7 +3589,7 @@ attack3(int str, int *move, int komaster
/* attack4 tries to capture a string with 4 liberties. */
static int
-attack4(int str, int *move, int komaster, int kom_pos)
+attack4(int str, int *move)
{
int color = board[str];
int other = OTHER_COLOR(color);
@@ -3965,7 +3931,7 @@ special_attack4_moves(int str, int libs[
/*
- * If (str) points to a string, draw_back(str, &move, komaster)
+ * If (str) points to a string, draw_back(str, &moves)
* looks for a move in the following configuration which attacks
* the string:
*
@@ -4815,7 +4781,7 @@ double_atari_chain2_moves(int str, struc
* not considering moves from the list.
*/
int
-restricted_defend1(int str, int *move, int komaster, int kom_pos,
+restricted_defend1(int str, int *move,
int num_forbidden_moves, int *forbidden_moves)
{
int color = board[str];
@@ -4868,8 +4834,8 @@ restricted_defend1(int str, int *move, i
else
ko_capture = 0;
- if ((komaster != other || !ko_capture)
- && trymove(xpos, color, moves.message[k], str, komaster, kom_pos)) {
+ if ((get_komaster() != other || !ko_capture)
+ && trymove(xpos, color, moves.message[k], str)) {
int libs = countlib(str);
if (libs > 2) {
popgo();
@@ -4882,10 +4848,10 @@ restricted_defend1(int str, int *move, i
int acode;
if (!ko_capture)
- acode = restricted_attack2(str, NULL, komaster, kom_pos,
+ acode = restricted_attack2(str, NULL,
num_forbidden_moves, forbidden_moves);
else
- acode = restricted_attack2(str, NULL, color, xpos,
+ acode = restricted_attack2(str, NULL,
num_forbidden_moves, forbidden_moves);
popgo();
if (acode == 0) {
@@ -4906,11 +4872,11 @@ restricted_defend1(int str, int *move, i
int ko_pos;
if (stackp <= ko_depth
&& savecode == 0
- && (komaster == EMPTY
- || (komaster == color
- && kom_pos == xpos))
+ && (get_komaster() == EMPTY
+ || (get_komaster() == color
+ && get_kom_pos() == xpos))
&& is_ko(xpos, color, &ko_pos)
- && tryko(xpos, color, "restricted_defend1-B", color, ko_pos)) {
+ && tryko(xpos, color, "restricted_defend1-B")) {
int libs = countlib(str);
if (libs > 2) {
popgo();
@@ -4918,7 +4884,7 @@ restricted_defend1(int str, int *move, i
}
else if (libs == 2) {
int acode;
- acode = restricted_attack2(str, NULL, color, xpos,
+ acode = restricted_attack2(str, NULL,
num_forbidden_moves, forbidden_moves);
popgo();
UPDATE_SAVED_KO_RESULT(savecode, savemove, acode, xpos);
@@ -4946,7 +4912,7 @@ restricted_defend1(int str, int *move, i
* not considering moves from the list.
*/
int
-restricted_attack2(int str, int *move, int komaster, int kom_pos,
+restricted_attack2(int str, int *move,
int num_forbidden_moves, int *forbidden_moves)
{
int color = board[str];
@@ -4987,14 +4953,13 @@ restricted_attack2(int str, int *move, i
else
ko_capture = 0;
- if ((komaster != color || !ko_capture)
- && trymove(apos, other, "restricted_attack2", str,
- komaster, kom_pos)) {
+ if ((get_komaster() != color || !ko_capture)
+ && trymove(apos, other, "restricted_attack2", str)) {
if ((!ko_capture
- && !restricted_defend1(str, NULL, komaster, kom_pos,
+ && !restricted_defend1(str, NULL,
num_forbidden_moves, forbidden_moves))
|| (ko_capture
- && !restricted_defend1(str, NULL, other, ko_pos,
+ && !restricted_defend1(str, NULL,
num_forbidden_moves, forbidden_moves))) {
popgo();
SGFTRACE(apos, WIN, "attack effective");
@@ -5005,11 +4970,11 @@ restricted_attack2(int str, int *move, i
popgo();
}
else if (savecode == 0
- && (komaster == EMPTY
- || (komaster == other
- && kom_pos == apos))
- && tryko(apos, other, "restricted_attack2", komaster, kom_pos)) {
- if (!restricted_defend1(str, NULL, other, ko_pos,
+ && (get_komaster() == EMPTY
+ || (get_komaster() == other
+ && get_kom_pos() == apos))
+ && tryko(apos, other, "restricted_attack2")) {
+ if (!restricted_defend1(str, NULL,
num_forbidden_moves, forbidden_moves)) {
popgo();
savecode = KO_B;
@@ -5435,6 +5400,7 @@ safe_move(int move, int color)
{
int safe = 0;
static int initialized = 0;
+ int ko_move;
if (!initialized) {
clear_safe_move_cache();
@@ -5447,16 +5413,10 @@ safe_move(int move, int color)
return safe_move_cache[move][color == BLACK];
/* Otherwise calculate the value... */
- if (trymove(move, color, "safe_move-A", 0, EMPTY, 0)) {
+ if (komaster_trymove(move, color, "safe_move", 0, &ko_move, 1)) {
safe = REVERSE_RESULT(attack(move, NULL));
- popgo();
- }
- else if (is_ko(move, color, NULL)
- && tryko(move, color, "safe_move-B", EMPTY, 0)) {
- if (do_attack(move, NULL, color, move) != WIN)
+ if (ko_move && safe != 0)
safe = KO_B;
- else
- safe = 0;
popgo();
}
@@ -5485,7 +5445,7 @@ int
does_secure(int color, int move, int pos)
{
int result = 0;
- if (trymove(move, color, NULL, NO_MOVE, EMPTY, NO_MOVE)) {
+ if (trymove(move, color, NULL, NO_MOVE)) {
if (is_self_atari(pos, OTHER_COLOR(color)))
result = 1;
popgo();
@@ -5606,12 +5566,6 @@ draw_reading_shadow()
int
simple_ladder(int str, int *move)
{
- return simple_ladder_attack(str, move, EMPTY, NO_MOVE);
-}
-
-static int
-simple_ladder_attack(int str, int *move, int komaster, int kom_pos)
-{
int color = board[str];
int other = OTHER_COLOR(color);
int apos;
@@ -5622,7 +5576,7 @@ simple_ladder_attack(int str, int *move,
int k;
struct reading_moves moves;
- SETUP_TRACE_INFO("simple_ladder_attack", str);
+ SETUP_TRACE_INFO("simple_ladder", str);
reading_node_counter++;
moves.num = 0;
moves.num_tried = 0;
@@ -5632,7 +5586,7 @@ simple_ladder_attack(int str, int *move,
ASSERT1(countlib(str) == 2, str);
/* Give up if we attacked depending on ko for too long. */
- if (stackp > depth + 20 && komaster == OTHER_COLOR(board[str])) {
+ if (stackp > depth + 20 && get_komaster() == OTHER_COLOR(board[str])) {
SGFTRACE(0, 0, NULL);
if (move)
*move = PASS_MOVE;
@@ -5648,23 +5602,20 @@ simple_ladder_attack(int str, int *move,
*/
if (approxlib(libs[0], color, 4, NULL) <= 3)
- ADD_CANDIDATE_MOVE(libs[1], 0, moves, "simple_ladder_attack");
+ ADD_CANDIDATE_MOVE(libs[1], 0, moves, "simple_ladder");
if (approxlib(libs[1], color, 4, NULL) <= 3)
- ADD_CANDIDATE_MOVE(libs[0], 0, moves, "simple_ladder_attack");
+ ADD_CANDIDATE_MOVE(libs[0], 0, moves, "simple_ladder");
order_moves(str, &moves, other, read_function_name, NO_MOVE);
for (k = 0; k < moves.num; k++) {
- int new_komaster;
- int new_kom_pos;
int ko_move;
apos = moves.pos[k];
if (komaster_trymove(apos, other, moves.message[k], str,
- komaster, kom_pos, &new_komaster, &new_kom_pos,
&ko_move, savecode == 0)) {
if (!ko_move) {
- dcode = simple_ladder_defend(str, NULL, new_komaster, new_kom_pos);
+ dcode = simple_ladder_defend(str, NULL);
if (dcode != WIN) {
if (dcode == 0) {
popgo();
@@ -5677,7 +5628,7 @@ simple_ladder_attack(int str, int *move,
}
}
else {
- if (simple_ladder_defend(str, NULL, new_komaster, new_kom_pos) != WIN) {
+ if (simple_ladder_defend(str, NULL) != WIN) {
savemove = apos;
savecode = KO_B;
}
@@ -5691,7 +5642,7 @@ simple_ladder_attack(int str, int *move,
static int
-simple_ladder_defend(int str, int *move, int komaster, int kom_pos)
+simple_ladder_defend(int str, int *move)
{
int color = board[str];
int xpos;
@@ -5720,14 +5671,10 @@ simple_ladder_defend(int str, int *move,
order_moves(str, &moves, color, read_function_name, NO_MOVE);
for (k = 0; k < moves.num; k++) {
- int new_komaster;
- int new_kom_pos;
int ko_move;
xpos = moves.pos[k];
if (komaster_trymove(xpos, color, moves.message[k], str,
- komaster, kom_pos,
- &new_komaster, &new_kom_pos,
&ko_move, savecode == 0)) {
int acode;
int new_libs = countlib(str);
@@ -5736,7 +5683,7 @@ simple_ladder_defend(int str, int *move,
else if (new_libs < 2)
acode = WIN;
else
- acode = simple_ladder_attack(str, NULL, new_komaster, new_kom_pos);
+ acode = simple_ladder(str, NULL);
popgo();
if (!ko_move)
Index: engine/utils.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/utils.c,v
retrieving revision 1.87
diff -u -p -r1.87 utils.c
--- engine/utils.c 24 Jan 2004 04:04:56 -0000 1.87
+++ engine/utils.c 10 Apr 2004 15:03:18 -0000
@@ -59,7 +59,7 @@ change_dragon_status(int dr, int status)
int
defend_against(int move, int color, int apos)
{
- if (trymove(move, color, "defend_against", NO_MOVE, EMPTY, NO_MOVE)) {
+ if (trymove(move, color, "defend_against", NO_MOVE)) {
if (safe_move(apos, OTHER_COLOR(color)) == 0) {
popgo();
return 1;
@@ -116,12 +116,11 @@ does_attack(int move, int str)
return 0;
}
- if (trymove(move, other, "does_attack-A", str, EMPTY, NO_MOVE)) {
+ if (trymove(move, other, "does_attack-A", str)) {
if (!board[str] || !find_defense(str, NULL)) {
result = WIN;
increase_depth_values();
- if (spos != NO_MOVE && trymove(spos, color, "does_attack-B", str,
- EMPTY, NO_MOVE)) {
+ if (spos != NO_MOVE && trymove(spos, color, "does_attack-B", str)) {
if (board[str] && !attack(str, NULL))
result = 0;
popgo();
@@ -160,11 +159,11 @@ does_defend(int move, int str)
gg_assert(spos != NO_MOVE);
- if (trymove(move, color, "does_defend-A", str, EMPTY, NO_MOVE)) {
+ if (trymove(move, color, "does_defend-A", str)) {
if (!attack(str, NULL)) {
result = 1;
increase_depth_values();
- if (trymove(spos, other, "does_defend-B", str, EMPTY, NO_MOVE)) {
+ if (trymove(spos, other, "does_defend-B", str)) {
if (!board[str] || !find_defense(str, NULL))
result = 0;
popgo();
@@ -311,9 +310,8 @@ play_break_through_n(int color, int num_
apos = va_arg(ap, int);
if (apos != NO_MOVE
- && (trymove(apos, mcolor, "play_break_through_n", NO_MOVE,
- EMPTY, NO_MOVE)
- || tryko(apos, mcolor, "play_break_through_n", EMPTY, NO_MOVE)))
+ && (trymove(apos, mcolor, "play_break_through_n", NO_MOVE)
+ || tryko(apos, mcolor, "play_break_through_n")))
played_moves++;
mcolor = OTHER_COLOR(mcolor);
}
@@ -382,9 +380,8 @@ play_attack_defend_n(int color, int do_a
apos = va_arg(ap, int);
if (apos != NO_MOVE
- && (trymove(apos, mcolor, "play_attack_defend_n", NO_MOVE,
- EMPTY, NO_MOVE)
- || tryko(apos, mcolor, "play_attack_defend_n", EMPTY, NO_MOVE)))
+ && (trymove(apos, mcolor, "play_attack_defend_n", NO_MOVE)
+ || tryko(apos, mcolor, "play_attack_defend_n")))
played_moves++;
mcolor = OTHER_COLOR(mcolor);
}
@@ -468,9 +465,8 @@ play_attack_defend2_n(int color, int do_
apos = va_arg(ap, int);
if (apos != NO_MOVE
- && (trymove(apos, mcolor, "play_attack_defend_n", NO_MOVE,
- EMPTY, NO_MOVE)
- || tryko(apos, mcolor, "play_attack_defend_n", EMPTY, NO_MOVE)))
+ && (trymove(apos, mcolor, "play_attack_defend_n", NO_MOVE)
+ || tryko(apos, mcolor, "play_attack_defend_n")))
played_moves++;
mcolor = OTHER_COLOR(mcolor);
}
@@ -544,9 +540,8 @@ play_connect_n(int color, int do_connect
apos = va_arg(ap, int);
if (apos != NO_MOVE
- && (trymove(apos, mcolor, "play_connect_n", NO_MOVE,
- EMPTY, NO_MOVE)
- || tryko(apos, mcolor, "play_connect_n", EMPTY, NO_MOVE)))
+ && (trymove(apos, mcolor, "play_connect_n", NO_MOVE)
+ || tryko(apos, mcolor, "play_connect_n")))
played_moves++;
mcolor = OTHER_COLOR(mcolor);
}
@@ -1119,7 +1114,7 @@ detect_tactical_blunder(int move, int co
int ii;
int current_verbose = save_verbose;
- if (!trymove(move, color, NULL, NO_MOVE, EMPTY, NO_MOVE))
+ if (!trymove(move, color, NULL, NO_MOVE))
return;
/* Need to increase the depth values during this reading to avoid
@@ -1195,7 +1190,7 @@ detect_tactical_blunder(int move, int co
}
}
- trymove(move, color, NULL, NO_MOVE, EMPTY, NO_MOVE);
+ trymove(move, color, NULL, NO_MOVE);
increase_depth_values();
if (defense_effective && defense_point) {
@@ -1213,7 +1208,7 @@ detect_tactical_blunder(int move, int co
attack(pos, defense_point);
/* Redo the move, we know that it won't fail. */
- trymove(move, color, NULL, NO_MOVE, EMPTY, NO_MOVE);
+ trymove(move, color, NULL, NO_MOVE);
}
else {
verbose = save_verbose;
@@ -1302,7 +1297,7 @@ double_atari(int move, int color, float
&& BOARD(m+dm, n) == other
&& (!safe_stones
|| (safe_stones[POS(m, n+dn)] && safe_stones[POS(m+dm, n)]))
- && trymove(move, color, "double_atari", NO_MOVE, EMPTY, NO_MOVE)) {
+ && trymove(move, color, "double_atari", NO_MOVE)) {
if (countlib(move) > 1
&& (BOARD(m, n+dn) == EMPTY || BOARD(m+dm, n) == EMPTY
|| !defend_both(POS(m, n+dn), POS(m+dm, n)))) {
@@ -1358,7 +1353,7 @@ capture_non_invincible_strings(int color
liberties = findlib(pos, MAXLIBS, libs);
save_moves = moves_played;
for (k = 0; k < liberties; k++) {
- if (trymove(libs[k], other, "unconditional_life", pos, EMPTY, 0))
+ if (trymove(libs[k], other, "unconditional_life", pos))
moves_played++;
}
@@ -1379,7 +1374,7 @@ capture_non_invincible_strings(int color
* |.XO.O|
* +-----+
*/
- int success = tryko(libs[0], other, "unconditional_life", EMPTY, 0);
+ int success = tryko(libs[0], other, "unconditional_life");
gg_assert(success);
moves_played++;
something_captured = 1;
@@ -1652,7 +1647,7 @@ unconditional_life(int unconditional_ter
/* Play as many liberties as we can. */
liberties = findlib(pos, MAXLIBS, libs);
for (k = 0; k < liberties; k++) {
- if (trymove(libs[k], other, "unconditional_life", pos, EMPTY, 0))
+ if (trymove(libs[k], other, "unconditional_life", pos))
moves_played++;
}
}
@@ -1671,7 +1666,7 @@ unconditional_life(int unconditional_ter
/* Try to extend the string at (m, n). */
findlib(pos, 1, libs);
- if (trymove(libs[0], other, "unconditional_life", pos, EMPTY, 0)) {
+ if (trymove(libs[0], other, "unconditional_life", pos)) {
moves_played++;
found_one = 1;
}
@@ -1698,12 +1693,10 @@ unconditional_life(int unconditional_ter
if (board[pos + right] != EMPTY || board[pos + up - right] != EMPTY)
continue;
if (board[pos - right] == EMPTY
- && trymove(pos - right, other, "unconditional_life", pos,
- EMPTY, NO_MOVE))
+ && trymove(pos - right, other, "unconditional_life", pos))
locally_played_moves++;
if (board[pos + up + right] == EMPTY
- && trymove(pos + up + right, other, "unconditional_life", pos,
- EMPTY, NO_MOVE))
+ && trymove(pos + up + right, other, "unconditional_life", pos))
locally_played_moves++;
if (board[pos - right] == other && board[pos + up + right] == other
&& same_string(pos - right, pos + up + right)) {
@@ -1714,7 +1707,7 @@ unconditional_life(int unconditional_ter
popgo();
locally_played_moves--;
}
- trymove(pos - up, color, "unconditional_life", pos, EMPTY, NO_MOVE);
+ trymove(pos - up, color, "unconditional_life", pos);
moves_played++;
break;
}
@@ -1737,7 +1730,7 @@ unconditional_life(int unconditional_ter
/* Play as many liberties as we can. */
liberties = findlib(pos, MAXLIBS, libs);
for (k = 0; k < liberties; k++) {
- if (trymove(libs[k], other, "unconditional_life", pos, EMPTY, NO_MOVE))
+ if (trymove(libs[k], other, "unconditional_life", pos))
moves_played++;
}
}
@@ -1775,11 +1768,11 @@ unconditional_life(int unconditional_ter
blib = approxlib(bpos, other, 4, NULL);
if (aopen > bopen || (aopen == bopen && alib >= blib)) {
- trymove(apos, other, "unconditional_life", pos, EMPTY, 0);
+ trymove(apos, other, "unconditional_life", pos);
moves_played++;
}
else {
- trymove(bpos, other, "unconditional_life", pos, EMPTY, 0);
+ trymove(bpos, other, "unconditional_life", pos);
moves_played++;
}
}
Index: engine/value_moves.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/value_moves.c,v
retrieving revision 1.120
diff -u -p -r1.120 value_moves.c
--- engine/value_moves.c 10 Apr 2004 14:30:03 -0000 1.120
+++ engine/value_moves.c 10 Apr 2004 15:03:22 -0000
@@ -179,8 +179,7 @@ find_more_attack_and_defense_moves(int c
/* Try the move at (ii) and see what happens. */
cursor_at_start_of_line = 0;
TRACE("%1m ", ii);
- if (trymove(ii, color, "find_more_attack_and_defense_moves",
- NO_MOVE, EMPTY, NO_MOVE)) {
+ if (trymove(ii, color, "find_more_attack_and_defense_moves", NO_MOVE)) {
for (k = 0; k < N; k++) {
int aa = unstable_worms[k];
@@ -197,7 +196,7 @@ find_more_attack_and_defense_moves(int c
int defense_works = 1;
if (trymove(worm[aa].attack_points[0], other,
- "find_more_attack_and_defense_moves", 0, EMPTY, 0)) {
+ "find_more_attack_and_defense_moves", 0)) {
if (!board[aa])
defense_works = 0;
else {
@@ -241,7 +240,7 @@ find_more_attack_and_defense_moves(int c
if (attack(aa, NULL) >= worm[aa].attack_codes[0]) {
if (trymove(worm[aa].defense_points[0], other,
- "find_more_attack_and_defense_moves", 0, EMPTY, 0)) {
+ "find_more_attack_and_defense_moves", 0)) {
int this_dcode = REVERSE_RESULT(attack(aa, NULL));
if (this_dcode > dcode) {
dcode = this_dcode;
@@ -594,7 +593,7 @@ induce_secondary_move_reasons(int color)
continue;
if (trymove(pos, color_to_move, "induce_secondary_move_reasons",
- aa, EMPTY, NO_MOVE)) {
+ aa)) {
if (attack_move
&& board[adj1] != board[aa]
&& !disconnect(adj1, adj2, NULL)) {
@@ -715,7 +714,7 @@ induce_secondary_move_reasons(int color)
&& !is_same_worm(pos3, worm1)
&& !is_same_worm(pos3, worm2)) {
if (trymove(pos, color, "induce_secondary_move_reasons-B",
- worm1, EMPTY, NO_MOVE)) {
+ worm1)) {
if (!disconnect(pos3, worm1, NULL)) {
add_connection_move(pos, pos3, worm1);
do_find_more_owl_attack_and_defense_moves(color, pos,
CONNECT_MOVE,
@@ -1415,7 +1414,7 @@ adjacent_to_nondead_stone(int pos, int c
popgo();
}
- if (trymove(pos, color, NULL, EMPTY, NO_MOVE, EMPTY)) {
+ if (trymove(pos, color, NULL, EMPTY)) {
for (k = 0; k < 12; k++) {
int pos2;
if (k < 8)
@@ -1437,7 +1436,7 @@ adjacent_to_nondead_stone(int pos, int c
}
while (stackp < saved_stackp)
- tryko(stack[stackp], move_color[stackp], NULL, NO_MOVE, EMPTY);
+ tryko(stack[stackp], move_color[stackp], NULL);
return result;
}
@@ -1639,8 +1638,7 @@ estimate_territorial_value(int pos, int
* a structured manner.
*/
- if (trymove(pos, color, "estimate_territorial_value-A",
- NO_MOVE, EMPTY, NO_MOVE)) {
+ if (trymove(pos, color, "estimate_territorial_value-A", NO_MOVE)) {
int adjs[MAXCHAIN];
float adjusted_value = 2 * worm[aa].effective_size;
float adjustment_up = 0.0;
@@ -1676,8 +1674,7 @@ estimate_territorial_value(int pos, int
&& defense_move != NO_MOVE) {
int bad_followup;
if (trymove(defense_move, other,
- "estimate_territorial_value-b", NO_MOVE,
- EMPTY, NO_MOVE)) {
+ "estimate_territorial_value-b", NO_MOVE)) {
if (board[pos] == EMPTY || attack(pos, NULL) != 0) {
popgo();
popgo();
@@ -1691,8 +1688,8 @@ estimate_territorial_value(int pos, int
int lib;
if (countlib(adjs[s]) == 1) {
findlib(adjs[s], 1, &lib);
- if (trymove(lib, other, "estimate_territorial_value-c", NO_MOVE,
- EMPTY, NO_MOVE)) {
+ if (trymove(lib, other,
+ "estimate_territorial_value-c", NO_MOVE)) {
if (!attack(aa, NULL)
&& (board[pos] == EMPTY || attack(pos, NULL) != 0)) {
popgo();
@@ -1763,15 +1760,13 @@ estimate_territorial_value(int pos, int
* FIXME: This is somewhat halfhearted since only one attack
* move is tested.
*/
- if (trymove(pos, color, "estimate_territorial_value-A",
- NO_MOVE, EMPTY, NO_MOVE)) {
+ if (trymove(pos, color, "estimate_territorial_value-A", NO_MOVE)) {
int attack_move;
if (move[pos].move_safety == 1
&& attack(aa, &attack_move) == WIN
&& attack_move != NO_MOVE) {
if (trymove(attack_move, other,
- "estimate_territorial_value-b", NO_MOVE,
- EMPTY, NO_MOVE)) {
+ "estimate_territorial_value-b", NO_MOVE)) {
if (board[pos] == EMPTY || attack(pos, NULL) != 0) {
popgo();
popgo();
@@ -2054,7 +2049,7 @@ estimate_territorial_value(int pos, int
* an owl defense).
*/
if (does_block
- && tryko(pos, color, "estimate_territorial_value", EMPTY, NO_MOVE)) {
+ && tryko(pos, color, "estimate_territorial_value")) {
Hash_data safety_hash = goal_to_hashvalue(safe_stones);
if (disable_delta_territory_cache
|| !retrieve_delta_territory_cache(pos, color, &this_value,
@@ -3117,8 +3112,7 @@ reevaluate_ko_threats(int ko_move, int c
if (type == -1)
threat_does_work = 1;
else {
- if (trymove(pos, color, "reevaluate_ko_threats", ko_move,
- EMPTY, ko_move)) {
+ if (trymove(pos, color, "reevaluate_ko_threats", ko_move)) {
ASSERT_ON_BOARD1(ko_stone);
if (!find_defense(ko_stone, &opp_ko_move))
threat_does_work = 1;
@@ -3128,7 +3122,7 @@ reevaluate_ko_threats(int ko_move, int c
threat_wastes_point = 1;
if (trymove(opp_ko_move, OTHER_COLOR(color),
- "reevaluate_ko_threats", ko_move, EMPTY, NO_MOVE)) {
+ "reevaluate_ko_threats", ko_move)) {
switch (type) {
case ATTACK_THREAT:
threat_does_work = attack(what, NULL);
Index: engine/worm.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/worm.c,v
retrieving revision 1.60
diff -u -p -r1.60 worm.c
--- engine/worm.c 24 Jan 2004 04:04:56 -0000 1.60
+++ engine/worm.c 10 Apr 2004 15:03:24 -0000
@@ -270,7 +270,7 @@ make_worms(void)
continue;
/* Try to play color at pos and see what it leads to. */
- if (!trymove(pos, color, "make_worms", NO_MOVE, EMPTY, NO_MOVE))
+ if (!trymove(pos, color, "make_worms", NO_MOVE))
continue;
/* We must read to the same depth that was used in the
@@ -313,7 +313,7 @@ make_worms(void)
if (attack(str, NULL) >= worm[str].attack_codes[0]) {
if (worm[str].defense_codes[0] != 0
&& trymove(worm[str].defense_points[0],
- OTHER_COLOR(color), "make_worms", 0, EMPTY, 0)) {
+ OTHER_COLOR(color), "make_worms", 0)) {
int this_dcode = REVERSE_RESULT(attack(str, NULL));
if (this_dcode > dcode) {
dcode = this_dcode;
@@ -352,7 +352,7 @@ make_worms(void)
*/
if (worm[str].attack_codes[0] != 0
&& trymove(worm[str].attack_points[0],
- OTHER_COLOR(color), "make_worms", 0, EMPTY, 0)) {
+ OTHER_COLOR(color), "make_worms", 0)) {
int this_acode;
if (board[str] == EMPTY)
this_acode = WIN;
@@ -791,8 +791,7 @@ find_worm_attacks_and_defenses()
*/
attack_point = worm[str].attack_points[0];
if (!liberty_of_string(attack_point, str))
- if (trymove(attack_point, worm[str].color, "make_worms", NO_MOVE,
- EMPTY, NO_MOVE)) {
+ if (trymove(attack_point, worm[str].color, "make_worms", NO_MOVE)) {
int acode = attack(str, NULL);
if (acode != WIN) {
change_defense(str, attack_point, REVERSE_RESULT(acode));
@@ -835,7 +834,7 @@ find_worm_attacks_and_defenses()
int pos = libs[k];
if (!attack_move_known(pos, str)) {
/* Try to attack on the liberty. */
- if (trymove(pos, other, "make_worms", str, EMPTY, NO_MOVE)) {
+ if (trymove(pos, other, "make_worms", str)) {
if (board[str] == EMPTY || attack(str, NULL)) {
if (board[str] == EMPTY)
dcode = 0;
@@ -851,7 +850,7 @@ find_worm_attacks_and_defenses()
/* Try to defend at the liberty. */
if (!defense_move_known(pos, str)) {
if (worm[str].defense_codes[0] != 0)
- if (trymove(pos, color, "make_worms", NO_MOVE, EMPTY, NO_MOVE)) {
+ if (trymove(pos, color, "make_worms", NO_MOVE)) {
acode = attack(str, NULL);
if (acode != WIN)
change_defense(str, pos, REVERSE_RESULT(acode));
@@ -933,7 +932,7 @@ find_worm_threats()
int aa = libs[k];
/* Try to threaten on the liberty. */
- if (trymove(aa, color, "threaten defense", NO_MOVE, EMPTY, NO_MOVE)) {
+ if (trymove(aa, color, "threaten defense", NO_MOVE)) {
if (attack(str, NULL) == WIN) {
int dcode = find_defense(str, NULL);
if (dcode != 0)
@@ -951,7 +950,7 @@ find_worm_threats()
|| liberty_of_string(bb, str))
continue;
- if (trymove(bb, color, "threaten defense", str, EMPTY, NO_MOVE)) {
+ if (trymove(bb, color, "threaten defense", str)) {
if (attack(str, NULL) == WIN) {
int dcode = find_defense(str, NULL);
if (dcode != 0)
@@ -1609,7 +1608,7 @@ attack_callback(int anchor, int color, s
/* FIXME: Don't attack the same string more than once.
* Play (move) and see if there is a defense.
*/
- if (trymove(move, color, "attack_callback", str, EMPTY, NO_MOVE)) {
+ if (trymove(move, color, "attack_callback", str)) {
int dcode;
if (!board[str])
dcode = 0;
@@ -1688,7 +1687,7 @@ defense_callback(int anchor, int color,
* the proposed move happens to refute the attack.
* Play (move) and see if there is an attack.
*/
- if (trymove(move, color, "defense_callback", str, EMPTY, NO_MOVE)) {
+ if (trymove(move, color, "defense_callback", str)) {
int acode = attack(str, NULL);
popgo();
Index: interface/play_gtp.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/interface/play_gtp.c,v
retrieving revision 1.142
diff -u -p -r1.142 play_gtp.c
--- interface/play_gtp.c 24 Jan 2004 04:04:56 -0000 1.142
+++ interface/play_gtp.c 10 Apr 2004 15:03:28 -0000
@@ -1126,7 +1126,7 @@ gtp_trymove(char *s)
if (!gtp_decode_move(s, &color, &i, &j) || POS(i, j) == PASS_MOVE)
return gtp_failure("invalid color or coordinate");
- if (!trymove(POS(i, j), color, "gtp_trymove", NO_MOVE, EMPTY, NO_MOVE))
+ if (!trymove(POS(i, j), color, "gtp_trymove", NO_MOVE))
return gtp_failure("illegal move");
return gtp_success("");
@@ -1146,7 +1146,7 @@ gtp_tryko(char *s)
if (!gtp_decode_move(s, &color, &i, &j) || POS(i, j) == PASS_MOVE)
return gtp_failure("invalid color or coordinate");
- if (!tryko(POS(i, j), color, "gtp_tryko", EMPTY, NO_MOVE))
+ if (!tryko(POS(i, j), color, "gtp_tryko"))
return gtp_failure("illegal move");
return gtp_success("");
Index: patterns/barriers.db
===================================================================
RCS file: /cvsroot/gnugo/gnugo/patterns/barriers.db,v
retrieving revision 1.63
diff -u -p -r1.63 barriers.db
--- patterns/barriers.db 3 Mar 2004 22:14:12 -0000 1.63
+++ patterns/barriers.db 10 Apr 2004 15:03:29 -0000
@@ -826,17 +826,18 @@ bA.c
Pattern Barrier56
+# ab generalized (3.5.5)
xXOo
-XOX,
-...,
+xOX,
+.x.,
----
:8,sD
xXbo
-XOXa
-...,
+xOXa
+.x.,
----
;!oplay_attack(a,b)
Index: patterns/helpers.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/patterns/helpers.c,v
retrieving revision 1.59
diff -u -p -r1.59 helpers.c
--- patterns/helpers.c 24 Jan 2004 04:04:57 -0000 1.59
+++ patterns/helpers.c 10 Apr 2004 15:03:29 -0000
@@ -25,7 +25,7 @@
#include "patterns.h"
-#define TRYMOVE(pos, color) trymove(pos, color, "helper", NO_MOVE, EMPTY,
NO_MOVE)
+#define TRYMOVE(pos, color) trymove(pos, color, "helper", NO_MOVE)
#define OFFSET_BY(x, y) AFFINE_TRANSFORM(OFFSET(x, y), trans, move)
#define ARGS struct pattern *pattern, int trans, int move, int color
@@ -666,7 +666,7 @@ test_attack_either_move(int move, int co
move, worma, wormb);
return;
}
- if (trymove(move, color, "test_attack_either_move", worma, EMPTY, NO_MOVE)) {
+ if (trymove(move, color, "test_attack_either_move", worma)) {
if (board[worma] == OTHER_COLOR(color)
&& board[wormb] == OTHER_COLOR(color)) {
if (!defend_both(worma, wormb))
Index: patterns/joseki.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/patterns/joseki.c,v
retrieving revision 1.22
diff -u -p -r1.22 joseki.c
--- patterns/joseki.c 3 Mar 2004 22:14:12 -0000 1.22
+++ patterns/joseki.c 10 Apr 2004 15:03:30 -0000
@@ -366,7 +366,7 @@ analyze_node(SGFNode *node, const char *
/* Traverse child, if any. */
if (node->child) {
if (SAFE_ON_BOARD(movei, movej))
- tryko(POS(movei, movej), color, NULL, EMPTY, NO_MOVE);
+ tryko(POS(movei, movej), color, NULL);
analyze_node(node->child, prefix);
if (SAFE_ON_BOARD(movei, movej))
popgo();
- [gnugo-devel] komaster,
Arend Bayer <=