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 /* How big proportion of ownermap counts must be of one color to consider
13 struct board_ownermap
{
14 /* Map of final owners of all intersections on the board. */
15 /* This may be shared between multiple threads! */
16 /* XXX: We assume sig_atomic_t is thread-atomic. This may not
17 * be true in pathological cases. */
18 sig_atomic_t playouts
;
19 /* At the final board position, for each coordinate increase the
20 * counter of appropriate color. */
21 sig_atomic_t (*map
)[S_MAX
]; // [board_size2(b)]
24 void board_print_ownermap(struct board
*b
, FILE *f
, struct board_ownermap
*ownermap
);
25 void board_ownermap_fill(struct board_ownermap
*ownermap
, struct board
*b
);
26 void board_ownermap_merge(int bsize2
, struct board_ownermap
*dst
, struct board_ownermap
*src
);
29 /* Estimate coord ownership based on ownermap stats. */
30 enum point_judgement
{
36 enum point_judgement
board_ownermap_judge_point(struct board_ownermap
*ownermap
, coord_t c
, floating_t thres
);
37 float board_ownermap_estimate_point(struct board_ownermap
*ownermap
, coord_t c
);
40 /* Estimate status of stones on board based on ownermap stats. */
41 struct group_judgement
{
50 void board_ownermap_judge_groups(struct board
*b
, struct board_ownermap
*ownermap
, struct group_judgement
*judge
);
52 /* Add groups of given status to mq. */
54 void groups_of_status(struct board
*b
, struct group_judgement
*judge
, enum gj_state s
, struct move_queue
*mq
);