Ticket #168: draqo-send2ret1a.diff
| File draqo-send2ret1a.diff, 2.1 kB (added by gunnar, 15 months ago) |
|---|
-
engine/utils.c
1426 1426 int other = OTHER_COLOR(color); 1427 1427 int lib1; 1428 1428 int lib2; 1429 int neighbor; 1429 1430 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 1430 1443 /* Try to play the move. */ 1431 1444 if (!trymove(move, color, "send_two_return_one-A", NO_MOVE)) 1432 1445 return 0; -
engine/board.c
2873 2873 || board[EAST(pos)] == color); 2874 2874 } 2875 2875 2876 /* If (pos) has exactly one neighbor of color (color) 2877 * returns position of this neighbor. Otherwise returns NO_MOVE. 2878 */ 2879 2880 int 2881 find_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 2876 2915 /* 2877 2916 * Returns true if str1 and str2 belong to the same string. 2878 2917 */ -
engine/board.h
323 323 int second_order_liberty_of_string(int pos, int str); 324 324 int neighbor_of_string(int pos, int str); 325 325 int has_neighbor(int pos, int color); 326 int find_neighbor(int pos, int color); 326 327 int same_string(int str1, int str2); 327 328 int adjacent_strings(int str1, int str2); 328 329 void mark_string(int str, signed char mx[BOARDMAX], signed char mark);
