fbook: In case of multiple candidates, pick a semi-random one instead of the first one
[pachi/derm.git] / fbook.h
blob734251a6121ef3b489e5055bebf1580704a36477
1 #ifndef ZZGO_FBOOK_H
2 #define ZZGO_FBOOK_H
4 #include "move.h"
6 struct board;
8 /* Opening book (fbook as in "forcing book" since the move is just
9 * played unconditionally if found, or possibly "fuseki book"). */
11 struct fbook {
12 int bsize;
13 int handicap;
15 #define fbook_hash_bits 16 // 1M w/ 32-bit coord_t
16 #define fbook_hash_mask ((1 << fbook_hash_bits) - 1)
17 /* pass == no move in this position */
18 coord_t moves[1<<fbook_hash_bits];
19 hash_t hashes[1<<fbook_hash_bits];
22 struct fbook *fbook_init(char *filename, struct board *b);
23 void fbook_done(struct fbook *fbook);
25 #endif