Index: engine/combination.c =================================================================== RCS file: /cvsroot/gnugo/gnugo/engine/combination.c,v retrieving revision 1.27 diff -u -r1.27 combination.c --- engine/combination.c 11 Mar 2002 16:42:49 -0000 1.27 +++ engine/combination.c 3 Jun 2002 14:53:49 -0000 @@ -316,7 +316,7 @@ * The arrays saved_dragons[] and saved_worms[] should be one for * stones belonging to dragons or worms respectively, which are * supposedly saved by (move). These may be NULL if no stones are - * supposed to gaving been saved. + * supposed to having been saved. */ int atari_atari_confirm_safety(int color, int move, int *defense, int minsize, Index: engine/interface.c =================================================================== RCS file: /cvsroot/gnugo/gnugo/engine/interface.c,v retrieving revision 1.18 diff -u -r1.18 interface.c --- engine/interface.c 19 Apr 2002 17:13:25 -0000 1.18 +++ engine/interface.c 3 Jun 2002 14:53:49 -0000 @@ -475,7 +475,7 @@ * * Returns the color of the next move to be made. * - * Head is a sgf tree. + * Head is an sgf tree. * Untilstr is an optional string of the form either 'L12' or '120' * which tells it to stop playing at that move or move-number. * When debugging, this is the location of the move being examined. Index: engine/liberty.h =================================================================== RCS file: /cvsroot/gnugo/gnugo/engine/liberty.h,v retrieving revision 1.102 diff -u -r1.102 liberty.h --- engine/liberty.h 22 May 2002 19:22:25 -0000 1.102 +++ engine/liberty.h 3 Jun 2002 14:53:49 -0000 @@ -413,9 +413,10 @@ int owl_lively(int pos); int owl_escape_value(int pos); int owl_goal_dragon(int pos); -int owl_eyespace(int apos); -int owl_big_eyespace(int apos); -int owl_proper_eye(int apos); +int owl_eyespace(int pos); +int owl_big_eyespace(int pos); +int owl_proper_eye(int pos); +int owl_strong_dragon(int pos); void owl_reasons(int color); void unconditional_life(int unconditional_territory[BOARDMAX], int color); Index: engine/move_reasons.c =================================================================== RCS file: /cvsroot/gnugo/gnugo/engine/move_reasons.c,v retrieving revision 1.88 diff -u -r1.88 move_reasons.c --- engine/move_reasons.c 23 May 2002 20:18:01 -0000 1.88 +++ engine/move_reasons.c 3 Jun 2002 14:53:49 -0000 @@ -1590,7 +1590,7 @@ worm2 = all_data[move_reasons[r].what].what2; aa = worms[worm1]; bb = worms[worm2]; - gprintf("Move at %1m both %s %1m or %s %1m\n", pos, + gprintf("Move at %1m both %s %1m and %s %1m\n", pos, reason1 == ATTACK_STRING ? "attacks" : "defends", aa, reason2 == ATTACK_STRING ? "attacks" : "defends", bb); break; Index: engine/owl.c =================================================================== RCS file: /cvsroot/gnugo/gnugo/engine/owl.c,v retrieving revision 1.90 diff -u -r1.90 owl.c --- engine/owl.c 22 May 2002 19:22:25 -0000 1.90 +++ engine/owl.c 3 Jun 2002 14:53:50 -0000 @@ -1378,7 +1378,7 @@ int ko_move = -1; int new_komaster; int new_kom_pos; - int origin = 0; + int origin = NO_MOVE; /* Consider only the highest scoring move if we're deeper than * owl_branch_depth. @@ -1446,21 +1446,17 @@ if (IS_STONE(board[str])) origin = str; else { - int found_string = 0; - int oi, oj; - for (oi = 0; oi < board_size && !found_string; oi++) - for (oj = 0; oj < board_size && !found_string; oj++) { - if (BOARD(oi, oj) == color && owl->goal[POS(oi, oj)] == 1) { - origin = find_origin(POS(oi, oj)); - found_string = 1; - } + int pos; + origin = NO_MOVE; + for (pos = BOARDMIN; pos < BOARDMAX; pos++) { + if (board[pos] == color && owl->goal[pos] == 1) { + origin = find_origin(pos); + break; } - - if (!found_string) - origin = 0; + } } - if (origin == 0) + if (origin == NO_MOVE) dcode = 0; else dcode = do_owl_defend(origin, NULL, owl, @@ -1473,7 +1469,7 @@ if (sgf_dumptree) { const char *wintxt; char winstr[192]; - if (origin == 0) + if (origin == NO_MOVE) wintxt = "all original stones captured"; else wintxt = "attack effective"; @@ -1574,8 +1570,8 @@ if (mpos != NO_MOVE && moves[k].value > 0) if (trymove(mpos, other, moves[k].name, target, EMPTY, 0)) { - int oi, oj; - int origin = 0; + int pos; + int origin = NO_MOVE; owl->lunches_are_current = 0; owl_update_boundary_marks(mpos, owl); @@ -1586,16 +1582,14 @@ */ if (board[target] == EMPTY) { - int found_string = 0; - for (oi = 0; oi < board_size && !found_string; oi++) - for (oj = 0; oj < board_size && !found_string; oj++) { - if (IS_STONE(BOARD(oi, oj)) - && owl->goal[POS(oi, oj)] == 1) { - origin = find_origin(POS(oi, oj)); - found_string = 1; - } + for (pos = BOARDMIN; pos < BOARDMAX; pos++) { + if (IS_STONE(board[pos]) && owl->goal[pos] == 1) { + origin = find_origin(pos); + break; } - if (!found_string + } + + if (origin == NO_MOVE || do_owl_attack(origin, NULL, owl, EMPTY, 0, 0)) { /* probably this can't happen */ popgo(); @@ -4338,6 +4332,8 @@ /* This function returns true if it is judged that the capture of the * string at (pos) is sufficient to create one eye. + * + * Update: Now it instead returns the max number of eyes. */ int @@ -4348,10 +4344,7 @@ int max; sniff_lunch(pos, &min, &probable, &max, current_owl_data); - if (max > 0) - return 1; - - return 0; + return max; } @@ -4410,53 +4403,76 @@ } /* Used by autohelpers. - * Returns 1 if (apos) is an eyespace for the color of the dragon currently + * Returns 1 if (pos) is an eyespace for the color of the dragon currently * under owl investigation. */ int -owl_eyespace(int apos) +owl_eyespace(int pos) { int origin; - ASSERT_ON_BOARD1(apos); + ASSERT_ON_BOARD1(pos); - origin = current_owl_data->my_eye[apos].origin; + origin = current_owl_data->my_eye[pos].origin; return (ON_BOARD(origin) - && current_owl_data->my_eye[origin].color - == BORDER_COLOR(current_owl_data->color) + && (current_owl_data->my_eye[origin].color + == BORDER_COLOR(current_owl_data->color)) && current_owl_data->my_eye[origin].maxeye > 0); } /* Used by autohelpers. - * Returns 1 if (apos) is an eyespace for the color of the dragon currently + * Returns 1 if (pos) is an eyespace for the color of the dragon currently * under owl inverstigation, which is possibly worth 2 eyes. */ int -owl_big_eyespace(int apos) +owl_big_eyespace(int pos) { int origin; - ASSERT_ON_BOARD1(apos); + ASSERT_ON_BOARD1(pos); - origin = current_owl_data->my_eye[apos].origin; + origin = current_owl_data->my_eye[pos].origin; return (ON_BOARD(origin) - && current_owl_data->my_eye[origin].color - == BORDER_COLOR(current_owl_data->color) + && (current_owl_data->my_eye[origin].color + == BORDER_COLOR(current_owl_data->color)) && current_owl_data->my_eye[origin].maxeye == 2); } /* Used by autohelpers. - * Returns 1 if (apos) is a non-marginal eyespace for the color of the + * Returns 1 if (pos) is a non-marginal eyespace for the color of the * dragon currently under owl investigation. */ int -owl_proper_eye(int apos) +owl_proper_eye(int pos) { - ASSERT_ON_BOARD1(apos); + ASSERT_ON_BOARD1(pos); + + return ((current_owl_data->my_eye[pos].color + == BORDER_COLOR(current_owl_data->color)) + && !current_owl_data->my_eye[pos].marginal); +} + - return (current_owl_data->my_eye[apos].color - == BORDER_COLOR(current_owl_data->color) - && !current_owl_data->my_eye[apos].marginal); +/* Used by autohelpers. + + * Returns 1 if (pos) is considered to be a strong dragon. This is + * intended to be used to decide whether connecting to some external + * stones is an easy way to live. The current implementation is fairly + * conservative, requiring that (pos) was part of a dragon with two + * eyes according to the static analysis. This requirement may be + * relaxed considerably in the future. + * + * (pos) must not be part of the goal dragon. + */ +int +owl_strong_dragon(int pos) +{ + ASSERT_ON_BOARD1(pos); + ASSERT1(IS_STONE(board[pos]), pos); + + return (!current_owl_data->goal[pos] + && dragon[pos].color == board[pos] + && DRAGON2(pos).genus >= 2); } Index: engine/readconnect.c =================================================================== RCS file: /cvsroot/gnugo/gnugo/engine/readconnect.c,v retrieving revision 1.34 diff -u -r1.34 readconnect.c --- engine/readconnect.c 31 May 2002 15:09:41 -0000 1.34 +++ engine/readconnect.c 3 Jun 2002 14:53:50 -0000 @@ -1078,10 +1078,12 @@ verbose = save_verbose; tactical_nodes = get_reading_node_counter() - reading_nodes_when_called; - if (0) + 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); + dump_stack(); + } return result; } @@ -1211,10 +1213,12 @@ verbose = save_verbose; tactical_nodes = get_reading_node_counter() - reading_nodes_when_called; - if (0) + 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); + dump_stack(); + } return result; } Index: patterns/conn.db =================================================================== RCS file: /cvsroot/gnugo/gnugo/patterns/conn.db,v retrieving revision 1.23 diff -u -r1.23 conn.db --- patterns/conn.db 31 May 2002 15:09:41 -0000 1.23 +++ patterns/conn.db 3 Jun 2002 14:53:50 -0000 @@ -801,7 +801,6 @@ !*? fragile double connection O?? - :\,BY O!a @@ -1481,7 +1480,7 @@ .. O. -:+,CY +:8,CY c. Eo @@ -1516,7 +1515,7 @@ b? aX -?c +xc ;!xcut(a) && !oplay_disconnect(b,c) Index: patterns/dfa.c =================================================================== RCS file: /cvsroot/gnugo/gnugo/patterns/dfa.c,v retrieving revision 1.16 diff -u -r1.16 dfa.c --- patterns/dfa.c 30 May 2002 19:05:04 -0000 1.16 +++ patterns/dfa.c 3 Jun 2002 14:53:51 -0000 @@ -76,7 +76,7 @@ /* To be sure that everything was well initialized */ static int dfa_was_initialized = 0; -static aux_count = 0; +static int aux_count = 0; /* convert is a table to convert the colors */ @@ -794,7 +794,7 @@ fprintf(stderr, "dfa: init\n"); dfa_was_initialized++; buildSpiralOrder(spiral); - for (j=0; j < DFA_BINS; j++) + for (j = 0; j < DFA_BINS; j++) new_dfa(&(aux_dfa[j]), "binAux "); new_dfa(&aux_temp, "tempAux "); @@ -811,7 +811,7 @@ if (dfa_verbose > 1) fprintf(stderr, "dfa: end\n"); - for (j=0; j < DFA_BINS; j++) + for (j = 0; j < DFA_BINS; j++) kill_dfa(&(aux_dfa[j])); kill_dfa(&aux_temp); dfa_was_initialized--; @@ -828,14 +828,13 @@ int next_bin = aux_count; int last_bin = aux_count + DFA_BINS - 1; while (next_bin + 1 != last_bin) { - for (j=aux_count+1; j <= last_bin; j+=2) { - if (j+1 == next_bin) { + for (j = aux_count + 1; j <= last_bin; j += 2) { + if (j+1 == next_bin) copy_dfa(&aux_dfa[next_bin % DFA_BINS], &aux_dfa[j % DFA_BINS]); - } else { + else sync_product(&aux_dfa[next_bin % DFA_BINS], &aux_dfa[j % DFA_BINS], &aux_dfa[(j+1) % DFA_BINS]); - } next_bin++; } last_bin = next_bin-1; @@ -871,9 +870,7 @@ create_dfa(&aux_temp, str, pattern_index); /* then we do the synchronization product with dfa */ - sync_product(new_dfa, - old_dfa, - &aux_temp); + sync_product(new_dfa, old_dfa, &aux_temp); aux_count++; ratio = 1; Index: patterns/endgame.db =================================================================== RCS file: /cvsroot/gnugo/gnugo/patterns/endgame.db,v retrieving revision 1.33 diff -u -r1.33 endgame.db --- patterns/endgame.db 29 May 2002 09:26:49 -0000 1.33 +++ patterns/endgame.db 3 Jun 2002 14:53:51 -0000 @@ -209,7 +209,6 @@ :8,OXe,terri(0.1) - Pattern EE6 .OOOXX Index: patterns/mkpat.c =================================================================== RCS file: /cvsroot/gnugo/gnugo/patterns/mkpat.c,v retrieving revision 1.75 diff -u -r1.75 mkpat.c --- patterns/mkpat.c 31 May 2002 15:09:41 -0000 1.75 +++ patterns/mkpat.c 3 Jun 2002 14:53:51 -0000 @@ -287,6 +287,7 @@ {"owl_eyespace", 1, 0.01, "owl_eyespace(%s)"}, {"owl_big_eyespace", 1, 0.01, "owl_big_eyespace(%s)"}, {"owl_proper_eye", 1, 0.01, "owl_proper_eye(%s)"}, + {"owl_strong_dragon", 1, 0.01, "owl_strong_dragon(%s)"}, {"has_aji", 1, 0.01, "(dragon[%s].owl_threat_status==CAN_THREATEN_DEFENSE)"}, {"finish_ko_helper", 1, 0.05, "finish_ko_helper(%s)"}, Index: patterns/owl_attackpats.db =================================================================== RCS file: /cvsroot/gnugo/gnugo/patterns/owl_attackpats.db,v retrieving revision 1.57 diff -u -r1.57 owl_attackpats.db --- patterns/owl_attackpats.db 22 May 2002 19:22:25 -0000 1.57 +++ patterns/owl_attackpats.db 3 Jun 2002 14:53:51 -0000 @@ -705,8 +705,8 @@ .... ---- -; (owl_escape_value(b) <= 0 && owl_escape_value(c) <= 0) || -; !oplay_attack(*,a,d) +; (owl_escape_value(b) <= 0 && owl_escape_value(c) <= 0) +; || !oplay_attack(*,a,d) Pattern A221 @@ -1607,7 +1607,7 @@ :8,-,value(35) -?B.x +?X.x O*ax ...x ---- @@ -1701,12 +1701,12 @@ :8,s,value(35) -xCX.a -DB*.. +xXX.a +cb*.. ----- -;!attack(a) && owl_proper_eye(B) -;&& (x_somewhere(D) || owl_proper_eye(D)) +;!attack(a) && owl_proper_eye(b) +;&& (x_somewhere(c) || owl_proper_eye(c)) Pattern A603b @@ -1718,7 +1718,7 @@ :8,s,value(35) -xC.x +xX.x b*.a ---- @@ -1782,7 +1782,7 @@ :8,-,value(55) -xCa +xXa b*a --- @@ -2065,11 +2065,11 @@ :|,-,value(61) -?c? -X*B +?b? +X*X ?a? -;owl_eyespace(a) && xlib(c) <= 2 && oplay_attack(*,c,c) +;owl_eyespace(a) && xlib(b) <= 2 && oplay_attack(*,b,b) Pattern A706 @@ -2213,7 +2213,7 @@ ?*XX x.bx -?xCa +?xXa ;owl_eyespace(b) && !owl_proper_eye(*) && !attack(a) @@ -2400,10 +2400,10 @@ :8,-,value(45) ?O? -A.X +X.X ?*? -;owl_eyespace(*) && safe_omove(*) +;owl_eyespace(*) Pattern A811 @@ -2415,11 +2415,11 @@ :8,s,value(65) -aC? -XbD +aX? +XbC .*X -; lib(D) <= 3 +; lib(C) <= 3 ; && owl_proper_eye(a) ; && owl_proper_eye(b) @@ -3487,9 +3487,9 @@ be* cd? -;(owl_escape_value(d) > 0 || -; owl_escape_value(b) > 0 || -; owl_escape_value(c) > 0) +;(owl_escape_value(d) > 0 +; || owl_escape_value(b) > 0 +; || owl_escape_value(c) > 0) ;&& oplay_defend_both(*,e,A,*) @@ -3507,10 +3507,10 @@ b*e cd? -;(owl_escape_value(d) > 0 || -; owl_escape_value(b) > 0 || -; owl_escape_value(c) > 0) -; && !oplay_defend_both(e,*,A,e) +;(owl_escape_value(d) > 0 +; || owl_escape_value(b) > 0 +; || owl_escape_value(c) > 0) +;&& !oplay_defend_both(e,*,A,e) Pattern A1125 @@ -3697,7 +3697,7 @@ :8,-,value(65) -OAA* +OXX* .O.. ---- Index: patterns/owl_defendpats.db =================================================================== RCS file: /cvsroot/gnugo/gnugo/patterns/owl_defendpats.db,v retrieving revision 1.62 diff -u -r1.62 owl_defendpats.db --- patterns/owl_defendpats.db 22 May 2002 19:22:25 -0000 1.62 +++ patterns/owl_defendpats.db 3 Jun 2002 14:53:52 -0000 @@ -978,7 +978,7 @@ :8,-,value(76) -Xboo +XOoo OX*o ...a ---- @@ -1856,7 +1856,7 @@ :8,-,value(35) -occA +oOOA ?b*x ---- @@ -1947,11 +1947,11 @@ :8,-,value(50) -oob.X -aC*.. +ooO.X +aB*.. ----- -;owl_eyespace(a) && does_attack(*,C) +;owl_eyespace(a) && does_attack(*,B) Pattern D609 @@ -2622,7 +2622,7 @@ OO* O.a -?bb +?OO ;!owl_big_eyespace(a) && !obvious_false_oeye(a) @@ -2698,10 +2698,10 @@ :8,-,value(36) O.* -Xab +XOa --- -;xlib(b)>1 && owl_big_eyespace(b) && oplay_attack(*,b,b) +;xlib(a)>1 && owl_big_eyespace(a) && oplay_attack(*,a,a) Pattern D716 @@ -2714,10 +2714,10 @@ :8,-,value(60) ?*OO -O.bo -?oaX +O.ao +?oOX -;owl_eyespace(b) && !owl_big_eyespace(b) +;owl_eyespace(a) && !owl_big_eyespace(a) Pattern D717 @@ -2776,9 +2776,9 @@ :8,-,value(55) ?O.o -Ba*o +Oa*o -; owl_proper_eye(a) +;owl_proper_eye(a) ######################################################### @@ -4491,9 +4491,9 @@ b*. cd? -;(owl_escape_value(d) > 0 || -; owl_escape_value(b) > 0 || -; owl_escape_value(c) > 0) +;(owl_escape_value(b) > 0 +; || owl_escape_value(c) > 0 +; || owl_escape_value(d) > 0) ;&& oplay_attack(*,a) Index: patterns/owl_vital_apats.db =================================================================== RCS file: /cvsroot/gnugo/gnugo/patterns/owl_vital_apats.db,v retrieving revision 1.28 diff -u -r1.28 owl_vital_apats.db --- patterns/owl_vital_apats.db 22 May 2002 19:22:25 -0000 1.28 +++ patterns/owl_vital_apats.db 3 Jun 2002 14:53:52 -0000 @@ -283,7 +283,7 @@ :8,-,value(46) ---- -.A.X +.X.X .*Xx X..? @@ -372,7 +372,7 @@ :8,-,value(75) XO? -.*B +.*X .a. --- @@ -409,7 +409,7 @@ :8,-,value(75) ??O? -xc*D +xc*X .ba. .... ---- @@ -664,7 +664,7 @@ :8,s,value(95) XO*| -ABX| +AXX| XOO| ; owl_eyespace(A) @@ -747,11 +747,11 @@ :8,s,value(57) -XBd -A*C +XbX +a*c ; owl_proper_eye(*) -; && (owl_proper_eye(A) + owl_proper_eye(B) + owl_proper_eye(C) > 2) +; && (owl_proper_eye(a) + owl_proper_eye(b) + owl_proper_eye(c) > 2) ; && safe_xmove(*) Index: patterns/patterns.db =================================================================== RCS file: /cvsroot/gnugo/gnugo/patterns/patterns.db,v retrieving revision 1.76 diff -u -r1.76 patterns.db --- patterns/patterns.db 29 May 2002 09:26:49 -0000 1.76 +++ patterns/patterns.db 3 Jun 2002 14:53:52 -0000 @@ -4896,8 +4896,8 @@ .cX*.? ------ -;lib(a)>2 || -;!oplay_attack_either(*,b,c,*,a) +;lib(a)>2 +;|| !oplay_attack_either(*,b,c,*,a) Pattern EB702b @@ -8783,7 +8783,7 @@ :8,OXeEcd,shape(3) ?.? -... +... .*O OA? Index: patterns/patterns2.db =================================================================== RCS file: /cvsroot/gnugo/gnugo/patterns/patterns2.db,v retrieving revision 1.40 diff -u -r1.40 patterns2.db --- patterns/patterns2.db 23 May 2002 20:18:01 -0000 1.40 +++ patterns/patterns2.db 3 Jun 2002 14:53:53 -0000 @@ -3295,13 +3295,12 @@ ........| ........| ........| -.*a.O...| +.*..O...| ........| ........| --------+ >antisuji(*); -# antisuji(a); - a is often a fine move. Pattern Temp6 Index: patterns/read_defend.db =================================================================== RCS file: /cvsroot/gnugo/gnugo/patterns/read_defend.db,v retrieving revision 1.3 diff -u -r1.3 read_defend.db --- patterns/read_defend.db 25 Mar 2002 07:39:18 -0000 1.3 +++ patterns/read_defend.db 3 Jun 2002 14:53:53 -0000 @@ -192,7 +192,7 @@ :8,D,minvalue(40),maxvalue(65) -ab* +Yb* ; lib(b) < 4 && xlib(*) > 1 @@ -208,7 +208,7 @@ :8,D,value(40) -a.b* +Y.b* ; lib(b) < 4 && xlib(*) > 1