Ticket #208: gunnar_7_13.7.diff

File gunnar_7_13.7.diff, 3.0 KB (added by gunnar, 3 years ago)

Be more forgiving with replacement moves conflicting with unconditional analysis.

  • engine/liberty.h

    diff --git a/engine/liberty.h b/engine/liberty.h
    index 416cd29..7eb1d6b 100644
    a b void add_expand_moyo_move(int pos); 
    386386void add_strategical_attack_move(int pos, int dr); 
    387387void add_strategical_defense_move(int pos, int dr); 
    388388void add_worthwhile_threat_move(int pos); 
    389 void add_replacement_move(int from, int to); 
     389void add_replacement_move(int from, int to, int color); 
    390390 
    391391/* Parameters to add_either_move and add_all_move */ 
    392392#define ATTACK_STRING  1 
  • engine/move_reasons.c

    diff --git a/engine/move_reasons.c b/engine/move_reasons.c
    index 8d8c24e..36c8c90 100644
    a b set_maximum_territorial_value(int pos, float value) 
    13521352 * to (to).  
    13531353 */ 
    13541354void 
    1355 add_replacement_move(int from, int to) 
     1355add_replacement_move(int from, int to, int color) 
    13561356{ 
    13571357  int cc; 
    13581358  int pos; 
     1359  int dummy; 
    13591360 
    13601361  ASSERT_ON_BOARD1(from); 
    13611362  ASSERT_ON_BOARD1(to); 
    add_replacement_move(int from, int to) 
    13651366  ASSERT1(board[to] == EMPTY, to); 
    13661367 
    13671368  cc = replacement_map[to]; 
     1369  if (unconditionally_meaningless_move(to, color, &dummy)) { 
     1370    /* Silently ignore replacement patterns which conflict with the 
     1371     * unconditional analysis since the latter is always correct and 
     1372     * it's difficult to anticipate such situations for the patterns. 
     1373     */ 
     1374    return; 
     1375  } 
    13681376 
    13691377  /* First check for an incompatible redistribution rule. */ 
    13701378  if (replacement_map[from] != NO_MOVE) { 
  • engine/unconditional.c

    diff --git a/engine/unconditional.c b/engine/unconditional.c
    index 54d5638..3640ed9 100644
    a b unconditional_move_reasons(int color) 
    692692      } 
    693693      else { 
    694694        TRACE("%1m unconditionally replaced to %1m.\n", pos, replacement_move); 
    695         add_replacement_move(pos, replacement_move); 
     695        add_replacement_move(pos, replacement_move, color); 
    696696      } 
    697697    } 
    698698} 
  • patterns/helpers.c

    diff --git a/patterns/helpers.c b/patterns/helpers.c
    index 85f606e..1938af8 100644
    a b backfill_replace(int move, int str) 
    738738    if (attack_and_defend(str, NULL, NULL, NULL, &defense_move)) { 
    739739      /* Must undo the trymove before adding the replacement move. */ 
    740740      popgo(); 
    741       add_replacement_move(move, defense_move); 
     741      add_replacement_move(move, defense_move, board[str]); 
    742742    } 
    743743    else 
    744744      popgo(); 
  • patterns/mkpat.c

    diff --git a/patterns/mkpat.c b/patterns/mkpat.c
    index 2a90abd..83ececd 100644
    a b static struct autohelper_func autohelper_functions[] = { 
    411411                "connect_and_cut_helper2(%s, %s, %s, color)"}, 
    412412  {"connect_and_cut_helper",    3, 0, 3.00, "connect_and_cut_helper(%s, %s, %s)"}, 
    413413  {"owl_threatens",             2, 0, 0.01, "owl_threatens_attack(%s, %s)"}, 
    414   {"replace",                   2, 0, 0.0,  "add_replacement_move(%s, %s)"}, 
     414  {"replace",                   2, 0, 0.0,  "add_replacement_move(%s, %s, color)"}, 
    415415  {"backfill_replace",          2, 0, 0.0,  "backfill_replace(%s, %s)"}, 
    416416  {"non_oterritory",            1, 0, 0.0, 
    417417                "influence_mark_non_territory(%s, color)"},