Index: engine/dragon.c =================================================================== RCS file: /cvsroot/gnugo/gnugo/engine/dragon.c,v retrieving revision 1.64 diff -u -r1.64 dragon.c --- engine/dragon.c 23 May 2002 20:18:01 -0000 1.64 +++ engine/dragon.c 29 May 2002 10:32:31 -0000 @@ -105,26 +105,28 @@ find_connections(); time_report(2, " time to find connections", NO_MOVE, 1.0); - /* Amalgamate dragons sharing an eyespace (not ko). */ + if (!experimental_connections) { + /* Amalgamate dragons sharing an eyespace (not ko). */ - for (str = BOARDMIN; str < BOARDMAX; str++) - if (ON_BOARD(str)) { + for (str = BOARDMIN; str < BOARDMAX; str++) + if (ON_BOARD(str)) { - if (black_eye[str].color == BLACK_BORDER - && black_eye[str].origin == str) { - if (!is_ko_point(str) - || black_eye[str].esize > 1) /* Only exclude living kos. */ - dragon_eye(str, black_eye); + if (black_eye[str].color == BLACK_BORDER + && black_eye[str].origin == str) { + if (!is_ko_point(str) + || black_eye[str].esize > 1) /* Only exclude living kos. */ + dragon_eye(str, black_eye); + } + + if (white_eye[str].color == WHITE_BORDER + && white_eye[str].origin == str) { + if (!is_ko_point(str) + || white_eye[str].esize > 1) /* Only exclude living kos. */ + dragon_eye(str, white_eye); + } } - - if (white_eye[str].color == WHITE_BORDER - && white_eye[str].origin == str) { - if (!is_ko_point(str) - || white_eye[str].esize > 1) /* Only exclude living kos. */ - dragon_eye(str, white_eye); - } - } - time_report(2, " time to amalgamate dragons", NO_MOVE, 1.0); + time_report(2, " time to amalgamate dragons", NO_MOVE, 1.0); + } /* At this time, all dragons have been finalized and we can * initialize the dragon2[] array. After that we can no longer allow Index: engine/optics.c =================================================================== RCS file: /cvsroot/gnugo/gnugo/engine/optics.c,v retrieving revision 1.45 diff -u -r1.45 optics.c --- engine/optics.c 22 May 2002 19:22:25 -0000 1.45 +++ engine/optics.c 29 May 2002 10:32:31 -0000 @@ -560,9 +560,11 @@ (*esize)++; if (eye[pos].marginal) (*msize)++; - if (eye[pos].type & INHIBIT_CONNECTION) - return; + if (!experimental_connections) + if (eye[pos].type & INHIBIT_CONNECTION) + return; + for (k = 0; k < 4; k++) { int pos2 = pos + delta[k]; if (ON_BOARD(pos2) Index: engine/readconnect.c =================================================================== RCS file: /cvsroot/gnugo/gnugo/engine/readconnect.c,v retrieving revision 1.33 diff -u -r1.33 readconnect.c --- engine/readconnect.c 28 Apr 2002 14:46:43 -0000 1.33 +++ engine/readconnect.c 29 May 2002 10:32:32 -0000 @@ -1067,11 +1067,22 @@ *move = PASS_MOVE; if (alternate_connections) { + int reading_nodes_when_called = get_reading_node_counter(); + double start = 0; + int tactical_nodes; save_verbose = verbose; if (verbose > 0) verbose--; + start = gg_cputime(); result = recursive_connect2(str1, str2, move, EMPTY, NO_MOVE, 0); verbose = save_verbose; + tactical_nodes = get_reading_node_counter() - reading_nodes_when_called; + + if (0) + gprintf("%oconnect %1M %1M, result %d %1M (%d, %d nodes, %f seconds)\n", + str1, str2, result, *move, + nodes_connect, tactical_nodes, gg_cputime() - start); + return result; } @@ -1189,11 +1200,22 @@ *move = PASS_MOVE; if (alternate_connections) { + int reading_nodes_when_called = get_reading_node_counter(); + double start = 0; + int tactical_nodes; save_verbose = verbose; if (verbose > 0) - verbose --; + verbose--; + start = gg_cputime(); result = recursive_disconnect2(str1, str2, move, EMPTY, NO_MOVE, 0); verbose = save_verbose; + tactical_nodes = get_reading_node_counter() - reading_nodes_when_called; + + if (0) + gprintf("%odisconnect %1m %1m, result %d %1m (%d, %d nodes, %f seconds)\n", + str1, str2, result, *move, + nodes_connect, tactical_nodes, gg_cputime() - start); + return result; } @@ -2168,7 +2190,8 @@ } if (board[pos] == EMPTY) { - if (!is_self_atari(pos, color_to_move)) { + if (!is_self_atari(pos, color_to_move) + || is_ko(pos, color_to_move, NULL)) { ADD_CANDIDATE_MOVE(pos, distance, moves, distances, num_moves); } else { Index: patterns/conn.db =================================================================== RCS file: /cvsroot/gnugo/gnugo/patterns/conn.db,v retrieving revision 1.22 diff -u -r1.22 conn.db --- patterns/conn.db 16 May 2002 09:02:29 -0000 1.22 +++ patterns/conn.db 29 May 2002 10:32:32 -0000 @@ -36,12 +36,18 @@ # # Classification # -# The connection database contains patterns of four different classes, +# The connection database contains patterns of three different classes, # which also are matched separately. # # B - Indicate cutting points and inhibit connections. -# C - Amalgamate worms into dragons -# e - Modify eye space, late matching +# C - Amalgamate worms into dragons. +# I - Invalidate lunches, late matching. +# +# Additionally there are a few acceptance modifiers. +# +# s - Accept even if the pattern includes tactically unsafe strings +# W - Only used with standard connections. +# Y - Only used with experimental connections. # ################################### # @@ -56,8 +62,7 @@ # CB - Center B patterns # EC - Edge C patterns # CC - Center C patterns -# Eye - eye modification patterns of e classification -# Lunch - patterns that invalidate lunches, matched with e patterns +# Lunch - patterns that invalidate lunches, matched with I patterns # ################################### @@ -73,7 +78,7 @@ O*! --- -:8,B +:8,BW Pattern EB2 @@ -83,7 +88,7 @@ .!. --- -:8,B +:8,BW Pattern EB3 @@ -94,7 +99,7 @@ x.!? ---- -:8,B +:8,BW Pattern EB4 @@ -104,7 +109,7 @@ ..!! ---- -:8,B +:8,BW Pattern EB5 @@ -114,7 +119,7 @@ .!. --- -:|,B +:|,BW Pattern EB6 @@ -125,7 +130,7 @@ .!. --- -:8,B +:8,BW ?XO O*! @@ -144,7 +149,7 @@ .!. --- -:8,B +:8,BW Xx? c*O @@ -162,7 +167,7 @@ O!. --- -:8,B +:8,BW Pattern EB9 @@ -173,7 +178,7 @@ .!. --- -:8,B +:8,BW ?X? XOX @@ -191,7 +196,7 @@ .!. --- -:8,B +:8,BW OaX !*b @@ -209,7 +214,7 @@ .!.. ---- -:8,B +:8,BW ?XX? O*Oc @@ -228,7 +233,7 @@ ..!. ---- -:8,B +:8,BW ??X? Oc*O @@ -246,7 +251,7 @@ o!o --- -:|,B +:|,BW ?X? b*c @@ -265,7 +270,7 @@ ..!. ---- -:8,B +:8,BW ??X? Oc*O @@ -284,7 +289,7 @@ ..!O ---- -:8,B +:8,BW Pattern EB16 @@ -294,7 +299,7 @@ ..!o ---- -:8,B +:8,BW ??X? Oc*O @@ -313,7 +318,7 @@ .!. --- -:8,B +:8,BW Pattern EB18 @@ -323,7 +328,7 @@ .!. --- -:8,B +:8,BW XaO d*b @@ -340,7 +345,7 @@ O*. --- -:8,B +:8,BW XaO b*. @@ -358,7 +363,7 @@ .!.? ---- -:8,B +:8,BW Pattern EB21 @@ -369,7 +374,7 @@ ..!. ---- -:8,B +:8,BW ??X? .D*O @@ -389,7 +394,7 @@ ..!. ---- -:8,B +:8,BW ??X? ?XOX @@ -408,7 +413,7 @@ .!O --- -:8,B +:8,BW Pattern EB24 @@ -420,7 +425,7 @@ .!o --- -:8,B +:8,BW ??X ?!. @@ -439,7 +444,7 @@ .!. --- -:8,B +:8,BW ca. b*d @@ -462,7 +467,7 @@ X*O ?O. -:8,B +:8,BW ?Oa X*O @@ -471,6 +476,21 @@ ;!xplay_attack_either(*,a,b,*,b) && !xplay_attack_either(*,b,a,*,a) +Pattern CB1b + +?O. fragile double connection +X*O +?O. + +:8,BY + +?b. +X*O +?a. + +;!xplay_connect(*,a,b) + + Pattern CB2 ?O. @@ -478,7 +498,7 @@ X*O ?O. -:8,B +:8,BW ?O. ?ca @@ -488,13 +508,30 @@ ;!xplay_attack_either(*,a,b,*,b) && xplay_defend_both(*,b,a,c,*,a) +Pattern CB2b + +?O. +?.. fragile double connection +X*O +?O. + +:8,BY + +?b. +?.. +X*O +?a. + +;!xplay_connect(*,a,b) + + Pattern CB3 O!O !*X .O? -:8,B +:8,BW O!a !*X @@ -503,13 +540,28 @@ ;lib(a)==2 || lib(b) == 2 +Pattern CB3b + +O!O +.*X +.O? + +:8,BY + +O!a +.*X +.b? + +;!xplay_connect(*,a,b) + + Pattern CB4 XO? O*! ?!? -:\,B,basic_cut_helper +:\,BW,basic_cut_helper Pattern CB5 @@ -525,7 +577,7 @@ XO O* -:\,B,basic_cut_helper +:\,BW,basic_cut_helper Pattern CB6 @@ -537,7 +589,7 @@ XO O* -:\,B,ugly_cutstone_helper +:\,BW,ugly_cutstone_helper AO O* @@ -568,7 +620,7 @@ .!O xOo -:8,B +:8,BW Pattern CB9 @@ -578,7 +630,7 @@ O!. ?XX -:8,B +:8,BW BaO O*. @@ -594,7 +646,7 @@ O*O X!o -:8,B +:8,BW oaB O*O @@ -610,7 +662,7 @@ ?*!O ??O? -:8,B +:8,BW ?OA? OaOB @@ -620,13 +672,30 @@ ;!attack(A) && !attack(B) && !xplay_attack(*,a,b,*) && !xplay_attack(*,b,a,*) +Pattern CB11b + +?OX? +O!OX +?*!O +??O? + +:8,BY + +?bX? +O!OX +?*!a +??O? + +;!xplay_connect(*,a,b) + + Pattern CB12 # tm New pattern. (3.1.13) O*. another way to cut! X!O -:8,B +:8,BW O*. BaO @@ -642,7 +711,7 @@ O*O Xxx -:8,B +:8,BW xxx dae @@ -662,7 +731,7 @@ XO*O double cut. O!O! -:8,XB +:8,XBW XA*O ObOc @@ -680,7 +749,7 @@ OXO !O! -:8,B +:8,BW ?*? OXO @@ -690,6 +759,58 @@ ; && !xplay_attack_either(*,a,b,*,b) +Pattern CB15b +# tm New Pattern (3.1.23) (see global:17, ) +# careful not to break trevord:730 +# FIXME: Need to use amalgamate_most_valuable helper. +# xplay_disconnect helper also might be useful here. + +?*? save cutting stone. +OXO +!O! + +:8,BY + +?*? +aXb +!O! + +;!xplay_connect(*,a,b) + + +Pattern CB16 + +?O +x* fragile double connection +XO +O! + +:8,BY + +?a +x* +XO +b! + +;!xplay_connect(*,a,b) + + +Pattern CB17 + +O!O +!*? fragile double connection +O?? + + +:\,BY + +O!a +!*? +b?? + +;!xplay_connect(*,a,b) + + ######################## # # C patterns on the edge @@ -726,7 +847,7 @@ ... --- -:|,C +:|,CW OaO dbc @@ -766,7 +887,7 @@ ....o ----- -:8,C +:8,CW ojc.? iOaO? @@ -784,7 +905,7 @@ ...O ---- -:8,C +:8,CW Oae? cbdf @@ -823,7 +944,7 @@ .. OO -:+,C +:+,CW Pattern CC103 @@ -899,6 +1020,7 @@ Pattern CC109 +# gf Revised constraint. (3.3.3) O.oo ..oo @@ -907,12 +1029,12 @@ :8,C -O.oo +c.oo .aoo .boo -.Ooo +.doo -;omoyo(a) && omoyo(b) +;omoyo(a) && omoyo(b) && lib(c)>=4 && lib(d)>=4 ########################################################## @@ -927,7 +1049,7 @@ .. O. -:8,C +:8,CW OO ab @@ -942,7 +1064,7 @@ .. OX -:8,C +:8,CW OO ab @@ -957,7 +1079,7 @@ .. OX -:8,C +:8,CW DO ab @@ -972,7 +1094,7 @@ . O -:+,C +:+,CW O A @@ -988,7 +1110,7 @@ ?XO ?O. -:\,C +:\,CW ?c? dAO @@ -1008,7 +1130,7 @@ ..O ooo -:8,C +:8,CW Obc daO @@ -1025,7 +1147,7 @@ ..... .O..O -:8,C +:8,CW oOO.. feca. @@ -1039,7 +1161,7 @@ XO OX -:X,C +:X,CW AO OB @@ -1057,26 +1179,13 @@ # #################################### -#Pattern CC301 -# -#O.O -#... -# -#:8,C -# -#OaO -#dbc -# -#;xplay_attack(a,b,c,c) && xplay_attack(a,b,d,d) - - Pattern CC302 ?O. ... ?O. -:-,C +:-,CW ?gd cab @@ -1100,7 +1209,7 @@ O.. ..O -:8,C +:8,CW Ebc daF @@ -1117,7 +1226,7 @@ O. oO -:8,C +:8,CW dO ab @@ -1138,7 +1247,7 @@ ..O ... -:8,C +:8,CW Obc daf @@ -1159,7 +1268,7 @@ O..O O..O -:+,C +:+,CW OadO ObcO @@ -1172,7 +1281,7 @@ O..O O... -:8,C +:8,CW OacO Obde @@ -1186,7 +1295,7 @@ O..O O... -:8,C +:8,CW Oadf Obce @@ -1258,6 +1367,208 @@ > amalgamate_most_valuable_helper(e,f,g); +#################################################################### +# +# CC5xx - experimental connection patterns +# +#################################################################### + +Pattern CC501 +# Connect even if stones not tactically safe. + +xO +O. + +:\,sCY + +xO +Oc + +;x_suicide(c) + + +Pattern CC502 +# Connect even if stones not tactically safe. + +XO +O. + +:\,sCY + +Xb +ac + +;lib(a)>1 && lib(b)>1 && !xcut(c) && xlib(c)==1 && xplay_attack(c,c)==WIN + + +Pattern CC502b +# Connect even if stones not tactically safe. + +.O +O. + +:\,sCY + +db +ac + +;lib(a)>1 && lib(b)>1 && !xcut(c) && !xcut(d) +;&& xlib(c)==1 && xplay_attack(c,c) + + +Pattern CC503 + +O +. +O + +:+,CY + +c +a +b + +;!xcut(a) && !oplay_disconnect(b,c) + + +Pattern CC504 + +XO +O. + +:\,CY + +Xb +ca + +;!xcut(a) && !oplay_disconnect(b,c) + + +Pattern CC505 + +XO +OX + +:X,CY + +Bc +dA + +;(attack(A) || attack(B)) && !oplay_disconnect(c,d) + + +Pattern CC506 + +O +. +. +O + +:+,CY + +c +a +b +d + +;!xcut(a) && !xcut(b) && !oplay_disconnect(c,d) + + +Pattern CC506b + +O. +Xo +.. +O. + +:+,CY + +c. +Eo +ab +d. + +;!xcut(a) && !xcut(b) && lib(E)<=2 && !oplay_disconnect(c,d) + + +Pattern CC507 + +Ox +.. +xO + +:O,CY + +cx +ab +xd + +;!xcut(a) && !xcut(b) && !oplay_disconnect(c,d) + + +Pattern CC508 + +O? +.X +xO + +:8,CY + +b? +aX +?c + +;!xcut(a) && !oplay_disconnect(b,c) + + +Pattern CC509 + +Ox +.. +.. +xO + +:O,CY + +ex +ab +cd +xf + +;!xcut(a) && !xcut(b) && !xcut(c) && !xcut(d) && !oplay_disconnect(e,f) + + +# Pattern CC510 +# +# O? +# .x +# .X +# ?O +# +# :8,CY +# +# c? +# ax +# bX +# ?d +# +# ;!xcut(a) && !xcut(b) && !oplay_disconnect(c,d) + + +Pattern CC511 +# Connect even if stones not tactically safe. + +.O +O. + +:\,sCY + +db +ac + +;attack(a) && attack(b) && !xcut(c) && !xcut(d) + + ############################# # # lunch invalidating patterns @@ -1272,7 +1583,7 @@ oo| ?o| -:8,se +:8,sI ba| O.| @@ -1289,7 +1600,7 @@ OX| o.| -:8,se +:8,sI ba| cX| @@ -1307,7 +1618,7 @@ oo| --+ -:8,se +:8,sI ba| O.| Index: patterns/connections.c =================================================================== RCS file: /cvsroot/gnugo/gnugo/patterns/connections.c,v retrieving revision 1.23 diff -u -r1.23 connections.c --- patterns/connections.c 4 Mar 2002 06:49:08 -0000 1.23 +++ patterns/connections.c 29 May 2002 10:32:32 -0000 @@ -46,6 +46,14 @@ int other = OTHER_COLOR(color); UNUSED(data); + + /* Only match W patterns with standard connections. */ + if ((pattern->class & CLASS_W) && experimental_connections) + return; + + /* Only match Y patterns with experimental connections. */ + if ((pattern->class & CLASS_Y) && !experimental_connections) + return; move = AFFINE_TRANSFORM(pattern->movei, pattern->movej, ll, m, n); @@ -94,7 +102,7 @@ return; } - if ((pattern->class & (CLASS_B | CLASS_E | CLASS_e)) + if ((pattern->class & (CLASS_B | CLASS_I)) && !(pattern->class & CLASS_s)) { /* Require that the X stones in the pattern are tactically safe. */ for (k = 0; k < pattern->patlen; ++k) { /* match each point */ @@ -120,11 +128,8 @@ else if (pattern->class & CLASS_C) TRACE("Connecting pattern %s+%d found at %1m\n", pattern->name, ll, anchor); - else if (pattern->class & CLASS_E) - TRACE("Eye space modifying pattern %s+%d found at %1m\n", - pattern->name, ll, anchor); - else if (pattern->class & CLASS_e) - TRACE("Eye space modifying pattern %s+%d found at %1m\n", + else if (pattern->class & CLASS_I) + TRACE("Lunch invalidating pattern %s+%d found at %1m\n", pattern->name, ll, anchor); /* does the pattern have an action? */ @@ -168,8 +173,9 @@ /* Look for dragons to amalgamate. Never amalgamate stones which * can be attacked. */ - if ((pattern->class & CLASS_C) && (board[pos] == color) - && (worm[pos].attack_codes[0] == 0)) { + if ((pattern->class & CLASS_C) + && board[pos] == color + && ((pattern->class & CLASS_s) || worm[pos].attack_codes[0] == 0)) { if (first_dragon == NO_MOVE) first_dragon = dragon[pos].origin; else if (second_dragon == NO_MOVE @@ -216,7 +222,7 @@ conn_callback(int m, int n, int color, struct pattern *pattern, int ll, void *data) { - if (!(pattern->class & (CLASS_B | CLASS_e))) + if (!(pattern->class & (CLASS_B | CLASS_I))) cut_connect_callback(m, n, color, pattern, ll, data); } @@ -225,7 +231,7 @@ modify_eye_callback(int m, int n, int color, struct pattern *pattern, int ll, void *data) { - if (pattern->class & CLASS_e) + if (pattern->class & CLASS_I) cut_connect_callback(m, n, color, pattern, ll, data); } Index: patterns/mkpat.c =================================================================== RCS file: /cvsroot/gnugo/gnugo/patterns/mkpat.c,v retrieving revision 1.73 diff -u -r1.73 mkpat.c --- patterns/mkpat.c 29 May 2002 09:26:49 -0000 1.73 +++ patterns/mkpat.c 29 May 2002 10:32:32 -0000 @@ -1001,6 +1001,7 @@ case 'U': pattern[patno].class |= CLASS_U; break; case 'W': pattern[patno].class |= CLASS_W; break; case 'F': pattern[patno].class |= CLASS_F; break; + case 'Y': pattern[patno].class |= CLASS_Y; break; case '-': break; default: if (!isgraph((int) *p)) Index: patterns/patterns.h =================================================================== RCS file: /cvsroot/gnugo/gnugo/patterns/patterns.h,v retrieving revision 1.33 diff -u -r1.33 patterns.h --- patterns/patterns.h 29 May 2002 09:26:49 -0000 1.33 +++ patterns/patterns.h 29 May 2002 10:32:32 -0000 @@ -165,6 +165,7 @@ #define CLASS_T 0x200000 /* joseki trick move */ #define CLASS_W 0x400000 /* worthwhile threat move */ #define CLASS_F 0x800000 /* for joseki moves: a fuseki pattern */ +#define CLASS_Y 0x80000000 /* used for experimental patterns */ /* Collection of the classes inducing move reasons. */ #define CLASS_MOVE_REASONS (CLASS_C | CLASS_B | CLASS_b | \