UCB1AMAF: Rationale for zero gp_eqex
[pachi.git] / playout.h
bloba909804c9cbe837c145365e724ecd13d697100aa
1 #ifndef ZZGO_PLAYOUT_H
2 #define ZZGO_PLAYOUT_H
4 struct board;
5 struct move;
6 enum stone;
9 struct playout_policy;
10 typedef coord_t (*playoutp_choose)(struct playout_policy *playout_policy, struct board *b, enum stone my_color);
11 /* 0.0 - 1.0; can return NAN is policy has no opinion */
12 typedef float (*playoutp_assess)(struct playout_policy *playout_policy, struct board *b, struct move *m);
14 struct playout_policy {
15 int debug_level;
16 /* We call choose when we ask policy about next move.
17 * We call assess when we ask policy about how good given move is. */
18 playoutp_choose choose;
19 playoutp_assess assess;
20 void *data;
24 /* Record of the random playout - for each intersection:
25 * S_NONE: This move was never played
26 * S_BLACK: This move was played by black first
27 * S_WHITE: This move was played by white first
29 struct playout_amafmap {
30 enum stone *map; // [board_size2(b)]
31 /* the lowest &0xf is the enum stone, upper bits are nakade
32 * counter - in case of nakade, we record only color of the
33 * first stone played inside, but count further throwins
34 * and ignore AMAF value after these. */
35 #define amaf_nakade(item_) (item_ >> 8)
36 #define amaf_op(item_, op_) do { \
37 int mi_ = item_; \
38 item_ = (mi_ & 0xf) | ((amaf_nakade(mi_) op_ 1) << 8); \
39 } while (0)
43 /* 1: starting_color wins, 0: starting_color loses
44 * -1: superko inside the game tree */
45 int play_random_game(struct board *b, enum stone starting_color, int gamelen, struct playout_amafmap *amafmap, struct playout_policy *policy);
47 #endif