Ticket #169: worm.patch

File worm.patch, 1.7 kB (added by draqo, 18 months ago)
  • engine/worm.c

    diff -N -r -u -X .ignore gnugo-copy/engine/worm.c gnugo/engine/worm.c
    old new  
    290290           */ 
    291291          if (worm[str].color == OTHER_COLOR(color) 
    292292              && worm[str].attack_codes[0] != 0 
     293              && worm[str].attack_points[0] != pos 
    293294              && worm[str].defense_codes[0] != 0) { 
    294295            int dcode = find_defense(str, NULL); 
    295296            if (dcode < worm[str].defense_codes[0]) { 
     
    335336           * pos. 
    336337           */ 
    337338          else if (worm[str].color == color 
    338                    && worm[str].attack_codes[0] != 0) { 
     339                   && worm[str].attack_codes[0] != 0 
     340                   && worm[str].defense_points[0] != pos) { 
    339341            int acode = attack(str, NULL); 
    340342            if (acode < worm[str].attack_codes[0]) { 
    341343              int defense_works = 1; 
     
    782784        if (defense_point != NO_MOVE) 
    783785          change_defense(str, defense_point, dcode); 
    784786      } 
     787/* This code doesn't give us nearly anything at all and costs some time. 
     788 * All defending moves should be found directly. On whole regression it 
     789 * gives only a few hits and doesn't change a result of any test. 
     790 */ 
     791#if 0 
    785792      else { 
    786793        /* If the point of attack is not adjacent to the worm,  
    787794         * it is possible that this is an overlooked point of 
     
    799806            popgo(); 
    800807          } 
    801808      } 
     809#endif 
    802810    } 
    803811  } 
    804812  gg_assert(stackp == 0); 
     
    852860      if (worm[str].defense_codes[0] && !defense_move_known(pos, str) 
    853861          && !discarded_move_known(pos, MAX_TACTICAL_POINTS, 
    854862                                   worm[str].discarded_defenses)) { 
    855         if (trymove(pos, color, "make_worms", NO_MOVE)) { 
     863        if (fastlib(pos, other, 0) != 1 
     864            && trymove(pos, color, "make_worms", NO_MOVE)) { 
    856865          if (countlib(pos) > 1) { 
    857866            acode = attack(str, NULL); 
    858867            if (acode != WIN)