Index: engine/dragon.c =================================================================== RCS file: /cvsroot/gnugo/gnugo/engine/dragon.c,v retrieving revision 1.105 diff -u -r1.105 dragon.c --- engine/dragon.c 9 Feb 2003 01:28:20 -0000 1.105 +++ engine/dragon.c 13 Feb 2003 20:03:03 -0000 @@ -352,9 +352,9 @@ DRAGON2(str).moyo_territorial_value, DRAGON2(str).escape_route - 10) < 0.00001 + gg_max(0.12, 0.32 - 0.01*dragon[str].effective_size)) { - dragon[str].owl_status = UNCHECKED; - dragon[str].owl_attack_point = NO_MOVE; - dragon[str].owl_defense_point = NO_MOVE; + DRAGON2(str).owl_status = UNCHECKED; + DRAGON2(str).owl_attack_point = NO_MOVE; + DRAGON2(str).owl_defense_point = NO_MOVE; } else { int acode = 0; @@ -362,21 +362,21 @@ int kworm = NO_MOVE; start_timer(3); acode = owl_attack(str, &attack_point, - &dragon[str].owl_attack_certain, &kworm); + &DRAGON2(str).owl_attack_certain, &kworm); if (acode != 0) { - dragon[str].owl_attack_point = attack_point; - dragon[str].owl_attack_code = acode; - dragon[str].owl_attack_kworm = kworm; + DRAGON2(str).owl_attack_point = attack_point; + DRAGON2(str).owl_attack_code = acode; + DRAGON2(str).owl_attack_kworm = kworm; if (attack_point != NO_MOVE) { kworm = NO_MOVE; dcode = owl_defend(str, &defense_point, - &dragon[str].owl_defense_certain, &kworm); + &DRAGON2(str).owl_defense_certain, &kworm); if (dcode != 0) { if (defense_point != NO_MOVE) { - dragon[str].owl_status = acode==GAIN ? ALIVE : CRITICAL; - dragon[str].owl_defense_point = defense_point; - dragon[str].owl_defense_code = dcode; - dragon[str].owl_defense_kworm = kworm; + DRAGON2(str).owl_status = acode==GAIN ? ALIVE : CRITICAL; + DRAGON2(str).owl_defense_point = defense_point; + DRAGON2(str).owl_defense_code = dcode; + DRAGON2(str).owl_defense_kworm = kworm; } else { /* Due to irregularities in the owl code, it may @@ -387,45 +387,45 @@ * propose. Having the status right is important e.g. * for connection moves to be properly valued. */ - dragon[str].owl_status = acode==GAIN ? ALIVE : CRITICAL; + DRAGON2(str).owl_status = acode==GAIN ? ALIVE : CRITICAL; DEBUG(DEBUG_OWL_PERFORMANCE, "Inconsistent owl attack and defense results for %1m.\n", str); /* Let's see whether the attacking move might be the right * defense: */ - dcode = owl_does_defend(dragon[str].owl_attack_point, + dcode = owl_does_defend(DRAGON2(str).owl_attack_point, str, NULL); if (dcode != 0) { - dragon[str].owl_defense_point - = dragon[str].owl_attack_point; - dragon[str].owl_defense_code = dcode; + DRAGON2(str).owl_defense_point + = DRAGON2(str).owl_attack_point; + DRAGON2(str).owl_defense_code = dcode; } } } } if (dcode == 0) { - dragon[str].owl_status = DEAD; - dragon[str].owl_defense_point = NO_MOVE; - dragon[str].owl_defense_code = 0; + DRAGON2(str).owl_status = DEAD; + DRAGON2(str).owl_defense_point = NO_MOVE; + DRAGON2(str).owl_defense_code = 0; } } else { - if (!dragon[str].owl_attack_certain) { + if (!DRAGON2(str).owl_attack_certain) { kworm = NO_MOVE; dcode = owl_defend(str, &defense_point, - &dragon[str].owl_defense_certain, &kworm); + &DRAGON2(str).owl_defense_certain, &kworm); if (dcode != 0) { /* If the result of owl_attack was not certain, we may * still want the result of owl_defend */ - dragon[str].owl_defense_point = defense_point; - dragon[str].owl_defense_code = dcode; - dragon[str].owl_defense_kworm = kworm; + DRAGON2(str).owl_defense_point = defense_point; + DRAGON2(str).owl_defense_code = dcode; + DRAGON2(str).owl_defense_kworm = kworm; } } - dragon[str].owl_status = ALIVE; - dragon[str].owl_attack_point = NO_MOVE; - dragon[str].owl_attack_code = 0; + DRAGON2(str).owl_status = ALIVE; + DRAGON2(str).owl_attack_point = NO_MOVE; + DRAGON2(str).owl_attack_code = 0; time_report(3, " owl reading for dragon at ", str, 1.0); } @@ -439,8 +439,8 @@ for (str = BOARDMIN; str < BOARDMAX; str++) if (ON_BOARD(str)) { if (IS_STONE(board[str])) { - if (dragon[str].owl_status != UNCHECKED) - dragon[str].status = dragon[str].owl_status; + if (DRAGON2(str).owl_status != UNCHECKED) + dragon[str].status = DRAGON2(str).owl_status; else if (dragon[str].crude_status == DEAD || dragon[str].crude_status == CRITICAL) { /* If a dragon has sufficient escape potential or @@ -483,39 +483,39 @@ DRAGON2(str).moyo_territorial_value, DRAGON2(str).escape_route - 10) < 0.00001 + gg_max(0.12, 0.32 - 0.01*dragon[str].effective_size)) { - dragon[str].owl_threat_status = UNCHECKED; - dragon[str].owl_second_attack_point = NO_MOVE; - dragon[str].owl_second_defense_point = NO_MOVE; + DRAGON2(str).owl_threat_status = UNCHECKED; + DRAGON2(str).owl_second_attack_point = NO_MOVE; + DRAGON2(str).owl_second_defense_point = NO_MOVE; } else { - int acode = dragon[str].owl_attack_code; - int dcode = dragon[str].owl_defense_code; + int acode = DRAGON2(str).owl_attack_code; + int dcode = DRAGON2(str).owl_defense_code; int defense_point, second_defense_point; if (level >= 8 && !disable_threat_computation && (owl_threats || thrashing_stone[str])) { - if (acode && !dcode && dragon[str].owl_attack_point != NO_MOVE) { + if (acode && !dcode && DRAGON2(str).owl_attack_point != NO_MOVE) { if (owl_threaten_defense(str, &defense_point, &second_defense_point)) { - dragon[str].owl_threat_status = CAN_THREATEN_DEFENSE; - dragon[str].owl_defense_point = defense_point; - dragon[str].owl_second_defense_point = second_defense_point; + DRAGON2(str).owl_threat_status = CAN_THREATEN_DEFENSE; + DRAGON2(str).owl_defense_point = defense_point; + DRAGON2(str).owl_second_defense_point = second_defense_point; } else - dragon[str].owl_threat_status = DEAD; + DRAGON2(str).owl_threat_status = DEAD; } else if (!acode) { int attack_point, second_attack_point; if (owl_threaten_attack(str, &attack_point, &second_attack_point)) { - dragon[str].owl_threat_status = CAN_THREATEN_ATTACK; - dragon[str].owl_attack_point = attack_point; - dragon[str].owl_second_attack_point = second_attack_point; + DRAGON2(str).owl_threat_status = CAN_THREATEN_ATTACK; + DRAGON2(str).owl_attack_point = attack_point; + DRAGON2(str).owl_second_attack_point = second_attack_point; } else - dragon[str].owl_threat_status = ALIVE; + DRAGON2(str).owl_threat_status = ALIVE; } } time_report(3, " owl threats for dragon at ", str, 1.0); @@ -552,9 +552,9 @@ dragon2[d].safety = TACTICALLY_DEAD; else if (0) /* Seki is detected by the call to semeai() below. */ dragon2[d].safety = ALIVE_IN_SEKI; - else if (dragon[origin].owl_status == DEAD) + else if (dragon2[d].owl_status == DEAD) dragon2[d].safety = DEAD; - else if (dragon[origin].owl_status == CRITICAL) + else if (dragon2[d].owl_status == CRITICAL) dragon2[d].safety = CRITICAL; else if (dragon_invincible(origin)) dragon2[d].safety = INVINCIBLE; @@ -700,18 +700,8 @@ dragon[str].effective_size = worm[str].effective_size; dragon[str].color = worm[str].color; dragon[str].origin = worm[str].origin; - dragon[str].owl_attack_point = NO_MOVE; - dragon[str].owl_attack_code = 0; - dragon[str].owl_attack_certain = 1; - dragon[str].owl_defense_point = NO_MOVE; - dragon[str].owl_defense_code = 0; - dragon[str].owl_defense_certain = 1; - dragon[str].owl_status = UNCHECKED; dragon[str].crude_status = UNKNOWN; dragon[str].status = UNKNOWN; - dragon[str].owl_threat_status = UNCHECKED; - dragon[str].owl_second_attack_point = NO_MOVE; - dragon[str].owl_second_defense_point = NO_MOVE; half_eye[str].type = 0; half_eye[str].value = 10.0; /* Something big. */ @@ -776,17 +766,27 @@ /* Initialize the rest of the dragon2 data. */ for (d = 0; d < number_of_dragons; d++) { - dragon2[d].neighbors = 0; - dragon2[d].hostile_neighbors = 0; - dragon2[d].moyo_size = -1; - dragon2[d].moyo_territorial_value = 0.0; - dragon2[d].safety = -1; - dragon2[d].escape_route = 0; - dragon2[d].heye = NO_MOVE; - dragon2[d].lunch = NO_MOVE; - dragon2[d].semeai = 0; - dragon2[d].semeai_margin_of_safety = -1; - dragon2[d].surround_status = 0; + dragon2[d].neighbors = 0; + dragon2[d].hostile_neighbors = 0; + dragon2[d].moyo_size = -1; + dragon2[d].moyo_territorial_value = 0.0; + dragon2[d].safety = -1; + dragon2[d].escape_route = 0; + dragon2[d].heye = NO_MOVE; + dragon2[d].lunch = NO_MOVE; + dragon2[d].semeai = 0; + dragon2[d].semeai_margin_of_safety = -1; + dragon2[d].surround_status = 0; + dragon2[d].owl_attack_point = NO_MOVE; + dragon2[d].owl_attack_code = 0; + dragon2[d].owl_attack_certain = 1; + dragon2[d].owl_defense_point = NO_MOVE; + dragon2[d].owl_defense_code = 0; + dragon2[d].owl_defense_certain = 1; + dragon2[d].owl_status = UNCHECKED; + dragon2[d].owl_threat_status = UNCHECKED; + dragon2[d].owl_second_attack_point = NO_MOVE; + dragon2[d].owl_second_defense_point = NO_MOVE; set_eyevalue(&dragon2[d].genus, 0, 0, 0, 0); } @@ -1546,12 +1546,12 @@ safety_names[d2->safety], d2->weakness_pre_owl, d2->weakness); - gprintf(", owl status %s\n", snames[dd->owl_status]); - if (dd->owl_status == CRITICAL) { + gprintf(", owl status %s\n", snames[d2->owl_status]); + if (d2->owl_status == CRITICAL) { gprintf("... owl attackable at %1m, code %d\n", - dd->owl_attack_point, dd->owl_attack_code); + d2->owl_attack_point, d2->owl_attack_code); gprintf("... owl defendable at %1m, code %d\n", - dd->owl_defense_point, dd->owl_defense_code); + d2->owl_defense_point, d2->owl_defense_code); } gprintf("... neighbors"); for (k = 0; k < d2->neighbors; k++) { @@ -2181,11 +2181,11 @@ (float) dragon2[d].escape_route); /* Now corrections due to (uncertain) owl results resp. owl threats. */ - if (!dragon[origin].owl_attack_certain) + if (!dragon2[d].owl_attack_certain) weakness += gg_min(0.25 * (1.0 - weakness), 0.25 * weakness); - if (!dragon[origin].owl_defense_certain) + if (!dragon2[d].owl_defense_certain) weakness += gg_min(0.25 * (1.0 - weakness), 0.25 * weakness); - if (dragon[origin].owl_threat_status == CAN_THREATEN_ATTACK) + if (dragon2[d].owl_threat_status == CAN_THREATEN_ATTACK) weakness += 0.15 * (1.0 - weakness); if (weakness < 0.0) @@ -2370,21 +2370,21 @@ gfprintf(outfile, "crude status %s\n", status_to_string(d->crude_status)); gfprintf(outfile, "owl_status %s\n", - status_to_string(d->owl_status)); + status_to_string(d2->owl_status)); gfprintf(outfile, "status %s\n", status_to_string(d->status)); gfprintf(outfile, "owl_threat_status %s\n", - status_to_string(d->owl_threat_status)); - gfprintf(outfile, "owl_attack %1m\n", d->owl_attack_point); + status_to_string(d2->owl_threat_status)); + gfprintf(outfile, "owl_attack %1m\n", d2->owl_attack_point); gfprintf(outfile, "owl_attack_certain %s\n", - (d->owl_attack_certain) ? "YES" : "NO"); + (d2->owl_attack_certain) ? "YES" : "NO"); gfprintf(outfile, "owl_2nd_attack %1m\n", - d->owl_second_attack_point); - gfprintf(outfile, "owl_defend %1m\n", d->owl_defense_point); + d2->owl_second_attack_point); + gfprintf(outfile, "owl_defend %1m\n", d2->owl_defense_point); gfprintf(outfile, "owl_defense_certain %s\n", - (d->owl_defense_certain) ? "YES" : "NO"); + (d2->owl_defense_certain) ? "YES" : "NO"); gfprintf(outfile, "owl_2nd_defend %1m\n", - d->owl_second_defense_point); + d2->owl_second_defense_point); gfprintf(outfile, "semeai %d\n", d2->semeai); gfprintf(outfile, "semeai_margin_of_safety %d\n", d2->semeai_margin_of_safety); Index: engine/liberty.h =================================================================== RCS file: /cvsroot/gnugo/gnugo/engine/liberty.h,v retrieving revision 1.156 diff -u -r1.156 liberty.h --- engine/liberty.h 3 Feb 2003 23:33:05 -0000 1.156 +++ engine/liberty.h 13 Feb 2003 20:03:06 -0000 @@ -211,7 +211,7 @@ void ascii_report_worm(char *string); void report_dragon(FILE *outfile, int pos); void ascii_report_dragon(char *string); -struct dragon_data2 * dragon2_func(int pos); +struct dragon_data2 *dragon2_func(int pos); /* prototypes for reorientation functions */ @@ -911,24 +911,8 @@ /* dragon iff they have same origin. */ int size; /* size of the dragon */ float effective_size; /* stones and surrounding spaces */ - int crude_status; /* (ALIVE, DEAD, UNKNOWN, CRITICAL) */ - int owl_threat_status; /* CAN_THREATEN_ATTACK or CAN_THREATEN_DEFENSE */ - int owl_status; /* (ALIVE, DEAD, UNKNOWN, CRITICAL, UNCHECKED) */ - int owl_attack_point; /* vital point for attack */ - int owl_attack_code; /* ko result code */ -#if 0 - int owl_attack_points[MAX_TACTICAL_POINTS]; - int owl_attack_codes[MAX_TACTICAL_POINTS]; -#endif - int owl_attack_certain; /* 0 if owl reading node limit is reached */ - int owl_second_attack_point;/* if attacker gets both attack points, wins */ - int owl_defense_point; /* vital point for defense */ - int owl_defense_code; /* ko result code */ - int owl_defense_certain; /* 0 if owl reading node limit is reached */ - int owl_second_defense_point;/* if defender gets both attack points, wins */ - int status; /* best trusted status */ - int owl_attack_kworm; /* only valid when owl_attack_code is GAIN */ - int owl_defense_kworm; /* only valid when owl_defense_code is LOSS */ + int crude_status; /* (ALIVE, DEAD, UNKNOWN, CRITICAL) */ + int status; /* best trusted status */ }; extern struct dragon_data dragon[BOARDMAX]; @@ -958,6 +942,18 @@ int semeai_margin_of_safety; /* if small, the semeai is close */ int surround_status; /* Is it surrounded? */ int surround_size; /* Size of the surrounding area */ + int owl_threat_status; /* CAN_THREATEN_ATTACK or CAN_THREATEN_DEFENSE */ + int owl_status; /* (ALIVE, DEAD, UNKNOWN, CRITICAL, UNCHECKED) */ + int owl_attack_point; /* vital point for attack */ + int owl_attack_code; /* ko result code */ + int owl_attack_certain; /* 0 if owl reading node limit is reached */ + int owl_second_attack_point;/* if attacker gets both attack points, wins */ + int owl_defense_point; /* vital point for defense */ + int owl_defense_code; /* ko result code */ + int owl_defense_certain; /* 0 if owl reading node limit is reached */ + int owl_second_defense_point;/* if defender gets both attack points, wins */ + int owl_attack_kworm; /* only valid when owl_attack_code is GAIN */ + int owl_defense_kworm; /* only valid when owl_defense_code is LOSS */ }; /* dragon2 is dynamically allocated */ Index: engine/owl.c =================================================================== RCS file: /cvsroot/gnugo/gnugo/engine/owl.c,v retrieving revision 1.142 diff -u -r1.142 owl.c --- engine/owl.c 1 Feb 2003 14:02:40 -0000 1.142 +++ engine/owl.c 13 Feb 2003 20:03:16 -0000 @@ -3716,20 +3716,20 @@ || dragon[pos].origin != pos) continue; if (dragon[pos].status == CRITICAL - && dragon[pos].owl_attack_point != NO_MOVE) { + && DRAGON2(pos).owl_attack_point != NO_MOVE) { if (board[pos] == color) { - if (dragon[pos].owl_defense_point != NO_MOVE) { - if (dragon[pos].owl_defense_code == LOSS) { - add_loss_move(dragon[pos].owl_defense_point, pos, - dragon[pos].owl_defense_kworm); + if (DRAGON2(pos).owl_defense_point != NO_MOVE) { + if (DRAGON2(pos).owl_defense_code == LOSS) { + add_loss_move(DRAGON2(pos).owl_defense_point, pos, + DRAGON2(pos).owl_defense_kworm); DEBUG(DEBUG_OWL, "owl: %1m defends %1m with loss at move %d\n", - dragon[pos].owl_defense_point, pos, movenum+1); + DRAGON2(pos).owl_defense_point, pos, movenum+1); } else { - add_owl_defense_move(dragon[pos].owl_defense_point, pos, - dragon[pos].owl_defense_code); + add_owl_defense_move(DRAGON2(pos).owl_defense_point, pos, + DRAGON2(pos).owl_defense_code); DEBUG(DEBUG_OWL, "owl: %1m defends %1m at move %d\n", - dragon[pos].owl_defense_point, pos, movenum+1); + DRAGON2(pos).owl_defense_point, pos, movenum+1); } } } @@ -3742,7 +3742,7 @@ * scheme should minimize the performance hit, but of course * it's unfortunate to have the code duplication. */ - int move = dragon[pos].owl_attack_point; + int move = DRAGON2(pos).owl_attack_point; /* No worries if we catch something big. */ if (dragon[pos].effective_size < 8) { @@ -3789,87 +3789,87 @@ } /* If we've reached this far, the attack is okay. */ - if (dragon[pos].owl_attack_code == GAIN) { - add_gain_move(move, pos, dragon[pos].owl_attack_kworm ); + if (DRAGON2(pos).owl_attack_code == GAIN) { + add_gain_move(move, pos, DRAGON2(pos).owl_attack_kworm ); DEBUG(DEBUG_OWL, "owl: %1m attacks %1m with gain at move %d\n", move, pos, movenum+1); } else { - add_owl_attack_move(move, pos, dragon[pos].owl_attack_code); + add_owl_attack_move(move, pos, DRAGON2(pos).owl_attack_code); DEBUG(DEBUG_OWL, "owl: %1m attacks %1m at move %d\n", move, pos, movenum+1); } } } - else if (dragon[pos].owl_status == DEAD - && dragon[pos].owl_threat_status == CAN_THREATEN_DEFENSE) { + else if (DRAGON2(pos).owl_status == DEAD + && DRAGON2(pos).owl_threat_status == CAN_THREATEN_DEFENSE) { if (board[pos] == color - && dragon[pos].owl_defense_point != NO_MOVE) { - add_owl_defense_threat_move(dragon[pos].owl_defense_point, pos, WIN); + && DRAGON2(pos).owl_defense_point != NO_MOVE) { + add_owl_defense_threat_move(DRAGON2(pos).owl_defense_point, pos, WIN); DEBUG(DEBUG_OWL, "owl: %1m threatens to defend %1m at move %d\n", - dragon[pos].owl_defense_point, pos, movenum+1); + DRAGON2(pos).owl_defense_point, pos, movenum+1); } if (board[pos] == color - && dragon[pos].owl_second_defense_point != NO_MOVE - && is_legal(dragon[pos].owl_second_defense_point, color)) { - add_owl_defense_threat_move(dragon[pos].owl_second_defense_point, + && DRAGON2(pos).owl_second_defense_point != NO_MOVE + && is_legal(DRAGON2(pos).owl_second_defense_point, color)) { + add_owl_defense_threat_move(DRAGON2(pos).owl_second_defense_point, pos, WIN); DEBUG(DEBUG_OWL, "owl: %1m threatens to defend %1m at move %d\n", - dragon[pos].owl_second_defense_point, pos, movenum+1); + DRAGON2(pos).owl_second_defense_point, pos, movenum+1); } /* If the opponent can threaten to live, an attacking * move gets a small value to make sure it's really dead. */ if (board[pos] == OTHER_COLOR(color) - && dragon[pos].owl_threat_status == CAN_THREATEN_DEFENSE - && dragon[pos].owl_attack_point != NO_MOVE) { - add_owl_prevent_threat_move(dragon[pos].owl_attack_point, pos); + && DRAGON2(pos).owl_threat_status == CAN_THREATEN_DEFENSE + && DRAGON2(pos).owl_attack_point != NO_MOVE) { + add_owl_prevent_threat_move(DRAGON2(pos).owl_attack_point, pos); DEBUG(DEBUG_OWL, "owl: %1m prevents a threat against %1m at move %d\n", - dragon[pos].owl_attack_point, pos, movenum+1); + DRAGON2(pos).owl_attack_point, pos, movenum+1); } } - else if (dragon[pos].owl_status == ALIVE) { + else if (DRAGON2(pos).owl_status == ALIVE) { if (board[pos] == OTHER_COLOR(color) - && dragon[pos].owl_threat_status == CAN_THREATEN_ATTACK) { - if (dragon[pos].owl_attack_point != NO_MOVE) { - add_owl_attack_threat_move(dragon[pos].owl_attack_point, pos, WIN); + && DRAGON2(pos).owl_threat_status == CAN_THREATEN_ATTACK) { + if (DRAGON2(pos).owl_attack_point != NO_MOVE) { + add_owl_attack_threat_move(DRAGON2(pos).owl_attack_point, pos, WIN); DEBUG(DEBUG_OWL, "owl: %1m threatens %1m at move %d\n", - dragon[pos].owl_attack_point, pos, movenum+1); + DRAGON2(pos).owl_attack_point, pos, movenum+1); } - if (dragon[pos].owl_second_attack_point != NO_MOVE - && is_legal(dragon[pos].owl_second_attack_point, color)) { - add_owl_attack_threat_move(dragon[pos].owl_second_attack_point, pos, + if (DRAGON2(pos).owl_second_attack_point != NO_MOVE + && is_legal(DRAGON2(pos).owl_second_attack_point, color)) { + add_owl_attack_threat_move(DRAGON2(pos).owl_second_attack_point, pos, WIN); DEBUG(DEBUG_OWL, "owl: %1m threatens %1m at move %d\n", - dragon[pos].owl_second_attack_point, pos, movenum+1); + DRAGON2(pos).owl_second_attack_point, pos, movenum+1); } } else if (board[pos] == OTHER_COLOR(color) - && dragon[pos].owl_attack_point != NO_MOVE - && dragon[pos].owl_attack_code == GAIN) { - add_gain_move(dragon[pos].owl_attack_point, pos, - dragon[pos].owl_attack_kworm); + && DRAGON2(pos).owl_attack_point != NO_MOVE + && DRAGON2(pos).owl_attack_code == GAIN) { + add_gain_move(DRAGON2(pos).owl_attack_point, pos, + DRAGON2(pos).owl_attack_kworm); DEBUG(DEBUG_OWL, "owl: %1m attacks %1m with gain at move %d\n", - dragon[pos].owl_attack_point, pos, movenum+1); + DRAGON2(pos).owl_attack_point, pos, movenum+1); } else if (board[pos] == color - && dragon[pos].owl_defense_point != NO_MOVE - && dragon[pos].owl_defense_code == LOSS) { - add_loss_move(dragon[pos].owl_defense_point, pos, - dragon[pos].owl_defense_kworm); + && DRAGON2(pos).owl_defense_point != NO_MOVE + && DRAGON2(pos).owl_defense_code == LOSS) { + add_loss_move(DRAGON2(pos).owl_defense_point, pos, + DRAGON2(pos).owl_defense_kworm); DEBUG(DEBUG_OWL, "owl: %1m defends %1m with loss at move %d\n", - dragon[pos].owl_defense_point, pos, movenum+1); + DRAGON2(pos).owl_defense_point, pos, movenum+1); } else if (board[pos] == color - && dragon[pos].owl_attack_point != NO_MOVE - && dragon[pos].owl_attack_code == GAIN - && dragon[pos].owl_defense_code == WIN - && dragon[pos].owl_defense_point != NO_MOVE) { - add_owl_defense_move(dragon[pos].owl_defense_point, pos, - dragon[pos].owl_defense_code); + && DRAGON2(pos).owl_attack_point != NO_MOVE + && DRAGON2(pos).owl_attack_code == GAIN + && DRAGON2(pos).owl_defense_code == WIN + && DRAGON2(pos).owl_defense_point != NO_MOVE) { + add_owl_defense_move(DRAGON2(pos).owl_defense_point, pos, + DRAGON2(pos).owl_defense_code); DEBUG(DEBUG_OWL, "owl: %1m defends %1m against possible loss at move %d\n", - dragon[pos].owl_defense_point, pos, movenum+1); + DRAGON2(pos).owl_defense_point, pos, movenum+1); } /* The owl code found the friendly dragon alive, but was uncertain, @@ -3877,13 +3877,13 @@ * be a good place to play. */ else if (board[pos] == color - && !dragon[pos].owl_attack_certain - && dragon[pos].owl_defense_certain - && ON_BOARD(dragon[pos].owl_defense_point)) { - add_owl_uncertain_defense_move(dragon[pos].owl_defense_point, pos); + && !DRAGON2(pos).owl_attack_certain + && DRAGON2(pos).owl_defense_certain + && ON_BOARD(DRAGON2(pos).owl_defense_point)) { + add_owl_uncertain_defense_move(DRAGON2(pos).owl_defense_point, pos); DEBUG(DEBUG_OWL, "owl: %1m defends the uncertain dragon at %1m at move %d\n", - dragon[pos].owl_defense_point, pos, movenum+1); + DRAGON2(pos).owl_defense_point, pos, movenum+1); } } @@ -3891,14 +3891,14 @@ * and an extra point of attack was found, so this might * be a good place to play. */ - else if (dragon[pos].owl_status == DEAD + else if (DRAGON2(pos).owl_status == DEAD && board[pos] == OTHER_COLOR(color) - && !dragon[pos].owl_attack_certain - && ON_BOARD(dragon[pos].owl_attack_point)) { - add_owl_uncertain_defense_move(dragon[pos].owl_attack_point, pos); + && !DRAGON2(pos).owl_attack_certain + && ON_BOARD(DRAGON2(pos).owl_attack_point)) { + add_owl_uncertain_defense_move(DRAGON2(pos).owl_attack_point, pos); DEBUG(DEBUG_OWL, "owl: %1m might defend the uncertain dragon at %1m at move %d\n", - dragon[pos].owl_attack_point, pos, movenum+1); + DRAGON2(pos).owl_attack_point, pos, movenum+1); } } } Index: engine/semeai.c =================================================================== RCS file: /cvsroot/gnugo/gnugo/engine/semeai.c,v retrieving revision 1.48 diff -u -r1.48 semeai.c --- engine/semeai.c 5 Jan 2003 15:49:15 -0000 1.48 +++ engine/semeai.c 13 Feb 2003 20:03:19 -0000 @@ -230,11 +230,17 @@ } else { /* pass == 1 */ if (a_status == CRITICAL - && best_result_a[k] != DEAD) + && best_result_a[k] != DEAD) { add_owl_defense_move(move[k], apos, WIN); + DEBUG(DEBUG_SEMEAI, "Adding owl defense move for %1m at %1m\n", + apos, move[k]); + } if (b_status == CRITICAL - && worst_result_b[k] == DEAD) + && worst_result_b[k] == DEAD) { add_owl_attack_move(move[k], bpos, WIN); + DEBUG(DEBUG_SEMEAI, "Adding owl attack move for %1m at %1m\n", + bpos, move[k]); + } } } /* loop over neighbor dragons */ if (pass == 0 && semeai_found) { @@ -339,19 +345,19 @@ * dragon owl_does_attack your dragon, add another owl attack move * reason. */ - if (dragon[my_dragon].owl_status == CRITICAL - && dragon[your_dragon].owl_status == CRITICAL) { - if (dragon[your_dragon].owl_attack_point - == dragon[my_dragon].owl_defense_point) + if (DRAGON2(my_dragon).owl_status == CRITICAL + && DRAGON2(your_dragon).owl_status == CRITICAL) { + if (DRAGON2(your_dragon).owl_attack_point + == DRAGON2(my_dragon).owl_defense_point) return; - if (dragon[my_dragon].owl_defense_point != NO_MOVE) { - int acode = owl_does_attack(dragon[my_dragon].owl_defense_point, + if (DRAGON2(my_dragon).owl_defense_point != NO_MOVE) { + int acode = owl_does_attack(DRAGON2(my_dragon).owl_defense_point, your_dragon, NULL); if (acode != 0) { - add_owl_attack_move(dragon[my_dragon].owl_defense_point, your_dragon, + add_owl_attack_move(DRAGON2(my_dragon).owl_defense_point, your_dragon, acode); DEBUG(DEBUG_SEMEAI, "added owl attack of %1m at %1m with code %d\n", - your_dragon, dragon[my_dragon].owl_defense_point, acode); + your_dragon, DRAGON2(my_dragon).owl_defense_point, acode); owl_code_sufficient = 1; } } @@ -362,21 +368,21 @@ * owl_does_defend my dragon, add another owl defense move reason * and possibly change the owl status of my dragon to critical. */ - if ((dragon[my_dragon].owl_status == CRITICAL - || dragon[my_dragon].owl_status == DEAD) - && dragon[your_dragon].owl_status == CRITICAL) { - if (dragon[your_dragon].owl_attack_point - == dragon[my_dragon].owl_defense_point) + if ((DRAGON2(my_dragon).owl_status == CRITICAL + || DRAGON2(my_dragon).owl_status == DEAD) + && DRAGON2(your_dragon).owl_status == CRITICAL) { + if (DRAGON2(your_dragon).owl_attack_point + == DRAGON2(my_dragon).owl_defense_point) return; - if (dragon[your_dragon].owl_attack_point != NO_MOVE) { - int dcode = owl_does_defend(dragon[your_dragon].owl_attack_point, + if (DRAGON2(your_dragon).owl_attack_point != NO_MOVE) { + int dcode = owl_does_defend(DRAGON2(your_dragon).owl_attack_point, my_dragon, NULL); if (dcode != 0) { - add_owl_defense_move(dragon[your_dragon].owl_attack_point, my_dragon, + add_owl_defense_move(DRAGON2(your_dragon).owl_attack_point, my_dragon, dcode); DEBUG(DEBUG_SEMEAI, "added owl defense of %1m at %1m with code %d\n", - my_dragon, dragon[your_dragon].owl_attack_point, dcode); - if (dragon[my_dragon].owl_status == DEAD) { + my_dragon, DRAGON2(your_dragon).owl_attack_point, dcode); + if (DRAGON2(my_dragon).owl_status == DEAD) { int pos; for (pos = BOARDMIN; pos < BOARDMAX; pos++) { @@ -384,7 +390,7 @@ continue; if (board[pos] == board[my_dragon] && is_same_dragon(pos, my_dragon)) { - dragon[pos].owl_status = CRITICAL; + DRAGON2(pos).owl_status = CRITICAL; dragon[pos].status = CRITICAL; } } @@ -489,14 +495,14 @@ * may have to be invested in attacking it. */ - if (dragon[my_dragon].owl_status == CRITICAL - && dragon[my_dragon].owl_attack_point != NO_MOVE - && !liberty_of_string(dragon[my_dragon].owl_attack_point, my_dragon)) + if (DRAGON2(my_dragon).owl_status == CRITICAL + && DRAGON2(my_dragon).owl_attack_point != NO_MOVE + && !liberty_of_string(DRAGON2(my_dragon).owl_attack_point, my_dragon)) mylibs++; - if (dragon[your_dragon].owl_status == CRITICAL - && dragon[your_dragon].owl_attack_point != NO_MOVE - && !liberty_of_string(dragon[your_dragon].owl_attack_point, your_dragon)) + if (DRAGON2(your_dragon).owl_status == CRITICAL + && DRAGON2(your_dragon).owl_attack_point != NO_MOVE + && !liberty_of_string(DRAGON2(your_dragon).owl_attack_point, your_dragon)) yourlibs++; /* Now we compute the statuses which result from a @@ -699,7 +705,7 @@ * want to take it. So the matcher status is not changed. */ - if (dragon[my_dragon].owl_status != CRITICAL) { + if (DRAGON2(my_dragon).owl_status != CRITICAL) { if (my_status == ALIVE) update_status(my_dragon, ALIVE, ALIVE_IN_SEKI); else if (my_status == CRITICAL) @@ -725,14 +731,14 @@ if (my_status == CRITICAL || your_status == CRITICAL) { int found_one = 0; - if (dragon[my_dragon].owl_status == CRITICAL - && dragon[my_dragon].owl_defense_point != NO_MOVE) - add_appropriate_semeai_moves(dragon[my_dragon].owl_defense_point, + if (DRAGON2(my_dragon).owl_status == CRITICAL + && DRAGON2(my_dragon).owl_defense_point != NO_MOVE) + add_appropriate_semeai_moves(DRAGON2(my_dragon).owl_defense_point, my_dragon, your_dragon, my_status, your_status, margin_of_safety); - else if (dragon[your_dragon].owl_status == CRITICAL - && dragon[your_dragon].owl_attack_point != NO_MOVE) - add_appropriate_semeai_moves(dragon[your_dragon].owl_attack_point, + else if (DRAGON2(your_dragon).owl_status == CRITICAL + && DRAGON2(your_dragon).owl_attack_point != NO_MOVE) + add_appropriate_semeai_moves(DRAGON2(your_dragon).owl_attack_point, my_dragon, your_dragon, my_status, your_status, margin_of_safety); else if (commonlibs > 1) { Index: engine/showbord.c =================================================================== RCS file: /cvsroot/gnugo/gnugo/engine/showbord.c,v retrieving revision 1.19 diff -u -r1.19 showbord.c --- engine/showbord.c 2 Jan 2003 00:23:29 -0000 1.19 +++ engine/showbord.c 13 Feb 2003 20:03:19 -0000 @@ -255,10 +255,12 @@ showchar(int i, int j, int empty, int xo) { struct dragon_data *d; /* dragon data at (i, j) */ + struct dragon_data2 *d2; int x; ASSERT_ON_BOARD2(i, j); x = BOARD(i, j); d = &(dragon[POS(i, j)]); + d2 = &(dragon2[d->id]); if (x == EMPTY) { if (xo != 2) @@ -326,7 +328,7 @@ write_color_char(domain_colors[2], 'O'); } else if (xo == 3) - write_color_char(colors[BOARD(i, j)][d->owl_status], w); + write_color_char(colors[BOARD(i, j)][d2->owl_status], w); else if (xo == 4) write_color_char(colors[BOARD(i, j)][d->status], w); } Index: engine/value_moves.c =================================================================== RCS file: /cvsroot/gnugo/gnugo/engine/value_moves.c,v retrieving revision 1.81 diff -u -r1.81 value_moves.c --- engine/value_moves.c 1 Feb 2003 10:31:50 -0000 1.81 +++ engine/value_moves.c 13 Feb 2003 20:03:25 -0000 @@ -347,8 +347,8 @@ /* Don't care about inessential dragons. */ if (DRAGON2(dd).safety == INESSENTIAL) continue; - - if (dragon[dd].owl_status != CRITICAL) + + if (DRAGON2(dd).owl_status != CRITICAL) continue; if ((move_reasons[r].type == STRATEGIC_ATTACK_MOVE @@ -360,7 +360,7 @@ && !owl_attack_move_reason_known(pos, dd)) { int kworm = NO_MOVE; int acode = owl_does_attack(pos, dd, &kworm); - if (acode >= dragon[dd].owl_attack_code) { + if (acode >= DRAGON2(dd).owl_attack_code) { if (acode == GAIN) add_gain_move(pos, dd, kworm); else @@ -380,7 +380,7 @@ int kworm = NO_MOVE; /* FIXME: Better use owl_connection_defend() for CONNECT_MOVE ? */ int dcode = owl_does_defend(pos, dd, &kworm); - if (dcode >= dragon[dd].owl_defense_code) { + if (dcode >= DRAGON2(dd).owl_defense_code) { if (dcode == LOSS) add_loss_move(pos, dd, kworm); else @@ -430,7 +430,7 @@ && !owl_defense_move_reason_known(pos2, pos)) { int kworm = NO_MOVE; int dcode = owl_does_defend(pos2, pos, &kworm); - if (dcode >= dragon[pos].owl_defense_code) { + if (dcode >= DRAGON2(pos).owl_defense_code) { if (dcode == LOSS) add_loss_move(pos2, pos, kworm); else @@ -442,7 +442,7 @@ && !owl_attack_move_reason_known(pos2, pos)) { int kworm = NO_MOVE; int acode = owl_does_attack(pos2, pos, &kworm); - if (acode >= dragon[pos].owl_attack_code) { + if (acode >= DRAGON2(pos).owl_attack_code) { if (acode == GAIN) add_gain_move(pos2, pos, kworm); else @@ -854,14 +854,14 @@ if (aa == bb) continue; - if (dragon[aa].owl_status == ALIVE - || dragon[bb].owl_status == ALIVE) { + if (DRAGON2(aa).owl_status == ALIVE + || DRAGON2(bb).owl_status == ALIVE) { tactical_safety = 1; safety = 1; } - else if ((dragon[aa].owl_status == UNCHECKED + else if ((DRAGON2(aa).owl_status == UNCHECKED && dragon[aa].crude_status == ALIVE) - || (dragon[bb].owl_status == UNCHECKED + || (DRAGON2(bb).owl_status == UNCHECKED && dragon[bb].crude_status == ALIVE)) { tactical_safety = 1; safety = 1; @@ -1458,7 +1458,7 @@ * ineffective. The 0.45 factor is chosen so that even in * combination with bad ko it still has a positive net impact. */ - if (dragon[aa].owl_status == CRITICAL + if (DRAGON2(aa).owl_status == CRITICAL && (owl_defense_move_reason_known(pos, aa) < defense_move_reason_known(pos, aa))) { this_value = 0.45 * (2 * worm[aa].effective_size); Index: interface/play_gtp.c =================================================================== RCS file: /cvsroot/gnugo/gnugo/interface/play_gtp.c,v retrieving revision 1.111 diff -u -r1.111 play_gtp.c --- interface/play_gtp.c 3 Jan 2003 15:26:52 -0000 1.111 +++ interface/play_gtp.c 13 Feb 2003 20:03:32 -0000 @@ -1910,10 +1910,10 @@ assert(dragon[pos].status == CRITICAL); /* Status critical, need to return attack and defense point as well. */ gtp_mprintf("critical %m %m\n", - I(dragon[pos].owl_attack_point), - J(dragon[pos].owl_attack_point), - I(dragon[pos].owl_defense_point), - J(dragon[pos].owl_defense_point)); + I(DRAGON2(pos).owl_attack_point), + J(DRAGON2(pos).owl_attack_point), + I(DRAGON2(pos).owl_defense_point), + J(DRAGON2(pos).owl_defense_point)); } } } Index: patterns/helpers.c =================================================================== RCS file: /cvsroot/gnugo/gnugo/patterns/helpers.c,v retrieving revision 1.46 diff -u -r1.46 helpers.c --- patterns/helpers.c 12 Jan 2003 15:26:53 -0000 1.46 +++ patterns/helpers.c 13 Feb 2003 20:03:36 -0000 @@ -610,13 +610,13 @@ int owl_threatens_attack(int apos, int bpos) { - if (dragon[bpos].owl_status == CRITICAL - && dragon[bpos].owl_attack_point == apos) + if (DRAGON2(bpos).owl_status == CRITICAL + && DRAGON2(bpos).owl_attack_point == apos) return 1; - if (dragon[bpos].owl_threat_status == CAN_THREATEN_ATTACK) - if (dragon[bpos].owl_attack_point == apos - || dragon[bpos].owl_second_attack_point == apos) + if (DRAGON2(bpos).owl_threat_status == CAN_THREATEN_ATTACK) + if (DRAGON2(bpos).owl_attack_point == apos + || DRAGON2(bpos).owl_second_attack_point == apos) return 1; return 0;