book.dat: Introduce fbook data file, from Fuego r1174
[pachi/derm.git] / ownermap.h
blob337fbe0ccf83b2b7187a77d13d6c055bc4a44fcc
1 #ifndef ZZGO_OWNERMAP_H
2 #define ZZGO_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 {
26 PJ_DAME = S_NONE,
27 PJ_BLACK = S_BLACK,
28 PJ_WHITE = S_WHITE,
29 PJ_UNKNOWN = 3,
31 enum point_judgement board_ownermap_judge_point(struct board_ownermap *ownermap, coord_t c, float thres);
34 /* Estimate status of stones on board based on ownermap stats. */
35 struct group_judgement {
36 float thres;
37 enum gj_state {
38 GS_NONE,
39 GS_DEAD,
40 GS_ALIVE,
41 GS_UNKNOWN,
42 } *gs; // [bsize2]
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. */
47 struct move_queue;
48 void groups_of_status(struct board *b, struct group_judgement *judge, enum gj_state s, struct move_queue *mq);
50 #endif