4 /* Move statistics; we track how good value each move has. */
7 int playouts
; // # of playouts
8 float value
; // BLACK wins/playouts
11 /* Add a result to the stats. */
12 static void stats_add_result(struct move_stats
*s
, float result
, int playouts
);
14 /* Merge two stats together. */
15 static void stats_merge(struct move_stats
*dest
, struct move_stats
*src
);
17 /* Reverse stats parity. */
18 static void stats_reverse_parity(struct move_stats
*s
);
22 stats_add_result(struct move_stats
*s
, float result
, int playouts
)
24 s
->playouts
+= playouts
;
25 s
->value
+= (result
- s
->value
) * playouts
/ s
->playouts
;
29 stats_merge(struct move_stats
*dest
, struct move_stats
*src
)
31 stats_add_result(dest
, src
->value
, src
->playouts
);
35 stats_reverse_parity(struct move_stats
*s
)
37 s
->value
= 1 - s
->value
;