1 #ifndef PACHI_OWNERMAP_H
2 #define PACHI_OWNERMAP_H
4 /* Map of board intersection owners, and devices to derive group status
5 * information from the map. */
7 #include <signal.h> // sig_atomic_t
9 struct board_ownermap
{
10 /* Map of final owners of all intersections on the board. */
11 /* This may be shared between multiple threads! */
12 /* XXX: We assume sig_atomic_t is thread-atomic. This may not
13 * be true in pathological cases. */
14 sig_atomic_t playouts
;
15 /* At the final board position, for each coordinate increase the
16 * counter of appropriate color. */
17 sig_atomic_t (*map
)[S_MAX
]; // [board_size2(b)]
20 void board_ownermap_fill(struct board_ownermap
*ownermap
, struct board
*b
);
21 void board_ownermap_merge(int bsize2
, struct board_ownermap
*dst
, struct board_ownermap
*src
);
24 /* Estimate coord ownership based on ownermap stats. */
25 enum point_judgement
{
31 enum point_judgement
board_ownermap_judge_point(struct board_ownermap
*ownermap
, coord_t c
, floating_t thres
);
34 /* Estimate status of stones on board based on ownermap stats. */
35 struct group_judgement
{
44 void board_ownermap_judge_group(struct board
*b
, struct board_ownermap
*ownermap
, struct group_judgement
*judge
);
46 /* Add groups of given status to mq. */
48 void groups_of_status(struct board
*b
, struct group_judgement
*judge
, enum gj_state s
, struct move_queue
*mq
);