[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnugo-devel] tactical reading patch
From: |
Paul Pogonyshev |
Subject: |
[gnugo-devel] tactical reading patch |
Date: |
Tue, 1 Jun 2004 23:31:13 +0300 |
User-agent: |
KMail/1.6.52 |
This patch improves GNU Go's defense of secondary chain in tactical
attacks. Breakage:
blunder:30 PASS R6 [!O7]
trevorc:1621 PASS 1 D11 [1 D11]
Both passes are good, the first one was targeted.
The patch increases the number of reading nodes, though:
before: 1592969618 2834002 11179947
after: 1604650524 2834746 11178248
+0.73% +0.03% -0.02%
I'd say that the cost is acceptable.
Paul
--- reading.c 28 May 2004 23:23:37 +0300 1.143
+++ reading.c 01 Jun 2004 22:39:20 +0300
@@ -302,7 +302,8 @@ static void superstring_moves(int str, s
static void superstring_break_chain_moves(int str, int liberty_cap,
struct reading_moves *moves);
static void double_atari_chain2_moves(int str,
- struct reading_moves *moves);
+ struct reading_moves *moves,
+ int generate_more_moves);
static void order_moves(int str, struct reading_moves *moves,
int color, const char *funcname, int killer);
static int simple_ladder_defend(int str, int *move);
@@ -2112,7 +2113,7 @@ special_rescue5_moves(int str, int libs[
}
/* Defend against double atari in the surrounding chain early. */
- double_atari_chain2_moves(bpos, moves);
+ double_atari_chain2_moves(bpos, moves, 0);
}
}
}
@@ -3432,7 +3433,7 @@ attack3(int str, int *move)
}
/* Defend against double atari in the surrounding chain early. */
- double_atari_chain2_moves(str, &moves);
+ double_atari_chain2_moves(str, &moves, stackp <= superstring_depth);
/* Get the three liberties of (str). */
liberties = findlib(str, 3, libs);
@@ -3564,7 +3565,7 @@ attack4(int str, int *move)
}
/* Defend against double atari in the surrounding chain early. */
- double_atari_chain2_moves(str, &moves);
+ double_atari_chain2_moves(str, &moves, stackp <= superstring_depth);
/* Give a score bonus to the chain preserving moves. */
for (k = 0; k < moves.num; k++)
@@ -4674,27 +4675,29 @@ superstring_break_chain_moves(int str, i
}
/*
- * If str points to a group, double_atari_chain2_moves() adds all moves
- * which make a double atari on some strings in the surrounding chain
- * to the (movei[], movej[]) arrays.
+ * If `str' points to a group, double_atari_chain2_moves() adds all
+ * moves which make a double atari on some strings in the surrounding
+ * chain to the moves[] array. In addition, if `generate_more_moves'
+ * is set, it adds moves that make atari on a string in the
+ * surrounding chain and are adjacent to another string with 3
+ * liberties.
*/
static void
-double_atari_chain2_moves(int str, struct reading_moves *moves)
+double_atari_chain2_moves(int str, struct reading_moves *moves,
+ int generate_more_moves)
{
int r, k;
- int apos;
int adj;
int adjs[MAXCHAIN];
- int libs[2];
+ int libs[3];
int mw[BOARDMAX];
memset(mw, 0, sizeof(mw));
adj = chainlinks2(str, adjs, 2);
for (r = 0; r < adj; r++) {
- apos = adjs[r];
- findlib(apos, 2, libs);
+ findlib(adjs[r], 2, libs);
for (k = 0; k < 2; k++) {
mw[libs[k]]++;
if (mw[libs[k]] == 2) {
@@ -4702,7 +4705,24 @@ double_atari_chain2_moves(int str, struc
* is safe for the defender.
*/
if (!is_self_atari(libs[k], board[str]))
- ADD_CANDIDATE_MOVE(libs[k], 1, *moves, "double_atari_chain2");
+ ADD_CANDIDATE_MOVE(libs[k], 1, *moves, "double_atari_chain2-A");
+ }
+ }
+ }
+
+ if (generate_more_moves) {
+ int adj3;
+ int adjs3[MAXCHAIN];
+
+ adj3 = chainlinks2(str, adjs3, 3);
+ for (r = 0; r < adj3; r++) {
+ findlib(adjs3[r], 3, libs);
+ for (k = 0; k < 3; k++) {
+ if (mw[libs[k]] == 1) {
+ mw[libs[k]] = 2;
+ if (!is_self_atari(libs[k], board[str]))
+ ADD_CANDIDATE_MOVE(libs[k], -3, *moves, "double_atari_chain2-B");
+ }
}
}
}
- [gnugo-devel] tactical reading patch,
Paul Pogonyshev <=