Ticket #168: draqo-send2ret1.diff

File draqo-send2ret1.diff, 2.8 kB (added by gunnar, 20 months ago)

Rediffed and lightly modified patch.

  • engine/utils.c

     
    14261426  int other = OTHER_COLOR(color); 
    14271427  int lib1; 
    14281428  int lib2; 
     1429  int neighbor; 
    14291430 
     1431  /* We must check this, because in such position: 
     1432   * 
     1433   * ----- 
     1434   * O.*OX 
     1435   * OOXXX 
     1436   * 
     1437   * move * prevents making an eye by X player. 
     1438   */ 
     1439  neighbor = find_neighbor(move, color); 
     1440  if (neighbor == NO_MOVE || countlib(neighbor) != 2) 
     1441    return 0; 
     1442 
    14301443  /* Try to play the move. */ 
    14311444  if (!trymove(move, color, "send_two_return_one-A", NO_MOVE)) 
    14321445    return 0; 
  • engine/reading.c

     
    175175      int ko_move;                                                      \ 
    176176      int apos = moves.pos[k];                                          \ 
    177177                                                                        \ 
    178       if (komaster_trymove(apos, other, moves.message[k], str,&ko_move, \ 
    179                            stackp <= ko_depth && savecode == 0)) {      \ 
     178      if ((board_ko_pos || !send_two_return_one(apos, other))           \ 
     179          && komaster_trymove(apos, other, moves.message[k], str, &ko_move,\ 
     180                              stackp <= ko_depth && savecode == 0)) {   \ 
    180181        int dcode = do_find_defense(str, (defense_hint));               \ 
    181182                                                                        \ 
    182183        if (REVERSE_RESULT(dcode) > savecode                            \ 
  • engine/board.c

     
    28732873          || board[EAST(pos)] == color); 
    28742874} 
    28752875 
     2876/* If (pos) has exactly one neighbor of color (color) 
     2877 * returns position of this neighbor. Otherwise returns NO_MOVE. 
     2878 */ 
     2879 
     2880int 
     2881find_neighbor(int pos, int color) 
     2882{ 
     2883  int npos = NO_MOVE; 
     2884 
     2885  ASSERT_ON_BOARD1(pos); 
     2886  ASSERT1(IS_STONE(color), pos); 
     2887 
     2888  if (board[SOUTH(pos)] == color) 
     2889    npos = SOUTH(pos); 
     2890 
     2891  if (board[WEST(pos)] == color) { 
     2892    if (npos != NO_MOVE) 
     2893      return NO_MOVE; 
     2894    else 
     2895      npos = WEST(pos); 
     2896  } 
     2897 
     2898  if (board[NORTH(pos)] == color) { 
     2899    if (npos != NO_MOVE) 
     2900      return NO_MOVE; 
     2901    else 
     2902      npos = NORTH(pos); 
     2903  } 
     2904 
     2905  if (board[EAST(pos)] == color) { 
     2906    if (npos != NO_MOVE) 
     2907      return NO_MOVE; 
     2908    else 
     2909      npos = EAST(pos); 
     2910  } 
     2911 
     2912  return npos; 
     2913} 
     2914 
    28762915/* 
    28772916 * Returns true if str1 and str2 belong to the same string. 
    28782917 */ 
  • engine/board.h

     
    323323int second_order_liberty_of_string(int pos, int str); 
    324324int neighbor_of_string(int pos, int str); 
    325325int has_neighbor(int pos, int color); 
     326int find_neighbor(int pos, int color); 
    326327int same_string(int str1, int str2); 
    327328int adjacent_strings(int str1, int str2); 
    328329void mark_string(int str, signed char mx[BOARDMAX], signed char mark);