Ticket #169: draqo-worm.diff
| File draqo-worm.diff, 1.9 kB (added by gunnar, 16 months ago) |
|---|
-
engine/worm.c
298 298 */ 299 299 if (worm[str].color == OTHER_COLOR(color) 300 300 && worm[str].attack_codes[0] != 0 301 && worm[str].attack_points[0] != pos 301 302 && worm[str].defense_codes[0] != 0) { 302 303 int dcode = find_defense(str, NULL); 303 304 if (dcode < worm[str].defense_codes[0]) { … … 343 344 * pos. 344 345 */ 345 346 else if (worm[str].color == color 346 && worm[str].attack_codes[0] != 0) { 347 && worm[str].attack_codes[0] != 0 348 && worm[str].defense_points[0] != pos) { 347 349 int acode = attack(str, NULL); 348 350 if (acode < worm[str].attack_codes[0]) { 349 351 int defense_works = 1; … … 785 787 if (defense_point != NO_MOVE) 786 788 change_defense(str, defense_point, dcode); 787 789 } 788 else {789 /* If the point of attack is not adjacent to the worm,790 * it is possible that this is an overlooked point of791 * defense, so we try and see if it defends.792 */793 attack_point = worm[str].attack_points[0];794 if (!liberty_of_string(attack_point, str))795 if (trymove(attack_point, worm[str].color, "make_worms", NO_MOVE)) {796 int acode = attack(str, NULL);797 if (acode != WIN) {798 change_defense(str, attack_point, REVERSE_RESULT(acode));799 TRACE("worm at %1m can be defended at %1m with code %d\n",800 str, attack_point, REVERSE_RESULT(acode));801 }802 popgo();803 }804 }805 790 } 806 791 } 807 792 gg_assert(stackp == 0); … … 854 839 /* Try to defend at the liberty. */ 855 840 if (!defense_move_known(pos, str)) { 856 841 if (worm[str].defense_codes[0] != 0) 857 if (trymove(pos, color, "make_worms", NO_MOVE)) { 842 if (fastlib(pos, other, 0) != 1 843 && trymove(pos, color, "make_worms", NO_MOVE)) { 858 844 acode = attack(str, NULL); 859 845 if (acode != WIN) 860 846 change_defense(str, pos, REVERSE_RESULT(acode));
