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
{
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
;
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 { \
38 item_ = (mi_ & 0xf) | ((amaf_nakade(mi_) op_ 1) << 8); \
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
);