1 #ifndef ZZGO_UCT_PRIOR_H
2 #define ZZGO_UCT_PRIOR_H
16 /* [board_size2(b)] array, move_stats are the prior
17 * values to be assigned to individual moves;
18 * move_stats.value is not updated. */
19 struct move_stats
*prior
;
20 /* [board_size2(b)] array, whether to compute
21 * prior for the given value. */
23 /* [board_size2(b)] array from cfg_distances() */
27 /* @value is the value, @playouts is its weight. */
28 static void add_prior_value(struct prior_map
*map
, coord_t c
, float value
, int playouts
);
30 void uct_prior(struct uct
*u
, struct tree_node
*node
, struct prior_map
*map
);
33 struct uct_prior
*uct_prior_init(char *arg
);
37 add_prior_value(struct prior_map
*map
, coord_t c
, float value
, int playouts
)
39 float v
= map
->parity
> 0 ? value
: 1 - value
;
40 /* We don't need atomicity: */
41 struct move_stats s
= { .playouts
= playouts
, .value
= v
};
42 stats_merge(&map
->prior
[c
], &s
);