Ticket #199: gunnar_9_1.9.diff

File gunnar_9_1.9.diff, 2.6 KB (added by gunnar, 23 months ago)

Constrain D711 and D712 to only capture bent four in the corner strings.

  • patterns/helpers.c

    diff --git a/patterns/helpers.c b/patterns/helpers.c
    index e08238c..c615f8f 100644
    a b int distrust_tactics_helper(int str) 
    881881  return 0; 
    882882} 
    883883 
     884 
     885/* 
     886 * This helper returns 1 if str is part of a 4 stone string having a 
     887 * bent four in the corner shape. 
     888 * 
     889 * |x??? 
     890 * |Oxx? 
     891 * |OOOx 
     892 * +---- 
     893 * 
     894 */ 
     895 
     896int 
     897bent_four_helper(int str) 
     898{ 
     899  int stones[4]; 
     900  int good_corner_found = 0; 
     901  int color = board[str]; 
     902  int k; 
     903 
     904  if (!IS_STONE(color)) 
     905    return 0; 
     906 
     907  if (findstones(str, 4, stones) != 4) 
     908    return 0; 
     909 
     910  /* All stones must be on the edge. Also detect the presence of a 
     911   * corner stone. 
     912   */ 
     913  for (k = 0; k < 4; k++) { 
     914    if (!is_edge_vertex(stones[k])) 
     915      return 0; 
     916    if (is_corner_vertex(stones[k])) { 
     917      int corner = stones[k]; 
     918      if ((board[EAST(corner)] == color) 
     919          + (board[SOUTH(corner)] == color) 
     920          + (board[WEST(corner)] == color) 
     921          + (board[NORTH(corner)] == color) == 2) 
     922        good_corner_found = 1; 
     923    } 
     924  } 
     925 
     926  return good_corner_found; 
     927} 
     928 
     929 
    884930/* 
    885931 * LOCAL Variables: 
    886932 * tab-width: 8 
  • patterns/owl_defendpats.db

    diff --git a/patterns/owl_defendpats.db b/patterns/owl_defendpats.db
    index 3a3e7c8..79537e9 100644
    a b O.a 
    28852885 
    28862886 
    28872887Pattern D711 
     2888# gf Revised constraint. (3.9.1) 
     2889# This pattern is really only helpful for bent four in the corner 
     2890# situations, see e.g. owl:223 and nicklas1:1902. In certain semeai 
     2891# situations it is directly harmful to capture the nakade stones 
     2892# prematurely. 
    28882893 
    28892894O?          capture nakade, might give new possibilities 
    28902895X* 
    X* 
    28942899O? 
    28952900A* 
    28962901 
    2897 ;lib(A)==1 && wormsize(A)>=3 
     2902;lib(A)==1 && wormsize(A)==4 && bent_four_helper(A) 
    28982903 
    28992904 
    29002905Pattern D712 
     2906# gf Revised constraint. (3.9.1) 
     2907# This pattern is really only helpful for bent four in the corner 
     2908# situations, see e.g. owl:223 and nicklas1:1902. In certain semeai 
     2909# situations it is directly harmful to capture the nakade stones 
     2910# prematurely. 
    29012911 
    29022912?O          capture nakade, might give new possibilities 
    29032913X* 
    X* 
    29072917?O 
    29082918A* 
    29092919 
    2910 ;lib(A)==1 && wormsize(A)>=3 
     2920;lib(A)==1 && wormsize(A)==4 && bent_four_helper(A) 
    29112921 
    29122922 
    29132923Pattern D713 
  • patterns/patterns.h

    diff --git a/patterns/patterns.h b/patterns/patterns.h
    index d8a353e..7904927 100644
    a b int adjacent_to_defendable_stone_in_atari(int str); 
    332332void backfill_replace(int move, int str); 
    333333int break_mirror_helper(int str, int color); 
    334334int distrust_tactics_helper(int str); 
     335int bent_four_helper(int str); 
    335336int disconnect_helper(int apos, int bpos); 
    336337 
    337338