-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbook.h
More file actions
32 lines (26 loc) · 1.24 KB
/
book.h
File metadata and controls
32 lines (26 loc) · 1.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#ifndef OPENINGBOOK_H
#define OPENINGBOOK_H
#define BOOK_ENDED 1
#define BOOK_READY 0
#include "hashing.h"
#include "moveHandler.h"
typedef struct book_node_t
{
hash_t hash; // Hash of the board represented by node, this is utilzied when building the book
Move *moves; // List of all possible moves
uint64_t *nodeIndices; // List of all node indices corresponding the moves
uint8_t nNodes; // Number of moves in the position
} BookNode;
typedef struct book_t
{
struct book_node_t *currentNode; // The current node of the board
struct book_node_t *initialNode; // The first node in the book, initial board
struct book_node_t *nodes; // List of all nodes in the book
uint64_t nNodes; // Number of nodes (boards) in the book
int status; // BOOK_ENDED, or BOOK_READY
} Book;
void generateBook(Book *book, uint8_t depth, char* filename);
void advanceInBook(Book *book, Move move); // Advances the book with the move, by changing the current node, and returns the book status
void getNextMove(Book *book, Move *move); // Selects a move from the move list, the current node is also changed and status is returned
void freeBook(Book *book);
#endif