TESTS: First 9x9 ba2e1 results
[pachi.git] / tactics.h
blobc893acdec28ec127f517783d24b1b05cd968ec8b
1 #ifndef ZZGO_TACTICS_H
2 #define ZZGO_TACTICS_H
4 /* Advanced tactical checks non-essential to the board implementation. */
6 #include "board.h"
8 /* Check if this move is undesirable self-atari (resulting group would have
9 * only single liberty and not capture anything; ko is allowed); we mostly
10 * want to avoid these moves. The function actually does a rather elaborate
11 * tactical check, allowing self-atari moves that are nakade, eye falsification
12 * or throw-ins. */
13 static bool is_bad_selfatari(struct board *b, enum stone color, coord_t to);
15 /* Checks if there are any stones in n-vincinity of coord. */
16 bool board_stone_radar(struct board *b, coord_t coord, int distance);
18 /* Construct a "common fate graph" from given coordinate; that is, a weighted
19 * graph of intersections where edges between all neighbors have weight 1,
20 * but edges between neighbors of same color have weight 0. Thus, this is
21 * "stone chain" metric in a sense. */
22 /* The output are distanes from start stored in given [board_size2()] array;
23 * intersections further away than maxdist have all distance maxdist+1 set. */
24 void cfg_distances(struct board *b, coord_t start, int *distances, int maxdist);
27 bool is_bad_selfatari_slow(struct board *b, enum stone color, coord_t to);
28 static inline bool
29 is_bad_selfatari(struct board *b, enum stone color, coord_t to)
31 /* More than one immediate liberty, thumbs up! */
32 if (immediate_liberty_count(b, to) > 1)
33 return false;
35 return is_bad_selfatari_slow(b, color, to);
38 #endif