[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnugo-devel] arend_1_25.1: experimental influence
From: |
Arend Bayer |
Subject: |
[gnugo-devel] arend_1_25.1: experimental influence |
Date: |
Tue, 5 Feb 2002 09:41:55 +0100 (CET) |
- experimental influence: follow-up specific constraints for B patterns
- experimental influence: new_value_territory revised (center correction)
- experimental influence: most fixed follow-up values taken down
- experimental influence: tuning, joseki values increased, some bugs fixed
- experimental_influence ignored for escape influence
- edge_double_sente_helper is now autohelper
I assume it is time for an experimental influence update, although I
am still busy tuning it. With this patch (minus a small late change) I am
now down to 57 PASSes and 66 FAILs. (Could be better but my patch seems
not to like my own test suites :-) ) It should be a clear net improvement
compared to 3.1.23.
The first two changes above are probably most important. The
followup-specific constraints for intrusions seem to do a good job. The
center correction seems to work as well; I may have to increase it a
little. Btw, it would be very easy to change influence/territory-preference
(more precisely center/border/edge-preference) with a command line option.
Maybe this could be a nice feature?
At the moment, the biggest weakness is s.th. that Gunnar had already
pointed out for handicap games. Approaching or entering opponents position
is overvalued. I should probably change this by adding some adequate
invasion sources.
Also I need to add some documentation for those parts that are converging.
The change of edge_double_sente_helper is somewhat unrelated as I ended
up not using it anywhere in my intrusion constraints. However, I am
almost sure that it can be used in more patterns.
Arend
Breakage of 3.1.25 + arend_1_25.1-eps + --experimental-influence:
./regress.sh . reading.tst
./regress.sh . owl.tst
./regress.sh . owl_rot.tst
./regress.sh . ld_owl.tst
301 unexpected FAIL: Correct '3 B18', got '0'
./regress.sh . optics.tst
./regress.sh . filllib.tst
./regress.sh . atari_atari.tst
./regress.sh . connection.tst
./regress.sh . blunder.tst
./regress.sh . trevora.tst
140 unexpected PASS!
220 unexpected FAIL: Correct '!B6', got 'B6'
430 unexpected PASS!
450 unexpected PASS!
./regress.sh . strategy.tst
18 unexpected FAIL: Correct 'E4|F3', got 'N11'
20 unexpected PASS!
22 unexpected FAIL: Correct 'K3', got 'N12'
./regress.sh . endgame.tst
211 unexpected FAIL: Correct 'A5', got 'O2'
./regress.sh . heikki.tst
./regress.sh . neurogo.tst
2 unexpected FAIL: Correct 'R3', got 'C8'
./regress.sh . arb.tst
./regress.sh . rosebud.tst
1 unexpected FAIL: Correct 'E16', got 'E18'
./regress.sh . golife.tst
1 unexpected PASS!
./regress.sh . arion.tst
./regress.sh . viking.tst
3 unexpected FAIL: Correct 'M15|B7', got 'Q3'
./regress.sh . ego.tst
8 unexpected PASS!
./regress.sh . dniwog.tst
1 unexpected FAIL: Correct 'D15', got 'H14'
./regress.sh . lazarus.tst
4 unexpected FAIL: Correct 'R12|Q12|M8', got 'T5'
./regress.sh . trevorb.tst
110 unexpected PASS!
180 unexpected FAIL: Correct 'L12', got 'H3'
250 unexpected FAIL: Correct 'C2', got 'F11'
300 unexpected PASS!
340 unexpected FAIL: Correct 'M11', got 'C8'
370 unexpected FAIL: Correct 'L7|B10', got 'D7'
450 unexpected PASS!
500 unexpected FAIL: Correct '!J11', got 'J11'
600 unexpected PASS!
610 unexpected FAIL: Correct 'D7', got 'N7'
620 unexpected PASS!
660 unexpected FAIL: Correct 'D3', got 'H5'
700 unexpected PASS!
730 unexpected FAIL: Correct '!E12', got 'E12'
780 unexpected FAIL: Correct 'J9', got 'A6'
790 unexpected FAIL: Correct 'K6|K5', got 'A6'
830 unexpected PASS!
920 unexpected PASS!
960 unexpected PASS!
./regress.sh . strategy2.tst
51 unexpected FAIL: Correct 'P3', got 'N5'
70 unexpected PASS!
79 unexpected FAIL: Correct 'N3', got 'C11'
85 unexpected FAIL: Correct 'O2', got 'N5'
90 unexpected FAIL: Correct 'B14|D17', got 'H2'
91 unexpected FAIL: Correct 'B14|G13', got 'H2'
./regress.sh . nicklas1.tst
502 unexpected FAIL: Correct 'G5', got 'H7'
./regress.sh . nicklas2.tst
./regress.sh . nicklas3.tst
602 unexpected PASS!
./regress.sh . nicklas4.tst
1102 unexpected FAIL: Correct 'P9|O9', got 'O12'
./regress.sh . nicklas5.tst
1202 unexpected PASS!
./regress.sh . manyfaces.tst
1 unexpected FAIL: Correct 'S13', got 'O7'
7 unexpected FAIL: Correct 'R2|S7', got 'E3'
./regress.sh . niki.tst
4 unexpected FAIL: Correct 'Q8', got 'R13'
./regress.sh . trevor.tst
190 unexpected FAIL: Correct 'B7', got 'F5'
380 unexpected PASS!
./regress.sh . tactics.tst
./regress.sh . buzco.tst
8 unexpected PASS!
./regress.sh . nngs.tst
150 unexpected FAIL: Correct '!J13|M5', got 'M5'
230 unexpected PASS!
310 unexpected PASS!
400 unexpected PASS!
420 unexpected FAIL: Correct '!C4|D3|C3|B3', got 'C4'
490 unexpected PASS!
640 unexpected PASS!
700 unexpected FAIL: Correct 'K17', got 'K18'
800 unexpected FAIL: Correct '!N19|M19|L19|S18|K1', got 'K1'
850 unexpected PASS!
890 unexpected PASS!
900 unexpected FAIL: Correct 'Q15', got 'Q7'
1050 unexpected PASS!
1250 unexpected PASS!
1790 unexpected PASS!
1940 unexpected PASS!
1955 unexpected FAIL: Correct 'D3', got 'Q8'
./regress.sh . trevorc.tst
160 unexpected FAIL: Correct 'K7', got 'J8'
280 unexpected PASS!
330 unexpected PASS!
360 unexpected PASS!
530 unexpected FAIL: Correct 'J3', got 'H4'
600 unexpected PASS!
610 unexpected PASS!
750 unexpected PASS!
770 unexpected PASS!
1080 unexpected FAIL: Correct '!L8|K10|K9', got 'L8'
1210 unexpected FAIL: Correct 'E5', got 'C9'
1240 unexpected PASS!
1290 unexpected PASS!
1310 unexpected PASS!
1350 unexpected PASS!
1400 unexpected PASS!
1570 unexpected FAIL: Correct 'E2|F2|F3', got 'J3'
1640 unexpected PASS!
./regress.sh . strategy3.tst
./regress.sh . capture.tst
./regress.sh . connect.tst
37 unexpected PASS!
./regress.sh . global.tst
4 unexpected FAIL: Correct 'Q6', got 'E2'
5 unexpected FAIL: Correct 'O4', got 'S12'
8 unexpected FAIL: Correct 'H9', got 'A5'
16 unexpected FAIL: Correct 'O10', got 'E18'
28 unexpected PASS!
./regress.sh . vie.tst
./regress.sh . arend.tst
14 unexpected FAIL: Correct 'P17', got 'G13'
23 unexpected FAIL: Correct '!H10', got 'H10'
30 unexpected PASS!
32 unexpected FAIL: Correct 'F9|E8', got 'G8'
33 unexpected FAIL: Correct 'F9', got 'M5'
35 unexpected FAIL: Correct 'H17|J19', got 'F15'
./regress.sh . 13x13.tst
13 unexpected PASS!
16 unexpected FAIL: Correct 'C6|C5', got 'F11'
17 unexpected FAIL: Correct 'L5|L3', got 'G8'
27 unexpected PASS!
28 unexpected FAIL: Correct 'L10', got 'E3'
33 unexpected PASS!
38 unexpected FAIL: Correct 'G11', got 'G10'
41 unexpected FAIL: Correct '!C8', got 'C8'
43 unexpected FAIL: Correct 'D6', got 'B6'
67 unexpected FAIL: Correct 'B9', got 'A11'
71 unexpected FAIL: Correct 'J11', got 'J12'
85 unexpected FAIL: Correct 'D2', got 'F11'
./regress.sh . semeai.tst
./regress.sh . trevord.tst
100 unexpected FAIL: Correct '!E10', got 'E10'
180 unexpected FAIL: Correct 'S9', got 'O5'
240 unexpected PASS!
310 unexpected FAIL: Correct 'S17', got 'C5'
550 unexpected FAIL: Correct 'T8', got 'J8'
830 unexpected PASS!
1060 unexpected PASS!
./regress.sh . strategy4.tst
181 unexpected FAIL: Correct 'F3', got 'N9'
190 unexpected PASS!
200 unexpected PASS!
204 unexpected FAIL: Correct 'B2', got 'G6'
207 unexpected PASS!
209 unexpected PASS!
Index: engine/influence.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/influence.c,v
retrieving revision 1.33
diff -u -r1.33 influence.c
--- engine/influence.c 2 Feb 2002 10:27:16 -0000 1.33
+++ engine/influence.c 5 Feb 2002 08:09:50 -0000
@@ -170,7 +170,7 @@
attenuation = q->white_attenuation[m][n];
else
attenuation = q->black_attenuation[m][n];
- if (experimental_influence)
+ if (experimental_influence && ! (q == &escape_influence))
diagonal_attenuation = attenuation * EXP_DIAGONAL_DAMPING;
else
diagonal_attenuation = attenuation * DIAGONAL_DAMPING;
@@ -365,14 +365,14 @@
if (q != &escape_influence) {
q->color_to_move = color;
- if (experimental_influence)
+ if (experimental_influence && ! (q == &escape_influence))
attenuation = EXP_DEFAULT_ATTENUATION;
else
attenuation = DEFAULT_ATTENUATION;
}
else {
q->color_to_move = EMPTY;
- if (experimental_influence)
+ if (experimental_influence && ! (q == &escape_influence))
attenuation = 2 * EXP_DEFAULT_ATTENUATION;
else
attenuation = 2 * DEFAULT_ATTENUATION;
@@ -530,7 +530,8 @@
static void
add_marked_intrusions(struct influence_data *q, int color)
{
- int i, j;
+ int i;
+ int j = 0;
int source_pos;
float strength_sum;
float correction;
@@ -542,6 +543,14 @@
for (i = 0; i < q->intrusion_counter; i = j) {
strength_sum = 0.0;
source_pos = q->intrusions[i].source_pos;
+ /* "Anonymous" intrusios go in uncorrected. */
+ if (source_pos == NO_MOVE) {
+ add_influence_source(q->intrusions[i].strength_pos, color,
+ q->intrusions[j].strength,
+ q->intrusions[j].attenuation, q);
+ j = i+1;
+ continue;
+ }
if (color == BLACK) {
source_strength = q->black_strength[I(source_pos)][J(source_pos)];
}
@@ -572,8 +581,9 @@
correction * q->intrusions[j].strength,
q->intrusions[j].attenuation, q);
DEBUG(DEBUG_INFLUENCE,
- "Adding intrusion for %1m at %1m, value %f (correction %f)\n",
- source_pos, q->intrusions[j].strength_pos,
+ "Adding %s intrusion for %1m at %1m, value %f (correction %f)\n",
+ (color == BLACK) ? "black" : "white", source_pos,
+ q->intrusions[j].strength_pos,
correction * q->intrusions[j].strength, correction);
}
}
@@ -608,11 +618,14 @@
* those marked Y in standard influence.
*/
if (pattern->class & CLASS_Y)
- if (((pattern->class & CLASS_F) && (experimental_influence))
- || (!(pattern->class & CLASS_F) && !(experimental_influence)))
+ if (((pattern->class & CLASS_F)
+ && (experimental_influence && !(q == &escape_influence)))
+ || (!(pattern->class & CLASS_F)
+ && !(experimental_influence && !(q == &escape_influence))))
return;
/* We currently ignore enhancement patterns in experimental influence. */
- if ((pattern->class & CLASS_E) && (experimental_influence))
+ if ((pattern->class & CLASS_E)
+ && (experimental_influence && !(q == &escape_influence)))
return;
/* Loop through pattern elements to see if an A or D pattern
@@ -738,7 +751,7 @@
/* For t patterns, everything happens in the action. */
if ((pattern->class & CLASS_t)
&& (pattern->autohelper_flag & HAVE_ACTION)) {
- pattern->autohelper(pattern, ll, pos, color, 1);
+ pattern->autohelper(pattern, ll, pos, color, INFLUENCE_CALLBACK);
}
@@ -808,7 +821,7 @@
/* Low intensity influence source for the color in turn to move. */
if (pattern->class & CLASS_B) {
- if (experimental_influence)
+ if (experimental_influence && !(q == &escape_influence))
enter_intrusion_source(saved_pos, POS(x, y), pattern->value,
EXP_DEFAULT_ATTENUATION, q);
else
@@ -829,11 +842,42 @@
int ll, void *data)
{
int k;
+ int ti, tj;
int saved_stone = NO_MOVE;
struct influence_data *q = data;
UNUSED(color);
- if (!pattern->class & CLASS_B)
+ /* We use only B patterns in followup influence. */
+ if (!(pattern->class & CLASS_B))
+ return;
+
+ TRANSFORM(pattern->movei, pattern->movej, &ti, &tj, ll);
+ ti += m;
+ tj += n;
+ /* If the pattern has a constraint, call the autohelper to see
+ * if the pattern must be rejected.
+ */
+ if (pattern->autohelper_flag & HAVE_CONSTRAINT) {
+ if (!pattern->autohelper(pattern, ll, POS(ti, tj), color, 0))
+ return;
+ }
+
+ /* If the pattern has a helper, call it to see if the pattern must
+ * be rejected.
+ */
+ if (pattern->helper) {
+ if (!pattern->helper(pattern, ll, POS(ti, tj), color)) {
+ DEBUG(DEBUG_INFLUENCE,
+ "Influence pattern %s+%d rejected by helper at %1m\n",
+ pattern->name, ll, POS(ti, tj));
+ return;
+ }
+ }
+
+ /* Actions in B patterns are used as followup specific constraints. */
+ if ((pattern->autohelper_flag & HAVE_ACTION)
+ && !pattern->autohelper(pattern, ll, POS(ti, tj), color,
+ FOLLOWUP_INFLUENCE_CALLBACK))
return;
/* First loop: We check whether a saved stone is involved. */
@@ -850,6 +894,9 @@
if (saved_stone == NO_MOVE)
return;
+
+ DEBUG(DEBUG_INFLUENCE, "influence pattern '%s'+%d matched at %1m\n",
+ pattern->name, ll, POS(m, n));
for (k = 0; k < pattern->patlen; ++k) /* match each point */
if (pattern->patn[k].att == ATT_not) {
@@ -861,8 +908,8 @@
/* Low intensity influence source for the color in turn to move. */
enter_intrusion_source(saved_stone, pos, pattern->value,
EXP_DEFAULT_ATTENUATION, &followup_influence);
- DEBUG(DEBUG_INFLUENCE, " followup for %m: intrusion at %1m\n",
- m, n, pos);
+ DEBUG(DEBUG_INFLUENCE, " followup for %1m: intrusion at %m\n",
+ saved_stone, pos);
}
}
@@ -876,10 +923,12 @@
current_influence->non_territory[I(pos)][J(pos)] |= color;
}
-/* Match the patterns in influence.db and barriers.db in order to add
- * influence barriers, add extra influence sources at possible
- * invasion and intrusion points, and add extra influence induced by
- * strong positions.
+/* Match the patterns in influence.db and barriers.db in order to add:
+ * - influence barriers,
+ * - extra influence sources at possible invasion and intrusion points, and
+ * - extra influence induced by strong positions.
+ * Reduce permeability around each living stone.
+ * Reset permeability to 1.0 at intrusion points.
*/
static void
find_influence_patterns(struct influence_data *q, int color)
@@ -891,7 +940,7 @@
if (color != EMPTY)
matchpat(influence_callback, color, &barrierspat_db, q, NULL);
- if (experimental_influence)
+ if (experimental_influence && !(q == &escape_influence))
add_marked_intrusions(q, color);
/* When color == EMPTY, we introduce a weaker kind of barriers
@@ -937,7 +986,8 @@
/* Compute the influence values for both colors, after having made a
* move for OTHER_COLOR(color) at (m, n). If these coordinates are -1
* no move is made. In any case it's assumed that color is in turn to
- * move.
+ * move. (This affects the barrier patterns (class A, D) and intrusions
+ * (class B).
*/
static void
compute_influence(struct influence_data *q, int color, int m, int n,
@@ -1125,28 +1175,43 @@
int i;
float ratio;
float diff;
- if (x <= f->range_lowerbound)
+ if (x < f->range_lowerbound)
return f->values[0];
- else if (x >= f->range_upperbound)
+ else if (x > f->range_upperbound)
return f->values[f->sections];
else {
- ratio = f->sections * ((x - f->range_lowerbound)
- /(f->range_upperbound - f->range_lowerbound));
+ ratio = ((float) f->sections) * (x - f->range_lowerbound)
+ /(f->range_upperbound - f->range_lowerbound);
i = ratio;
diff = ratio - ((float)i);
- return (diff*f->values[i] + (1-diff)* f->values[i+1]);
+ return ((1-diff)*f->values[i] + diff* f->values[i+1]);
}
}
+/* Determines how much influence is needed at least to claim an
+ * intersection as territory, in dependence of the "center value".
+ * (In the center, more effort is needed to get territory!)
+ */
+struct interpolation_data min_infl_for_territory =
+ { 6, 0.0, 24.0, { 10.0, 26.0, 37.0, 46.0, 54.0, 60.0, 65.0 }};
+
+/* Determines the territory correction factor in dependence of the ratio
+ * ( influence of stronger color / min_infl_for_territory(intersection))
+ */
struct interpolation_data territory_correction =
- { 5, (float) 0.0, 15.0, {0.0, 0.3, 0.55, 0.75, 0.9, 1.0}};
+ { 5, (float) 0.0, 1.0, {0.0, 0.3, 0.55, 0.75, 0.9, 1.0}};
static void
new_value_territory(struct influence_data *q)
{
int i, j;
+ int dist_i, dist_j;
+ float centralness;
float first_guess[MAX_BOARD][MAX_BOARD];
+ float ratio;
+#if 0
int k;
+#endif
/* First loop: guess territory directly from influence. */
for (i = 0; i < board_size; i++)
@@ -1160,9 +1225,12 @@
diff = (q->white_influence[i][j] - q->black_influence[i][j])
/(q->white_influence[i][j] + q->black_influence[i][j]);
first_guess[i][j] = diff * diff * diff;
- first_guess[i][j] *= interpolate(&territory_correction,
- gg_max(q->black_influence[i][j],
- q->white_influence[i][j]));
+ dist_i = gg_min(i, board_size - i -1);
+ dist_j = gg_min(j, board_size - j -1);
+ centralness = (float) 2 * gg_min(dist_i, dist_j) + dist_i + dist_j;
+ ratio = gg_max(q->black_influence[i][j], q->white_influence[i][j])
+ / interpolate(&min_infl_for_territory, centralness);
+ first_guess[i][j] *= interpolate(&territory_correction, ratio);
/* Dead stone, upgrade to territory. Notice that this is not
* the point for a prisoner, which is added later. Instead
@@ -1178,9 +1246,8 @@
q->territory_value[i][j] = first_guess[i][j];
}
- /* Second loop: Correct according to neighbour vertices, then look for
- * non-territory patterns and add prisoners.
- */
+#if 0
+ /* Second loop: Correct according to neighbour vertices. */
for (i = 0; i < board_size; i++)
for (j = 0; j < board_size; j++) {
if (q->p[i][j] == EMPTY) {
@@ -1204,6 +1271,7 @@
}
}
}
+#endif
/* Third loop: Nonterritory patterns, points for prisoners. */
for (i = 0; i < board_size; i++)
@@ -1536,6 +1604,9 @@
followup_influence.w[i][j] = UNMARKED;
}
+ followup_influence.intrusion_counter = 0;
+
+ current_influence = &followup_influence;
/* Match B patterns for saved stones. */
matchpat(followup_influence_callback, color, &barrierspat_db,
&followup_influence, NULL);
@@ -1545,6 +1616,9 @@
for (j = 0; j < board_size; j++)
followup_influence.w[i][j] = UNMARKED;
+ /* Now add the intrusions. */
+ add_marked_intrusions(&followup_influence, color);
+
/* It may happen that we have a low intensity influence source at a
* blocked intersection (due to an intrusion). Reset the
* permeability at this point.
@@ -1566,7 +1640,6 @@
}
/* Spread influence for new influence sources. */
- add_marked_intrusions(&followup_influence, color);
for (i = 0; i < board_size; i++)
for (j = 0; j < board_size; j++)
if ((color == BLACK
Index: engine/influence.h
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/influence.h,v
retrieving revision 1.6
diff -u -r1.6 influence.h
--- engine/influence.h 28 Jan 2002 14:49:33 -0000 1.6
+++ engine/influence.h 5 Feb 2002 08:09:51 -0000
@@ -32,7 +32,7 @@
/* default attenuation coefficient. */
#define DEFAULT_ATTENUATION 3.0
-#define EXP_DEFAULT_ATTENUATION 2.1
+#define EXP_DEFAULT_ATTENUATION 2.2
/* Extra damping coefficient for spreading influence diagonally. */
#define DIAGONAL_DAMPING 2.0
Index: engine/shapes.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/shapes.c,v
retrieving revision 1.23
diff -u -r1.23 shapes.c
--- engine/shapes.c 2 Feb 2002 10:27:16 -0000 1.23
+++ engine/shapes.c 5 Feb 2002 08:09:53 -0000
@@ -32,6 +32,23 @@
/* Maximum number of dragons considered by a, B, C, and d class patterns. */
#define MAX_DRAGONS_PER_PATTERN 5
+/* Values of joseki patterns. */
+#define U_VALUE 40
+#define J_VALUE 27
+#define j_VALUE 20
+#define t_VALUE 15
+
+/* Values of joseki patterns if using experimental influence. */
+#define EXP_J_VALUE 30
+#define EXP_j_VALUE 22
+#define EXP_t_VALUE 17
+
+/* Global variables set to joseki values acc. to experimental_influence. */
+float J_value = J_VALUE;
+float j_value = j_VALUE;
+float t_value = t_VALUE;
+
+
/*
* This callback is invoked for each matched pattern.
*/
@@ -287,7 +304,7 @@
}
/* Pattern class J, joseki standard move. Add expand territory and
- * moyo, and require the value at least 27.
+ * moyo, and require the value at least J_value.
*/
if (class & CLASS_J) {
TRACE("...joseki standard move\n");
@@ -295,16 +312,16 @@
TRACE("...expands territory\n");
add_expand_moyo_move(move);
TRACE("...expands moyo\n");
- set_minimum_move_value(move, 27);
- TRACE("... minimum move value %f\n", 27.0);
+ set_minimum_move_value(move, J_value);
+ TRACE("... minimum move value %f\n", J_value);
}
/* Pattern class j, less urgent joseki move. Add expand territory and
- * moyo, set a minimum value of 20. If it is a fuseki pattern, set also
- * the maximum value to 20.
+ * moyo, set a minimum value of j_value. If it is a fuseki pattern, set also
+ * the maximum value to j_value.
*/
if (class & CLASS_j) {
- float min_value = 20;
+ float min_value = j_value;
TRACE("...less urgent joseki move\n");
add_expand_territory_move(move);
TRACE("...expands territory\n");
@@ -332,10 +349,10 @@
}
/* Pattern class t, minor joseki move (tenuki OK).
- * Set the (min-)value at 15.
+ * Set the (min-)value at t_value
*/
if (class & CLASS_t) {
- float min_value = 15;
+ float min_value = t_value;
TRACE("...minor joseki move\n");
/* Board size modification. */
@@ -374,8 +391,8 @@
}
add_shape_value(move, 15);
TRACE("...shape value 15\n");
- set_minimum_move_value(move, 40);
- TRACE("...(min) move value %f\n", 40);
+ set_minimum_move_value(move, U_VALUE);
+ TRACE("...(min) move value %f\n", U_VALUE);
}
/* Pattern class T, joseki trick move. For the moment we never play
@@ -448,6 +465,13 @@
{
TRACE("\nPattern matcher is looking for move reasons for %s!\n",
color_to_string(color));
+
+ /* Modify joseki values if using experimental influence. */
+ if (experimental_influence) {
+ J_value = EXP_J_VALUE;
+ j_value = EXP_j_VALUE;
+ t_value = EXP_t_VALUE;
+ }
matchpat(shapes_callback, color, &pat_db, NULL, NULL);
Index: patterns/barriers.db
===================================================================
RCS file: /cvsroot/gnugo/gnugo/patterns/barriers.db,v
retrieving revision 1.22
diff -u -r1.22 barriers.db
--- patterns/barriers.db 28 Jan 2002 14:49:33 -0000 1.22
+++ patterns/barriers.db 5 Feb 2002 08:09:55 -0000
@@ -828,6 +828,13 @@
:8,B,value(30)
+xxxx
+..cX
+!!ba
+----
+
+>return (lib(a)>2 || (lib(a) == 2 && connect_and_cut_helper(a,b,c)));
+
Pattern Intrusion1b
@@ -838,6 +845,12 @@
:8,B,value(30)
+xxxx
+X.cX
+..ba
+----
+
+>return (lib(a)>2 || (lib(a) == 2 && connect_and_cut_helper(a,b,c)));
Pattern Intrusion1c
@@ -849,11 +862,29 @@
:8,B,value(30)
xxxx
-X..X
-.a.O
+X.dX
+.acb
----
;safe_omove(a)
+>return (lib(b)>2 || (lib(b) == 2 && connect_and_cut_helper(b,c,d)));
+
+Pattern Intrusion1d
+# ab New pattern (3.1.24).
+
+xxxx
+!!.X
+...O
+----
+
+:8,B,value(30)
+
+xxxx
+a!cX
+..bO
+----
+
+;!oplay_defend(a,b,c,b)
Pattern Intrusion2
@@ -866,6 +897,14 @@
:8,B,value(30)
+xXx?
+..ab
+!!..
+----
+
+>return (!xplay_attack(a,b));
+
+
Pattern Intrusion3
# ab 3.1.22 Constraint added (see 13x13:52)
@@ -893,12 +932,13 @@
:8,B,value(30)
-XOOX
+XdOX
baC.
!...
----
;oplay_attack(a,b,C)
+>return (!xplay_attack(a,d));
Pattern Intrusion5
@@ -910,12 +950,13 @@
:8,B,value(30)
-XbOX
+XbdX
.aC.
.!..
----
;oplay_attack(a,b,C)
+>return (!xplay_attack(b,d));
Pattern Intrusion6
@@ -950,11 +991,12 @@
:8,BY,value(30)
-OA
+cA
ba
;oplay_attack_either(a,b,A,b);
+>return (!xplay_attack(b,c));
Pattern Intrusion8
@@ -999,10 +1041,11 @@
xxx?
..CO
-!baO
+!bad
----
;oplay_attack_either(a,b,b,C)
+>return (!xplay_attack(a,d));
Pattern Intrusion11
@@ -1042,10 +1085,24 @@
cXa
...
...
----
;oplay_attack(a,b,b) || oplay_attack(c,d,d)
+Pattern Intrusion12a
+
+oOo
+.X!
+...
+
+:8,BY,value(30)
+
+oOb
+.Ca
+...
+
+;o_somewhere(b) || oplay_attack_either(a,b,b,C)
+
Pattern Intrusion13
@@ -1101,21 +1158,23 @@
Pattern Intrusion16
+# ab value decreased (3.1.24)
O!.
!!.
.xX
-:8,B,value(30)
+:8,B,value(20)
Pattern Intrusion17
+# ab value decreased (3.1.24)
O!.
.!.
XxX
-:8,B,value(30)
+:8,B,value(20)
Pattern Intrusion18
@@ -1139,6 +1198,13 @@
:8,B,value(30)
+X..
+ba.
+o..
+xXx
+
+>return (!xplay_attack(a,b));
+
Pattern Intrusion20
oO!
@@ -1146,10 +1212,11 @@
:8,B,value(30)
-oO!
-OAb
+edc
+fAb
;lib(A)==2 && !oplay_attack(b,b)
+>return (!xplay_attack(c,d) && xplay_defend_both(e,d,f));
Pattern Intrusion21
@@ -1187,11 +1254,12 @@
:8,B,value(10)
-Ob.
+eb.
dca
---
;oplay_attack_either(a,b,c,d,b,d)
+>return (!xplay_attack(b,e));
Pattern Intrusion24
@@ -1297,6 +1365,14 @@
:8,B,value(30)
+ooo
+Xb.
+.a!
+.!.
+?.?
+
+>return (!xplay_attack(a,b));
+
Pattern Intrusion32
@@ -1307,6 +1383,13 @@
:8,B,value(30)
+ooo
+Xb.
+.a.
+?.?
+
+>return (!xplay_attack(a,b));
+
Pattern Intrusion33
@@ -1333,6 +1416,7 @@
?.?
;oplay_attack(a,b,b)
+>return 0;
Pattern Intrusion35
@@ -1365,10 +1449,11 @@
:8,B,value(30)
?X
-Oa
+ba
Xx
;safe_omove(a)
+>return (!xplay_attack(a,b));
Pattern Intrusion37
@@ -1395,10 +1480,11 @@
:8,B,value(5)
X?
-aO
+ab
--
;safe_omove(a)
+> return (!xplay_attack(a,b));
Pattern Intrusion39
@@ -1553,14 +1639,14 @@
Pattern Intrusion48
# ab New pattern. (3.1.23)
+# FIXME: This would need a constraint. The one below did not work.
?X.
...
O.!
..X
-:8,B,value(30)
-
+:8,B,value(20)
# .X.
# fce
@@ -1569,7 +1655,19 @@
#
# ;oplay_attack(a,b,c,d,e,f,f)
+Pattern Intrusion49
+# ab added (3.1.24)
+
+XOX
+.!!
+
+:8,B,value(30)
+
+bcX
+.a!
+;oplay_attack(a,b) && ! attack(b)
+>return (!xplay_attack(a,c));
Pattern Nonterritory1
Index: patterns/endgame.db
===================================================================
RCS file: /cvsroot/gnugo/gnugo/patterns/endgame.db,v
retrieving revision 1.27
diff -u -r1.27 endgame.db
--- patterns/endgame.db 1 Feb 2002 17:28:44 -0000 1.27
+++ patterns/endgame.db 5 Feb 2002 08:09:58 -0000
@@ -218,7 +218,24 @@
...*..
------
-:8,OXb,terri(2),followup(1)
+:8,OXbFY,terri(2),followup(1)
+
+.OOOXX
+..a*bc
+------
+
+; proper_eye(a) && !oplay_attack(*,*) && oplay_attack(b,*,a,c,*,a)
+; && xplay_attack(*,a,b,a)
+
+
+Pattern EE6Y
+# gf Added followup value. (3.1.14)
+
+.OOOXX
+...*..
+------
+
+:8,OXbY,terri(2)
.OOOXX
..a*bc
@@ -351,7 +368,22 @@
..*..
-----
-:8,eOX,terri(2),followup(6)
+:8,eOXFY,terri(2),followup(6)
+
+?OE..
+bc*a.
+-----
+
+;proper_eye(a) && proper_eye(b) && oplay_attack_either(*,a,c,a,E)
+
+
+Pattern EE105Y
+
+?OX.. three points sente
+..*..
+-----
+
+:8,eOXY,terri(2)
?OE..
bc*a.
@@ -420,7 +452,7 @@
*..
---
-:8,OX,followup(1)
+:8,OXFY,followup(1)
XX?
*a.
@@ -451,7 +483,22 @@
.O*.
----
-:8,eOX,terri(1),followup(4),reverse_followup(2)
+:8,eOXFY,terri(1),followup(4),reverse_followup(2)
+
+ODDc
+bO*a
+----
+
+;marginal_eye(*) && marginal_eye(a) && marginal_eye(c)
+;&& (oplay_attack(*,a,b,a) || oplay_attack(*,a,b,D))
+
+Pattern EE203Y
+
+OXX. 1 point double sente
+.O*.
+----
+
+:8,eOXY,terri(1),reverse_followup(2)
ODDc
bO*a
@@ -915,6 +962,7 @@
Pattern EE902
+# Why does this have followup value? -ab
?.? endgame move
O*O one point sente
@@ -959,7 +1007,7 @@
....
----
-:8,eOX,terri(1),followup(3)
+:8,eOXY,terri(1),followup(3)
OO*?
XX.X
@@ -1267,7 +1315,21 @@
.*. one point sente
X.O
-:8,eOX,terri(1),followup(2)
+:8,eOXFY,terri(1),followup(2)
+
+.X?
+a*.
+X.O
+
+;marginal_eye(*) && proper_eye(a)
+
+Pattern CE15Y
+
+.X? sente endgame move
+.*. one point sente
+X.O
+
+:8,eOXY,terri(1)
.X?
a*.
@@ -1297,7 +1359,21 @@
.*O one point sente
X??
-:8,eOX,terri(1),followup(2)
+:8,eOXFY,terri(1),followup(2)
+
+.X?
+a*O
+X??
+
+;marginal_eye(*) && proper_eye(a) && olib(*)>2
+
+Pattern CE16Y
+
+.X? sente endgame move
+.*O one point sente
+X??
+
+:8,eOXY,terri(1)
.X?
a*O
@@ -1327,7 +1403,21 @@
.* one point sente
xX
-:8,eXO,terri(1),followup(2)
+:8,eXOFY,terri(1),followup(2)
+
+XO
+a*
+xX
+
+;marginal_eye(*) && proper_eye(a) && olib(*)>2
+
+Pattern CE17Y
+
+XO endgame move
+.* one point sente
+xX
+
+:8,eXOY,terri(1),followup(2)
XO
a*
@@ -1539,7 +1629,7 @@
*..
?X?
-:-,X,followup(1)
+:-,XY,followup(1)
?X?
*a.
@@ -1557,7 +1647,7 @@
x.x
X*X
-:|,X,followup(2)
+:|,XY,followup(2)
xBx
AdC
Index: patterns/helpers.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/patterns/helpers.c,v
retrieving revision 1.26
diff -u -r1.26 helpers.c
--- patterns/helpers.c 2 Feb 2002 19:05:12 -0000 1.26
+++ patterns/helpers.c 5 Feb 2002 08:10:00 -0000
@@ -358,41 +358,24 @@
/*
* ?x?? ?x??
- * ?X.. ?cb.
- * O*.. O*a.
- * ---- ----
+ * ?X.. ?Xb.
+ * O*.. c*a.
*
+ * Is the push at * sente? c must have exactly two liberties. This is
+ * called edge_double_sente_helper because it mainly called for edge
+ * hanes, but it can be used anywhere on the board.
*/
int
-edge_double_sente_helper(ARGS)
+edge_double_sente_helper(int move, int apos, int bpos, int cpos)
{
- int apos;
- int bpos;
- int cpos;
- int dpos;
- int other = OTHER_COLOR(color);
+ int color = board[cpos];
int success = 0;
- UNUSED(pattern);
+ ASSERT1((color == BLACK || color == WHITE), move);
- apos = OFFSET( 0, 1);
- bpos = OFFSET(-1, 1);
- cpos = OFFSET(-1, 0);
-
if (TRYMOVE(move, color)) {
- if (TRYMOVE(apos, other)) {
- ASSERT1(countlib(move) == 1, move);
- findlib(move, 1, &dpos);
- if (TRYMOVE(dpos, color)) {
- if (TRYMOVE(bpos, color)) {
- if (board[cpos] == EMPTY || !defend_both(apos, cpos))
- success = 1;
- popgo();
- }
- popgo();
- }
- popgo();
- }
+ ASSERT1(countlib(move) == 2, move);
+ success = connect_and_cut_helper(move, apos, bpos);
popgo();
}
Index: patterns/mkpat.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/patterns/mkpat.c,v
retrieving revision 1.51
diff -u -r1.51 mkpat.c
--- patterns/mkpat.c 1 Feb 2002 16:43:53 -0000 1.51
+++ patterns/mkpat.c 5 Feb 2002 08:10:08 -0000
@@ -208,6 +208,7 @@
{"olib", 1, "accurate_approxlib(%s,color, MAXLIBS, NULL)"},
{"xcut", 1, "cut_possible(%s,OTHER_COLOR(color))"},
{"ocut", 1, "cut_possible(%s,color)"},
+ {"edge_double_sente", 4, "edge_double_sente_helper(%s, %s, %s, %s)"},
{"xplay_defend_both", -2,
"play_attack_defend2_n(OTHER_COLOR(color), 0, %d"},
{"oplay_defend_both", -2, "play_attack_defend2_n(color, 0, %d"},
@@ -1103,6 +1104,16 @@
case 3:
code_pos += sprintf(code_pos, autohelper_functions[funcno].code,
varnames[0], varnames[1], varnames[2]);
+ break;
+ case 4:
+ code_pos += sprintf(code_pos, autohelper_functions[funcno].code,
+ varnames[0], varnames[1], varnames[2],
+ varnames[3]);
+ break;
+ default:
+ fprintf(stderr, "%s(%d) : error : unknown number of parameters (pattern
%s)",
+ current_file, current_line_number, pattern_names[patno]);
+ fatal_errors++;
}
return;
}
Index: patterns/patterns.db
===================================================================
RCS file: /cvsroot/gnugo/gnugo/patterns/patterns.db,v
retrieving revision 1.51
diff -u -r1.51 patterns.db
--- patterns/patterns.db 1 Feb 2002 17:28:44 -0000 1.51
+++ patterns/patterns.db 5 Feb 2002 08:10:24 -0000
@@ -5832,14 +5832,14 @@
O*..
----
-:8,OXe,followup(4),edge_double_sente_helper
+:8,OXe,followup(4)
?x??
-?X.b
-a*..
+?Xbd
+c*a.
----
-;xmoyo(b) && lib(a)==2
+;xmoyo(d) && lib(c)==2 && edge_double_sente(*,a,b,c)
#################
@@ -13016,7 +13016,7 @@
....
----
-:8,OXebE
+:8,OXebEFY
O.Xx
.*.a
@@ -13026,6 +13026,16 @@
;xmoyo(a)
+Pattern LE1Y
+
+O.Xx fourth line sente kosumi
+.*..
+....
+....
+----
+
+:8,OXebEY
+
Pattern LE2a
@@ -13035,7 +13045,7 @@
....
----
-:8,OX,value(6)
+:8,OXFY,value(6)
?bc?
O.Xx
@@ -13054,7 +13064,7 @@
.....
-----
-:8,OX,value(10)
+:8,OXFY,value(10)
?bc??
O.Xxx
@@ -13064,6 +13074,16 @@
;xmoyo(a) && (!o_somewhere(c)||o_somewhere(b))
+Pattern LE2Y
+
+????? third line sente kosumi
+O.Xxx
+.*...
+.....
+-----
+
+:8,OXY
+
Pattern LE3
@@ -13073,7 +13093,7 @@
O..
o..
-:8,OX,value(7)
+:8,OXFY,value(7)
xXx
...
@@ -13083,6 +13103,16 @@
;omoyo(a)
+Pattern LE3Y
+
+xXx expand territory
+...
+.*.
+O..
+o..
+
+:8,OXY
+
Pattern LE4
# gf Revised constraint. (3.1.9)
@@ -13108,7 +13138,7 @@
....
----
-:8,OX,value(12)
+:8,OXFY,value(12)
?Xxx
A...
@@ -13118,6 +13148,16 @@
; xmoyo(*) && lib(A) > 2
+Pattern LE5Y
+
+?Xxx
+O...
+..*.
+....
+----
+
+:8,OXY
+
Pattern LE6
# At move 96 of ego.tst, this is matched at J8.
@@ -13149,7 +13189,7 @@
X*..
O...
-:8,OX,value(8)
+:8,OXFY,value(8)
x.Oo
X*.a
@@ -13184,7 +13224,18 @@
.....
-----
-:8,OX,value(10)
+:8,OXFY,value(10)
+
+Pattern LE9Y
+
+oo..? good local sente
+..O.x
+O*X..
+....X
+.....
+-----
+
+:8,OXY
Pattern LE10
@@ -13209,7 +13260,7 @@
...
.O?
-:8,O,value(8)
+:8,OFY,value(8)
.a.
.*.
@@ -13218,6 +13269,15 @@
; xmoyo(a)
+Pattern LE11Y
+
+... jump towards the opponent's territory
+.*.
+...
+.O?
+
+:8,OY
+
Pattern LE12
@@ -13292,7 +13352,7 @@
OoO
?o?
-:|,OE,value(7)
+:|,OEFY,value(7)
def
abc
@@ -13303,6 +13363,19 @@
?o?
; xmoyo(a)||xmoyo(b)||xmoyo(c)||xmoyo(d)||xmoyo(e)||xmoyo(f)
+
+Pattern LE15Y
+# tm decreased value (3.1.20) (see nngs:1150 move G4)
+
+xxx jump towards moyo
+x.x
+.*.
+...
+...
+OoO
+?o?
+
+:|,OEY
Pattern LE16
Index: patterns/patterns.h
===================================================================
RCS file: /cvsroot/gnugo/gnugo/patterns/patterns.h,v
retrieving revision 1.20
diff -u -r1.20 patterns.h
--- patterns/patterns.h 2 Feb 2002 10:27:16 -0000 1.20
+++ patterns/patterns.h 5 Feb 2002 08:10:26 -0000
@@ -204,6 +204,12 @@
#define HAVE_CONSTRAINT 1
#define HAVE_ACTION 2
+/* Values of the action parameter to indicate where an influence autohelper
+ * is called from.
+ */
+#define INFLUENCE_CALLBACK 1
+#define FOLLOWUP_INFLUENCE_CALLBACK 2
+
typedef struct patval {
int x;
@@ -286,7 +292,6 @@
DECLARE(throw_in_atari_helper);
DECLARE(ugly_cutstone_helper);
DECLARE(cutstone2_helper);
-DECLARE(edge_double_sente_helper);
/* autohelper fns */
int not_lunch_helper(int apos, int bpos);
@@ -300,6 +305,7 @@
int backfill_helper(int apos, int bpos, int cpos);
int owl_threatens_attack(int apos, int bpos);
int connect_and_cut_helper(int Apos, int bpos, int cpos);
+int edge_double_sente_helper(int move, int apos, int bpos, int cpos);
/* pattern arrays themselves */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gnugo-devel] arend_1_25.1: experimental influence,
Arend Bayer <=