t-unit: display stats at the end
[pachi.git] / ownermap.h
blob629e1f7ca337e37b30460b2a75e3b3139f8032d9
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 {
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, floating_t thres);
32 float board_ownermap_estimate_point(struct board_ownermap *ownermap, coord_t c);
35 /* Estimate status of stones on board based on ownermap stats. */
36 struct group_judgement {
37 floating_t thres;
38 enum gj_state {
39 GS_NONE,
40 GS_DEAD,
41 GS_ALIVE,
42 GS_UNKNOWN,
43 } *gs; // [bsize2]
45 void board_ownermap_judge_groups(struct board *b, struct board_ownermap *ownermap, struct group_judgement *judge);
47 /* Add groups of given status to mq. */
48 struct move_queue;
49 void groups_of_status(struct board *b, struct group_judgement *judge, enum gj_state s, struct move_queue *mq);
51 #endif