UCT tree_leaf_node(), tree_update_node_value(): Public static inline
[pachi/json.git] / uct / internal.h
blobb7900063ffd9ed6ad5325fcd4e9d5a668c936181
1 #ifndef ZZGO_UCT_INTERNAL_H
2 #define ZZGO_UCT_INTERNAL_H
4 #include "debug.h"
5 #include "move.h"
6 #include "playout.h"
8 struct tree;
9 struct tree_node;
10 struct uct_policy;
12 /* Internal UCT structures */
15 /* Internal engine state. */
16 struct uct {
17 int debug_level;
18 int games, gamelen;
19 float resign_ratio;
20 float loss_threshold;
21 int expand_p;
22 int radar_d;
23 bool playout_amaf, playout_amaf_nakade;
24 int playout_amaf_cutoff;
25 int dumpthres;
26 int threads;
27 int force_seed;
28 bool no_book;
30 /* Equivalent experience for prior knowledge. MoGo paper recommends
31 * 50 playouts per source; in practice, esp. with RAVE, about 6
32 * playouts per source seems best. */
33 int eqex, even_eqex, gp_eqex, policy_eqex;
35 struct uct_policy *policy;
36 struct tree *t;
37 struct playout_policy *playout;
40 #define UDEBUGL(n) DEBUGL_(u->debug_level, n)
43 typedef struct tree_node *(*uctp_choose)(struct uct_policy *p, struct tree_node *node, struct board *b, enum stone color);
44 typedef struct tree_node *(*uctp_descend)(struct uct_policy *p, struct tree *tree, struct tree_node *node, int parity, bool allow_pass);
45 typedef void (*uctp_prior)(struct uct_policy *p, struct tree *tree, struct tree_node *node, struct board *b, enum stone color, int parity);
46 typedef void (*uctp_update)(struct uct_policy *p, struct tree *tree, struct tree_node *node, enum stone node_color, enum stone player_color, struct playout_amafmap *amaf, int result);
48 struct uct_policy {
49 struct uct *uct;
50 uctp_choose choose;
51 uctp_descend descend;
52 uctp_update update;
53 uctp_prior prior;
54 bool wants_amaf;
55 void *data;
58 #endif