Ticket #173: lively-stones-2.diff

File lively-stones-2.diff, 2.9 kB (added by arend, 17 months ago)

This is the same patch, just rediffed.

  • engine/value_moves.c

    RCS file: /home/arend/Go/gnugo-rsync/gnugo/engine/value_moves.c,v
    retrieving revision 1.171
    diff -u -p -r1.171 value_moves.c
     
    29772977        || (owl_move_reason_known(pos, aa) 
    29782978            && dragon[aa].status == CRITICAL) 
    29792979        || move_reason_known(pos, SEMEAI_MOVE, aa)) { 
     2980      float excess_value; 
     2981      int our_dragon = (color == worm[aa].color); 
     2982      float dragon_ter_val = 2 * DRAGON2(aa).strategic_size; 
     2983 
     2984      if ((our_dragon && defense_move_known(pos, aa) == WIN) 
     2985          || (!our_dragon && attack_move_known(pos, aa) == WIN)) { 
     2986        excess_value = dragon_ter_val - move[pos].territorial_value; 
     2987        if (excess_value > 0.0) { 
     2988          /* We haven't counted all the territorial value, the most probably 
     2989           * because of ko situations - repair it here. 
     2990           * FIXME: We should count values of all ko threats to know how 
     2991           * much we really gain. As for now 0.75 factor is used. */ 
     2992          excess_value *= 0.75; 
     2993          TRACE("  %1m: %f - territory underestimation bonus for %1m\n", pos, 
     2994                excess_value, aa); 
     2995          tot_value += excess_value; 
     2996        } 
     2997      } 
     2998 
    29802999      /* But if the strategical value was larger than the territorial 
    29813000       * value (e.g. because connecting to strong dragon) we award the 
    29823001       * excess value as a bonus. 
    29833002       */ 
    2984       float excess_value = (dragon_value[aa] -  
    2985                             2 * DRAGON2(aa).strategic_size); 
     3003      excess_value = (dragon_value[aa] - dragon_ter_val); 
    29863004      if (excess_value > 0.0) { 
    29873005        TRACE("  %1m: %f - strategic bonus for %1m\n", pos, excess_value, aa); 
    29883006        tot_value += excess_value; 
  • engine/worm.c

    RCS file: /home/arend/Go/gnugo-rsync/gnugo/engine/worm.c,v
    retrieving revision 1.74
    diff -u -p -r1.74 worm.c
     
    17061706} 
    17071707 
    17081708 
     1709/* Find stones, that could live for sure, if player (color) moves 
     1710 * first. 
     1711 */ 
     1712 
    17091713void 
    17101714get_lively_stones(int color, signed char safe_stones[BOARDMAX]) 
    17111715{ 
     
    17131717  memset(safe_stones, 0, BOARDMAX * sizeof(*safe_stones)); 
    17141718  for (pos = BOARDMIN; pos < BOARDMAX; pos++) 
    17151719    if (IS_STONE(board[pos]) && find_origin(pos) == pos) { 
    1716       if ((stackp == 0 && worm[pos].attack_codes[0] == 0) || !attack(pos, NULL) 
     1720      if ((stackp == 0 && worm[pos].attack_codes[0] == 0) 
     1721           || !attack(pos, NULL) 
    17171722          || (board[pos] == color 
    1718               && ((stackp == 0 && worm[pos].defense_codes[0] != 0) 
    1719                   || find_defense(pos, NULL)))) 
     1723              && ((stackp == 0 && worm[pos].defense_codes[0] == WIN) 
     1724                  || find_defense(pos, NULL) == WIN))) 
    17201725        mark_string(pos, safe_stones, 1); 
    17211726    } 
    17221727}