|
My Project
|
#include "base.h"#include "board.h"#include "game.h"#include "search.h"#include "util.h"#include <stdbool.h>Go to the source code of this file.
Classes | |
| struct | Book |
| The opening book. More... | |
| struct | GameStats |
| Game statistics. More... | |
| struct | Link |
| a move (with its score) linking to another Position. More... | |
| struct | Position |
| A position stored in the book. More... | |
Macros | |
| #define | FLAG_DONE 1 |
| #define | FLAG_TODO 2 |
| #define | FLAG_BESTPATH_BLACK 4 |
Typedefs | |
| typedef struct Book | Book |
| The opening book. More... | |
| typedef struct GameStats | GameStats |
| Game statistics. More... | |
| typedef struct Link | Link |
| a move (with its score) linking to another Position. More... | |
| typedef struct Position | Position |
| A position stored in the book. More... | |
Functions | |
| void | book_init (Book *) |
| Initialize the opening book. More... | |
| void | book_free (Book *) |
| Free resources used by the opening book. More... | |
| void | book_preprocess (Book *) |
| clean opening book. More... | |
| void | book_stats_clean (Book *) |
| void | book_new (Book *, int, int) |
| Create a new opening book. More... | |
| void | book_load (Book *, const char *) |
| Load the opening book. More... | |
| void | book_save (Book *, const char *) |
| Save an opening book. More... | |
| void | book_import (Book *, const char *) |
| Import an opening book. More... | |
| void | book_export (Book *, const char *) |
| Export an opening book. More... | |
| void | book_merge (Book *, const Book *) |
| Merge two opening books. More... | |
| void | book_sort (Book *book) |
| Sort a book. More... | |
| void | book_negamax (Book *) |
| Negamax a book. More... | |
| void | book_prune (Book *) |
| Prune a book. More... | |
| void | book_deepen (Book *) |
| Deepen a book. More... | |
| void | book_correct_solved (Book *) |
| Correct wrong solved score in the book. More... | |
| void | book_link (Book *) |
| Link a book. More... | |
| void | book_fix (Book *) |
| Fix a book. More... | |
| void | book_fill (Book *book, const int) |
| Fill a book. More... | |
| void | book_deviate (Book *, Board *, const int, const int) |
| Deviate a book. More... | |
| void | book_enhance (Book *, Board *, const int, const int) |
| Enhance a book. More... | |
| void | book_subtree (Book *, const Board *) |
| Prune a book. More... | |
| void | book_play (Book *) |
| Play. More... | |
| void | book_info (Book *) |
| display some book's informations. More... | |
| void | book_show (Book *, Board *) |
| Display a position from the book. More... | |
| void | book_count_bestpath (Book *, Board *, Position *) |
| count the number of best paths in book. More... | |
| void | book_stop_count_bestpath (Book *) |
| Position * | book_show_for_api (Book *, Board *) |
| Display a position from the book. More... | |
| void | book_count_board_bestpath (Book *, Board *, Position *, const int, const int, const int) |
| count the number of "broad" best paths in book. More... | |
| void | book_stats (Book *book) |
| print book statistics. More... | |
| bool | book_get_moves (Book *, const Board *, MoveList *) |
| Get a list of moves from the book. More... | |
| int | book_get_moves_with_position (Book *, const Board *, MoveList *, Position *) |
| Get a list of moves from the book. More... | |
| bool | book_get_random_move (Book *, const Board *, Move *, const int) |
| Get a move at random from the opening book. More... | |
| void | book_get_game_stats (Book *, const Board *, GameStats *) |
| Get game statistics from a position. More... | |
| void | book_get_line (Book *, const Board *, const Move *, Line *) |
| Get a variation from the book. More... | |
| void | book_add_board (Book *, const Board *) |
| Add a position. More... | |
| void | book_add_game (Book *, const Game *) |
| Add positions from a game. More... | |
| void | book_add_base (Book *, const Base *) |
| Add positions from a game database. More... | |
| void | book_check_base (Book *, const Base *) |
| Check positions from a game database. More... | |
| void | book_extract_skeleton (Book *, Base *) |
| Extract book draws to a game base. More... | |
| void | book_extract_positions (Book *, const int, const int) |
| print a set of position. More... | |
| void | book_feed_hash (const Book *, Board *, Search *) |
| feed hash table from the opening book. More... | |
Header file for opening book management
| #define FLAG_BESTPATH_BLACK 4 |
| #define FLAG_DONE 1 |
| #define FLAG_TODO 2 |
Add positions from a game database.
| book | opening book. |
| base | games to add. |
Add a position.
| book | opening book. |
| board | position to add. |
Add positions from a game.
| book | opening book. |
| game | game to add. |
Check positions from a game database.
| book | opening book. |
| base | games to add. |
| void book_correct_solved | ( | Book * | book | ) |
Correct wrong solved score in the book.
Correct erroneous solved positions. Edax may be unstable and introduce bugs from time to time...
| book | opening book. |
count the number of best paths in book.
| book | Opening book. |
| board | Starting position. |
| position | the number of best paths(out parameter) |
| void book_count_board_bestpath | ( | Book * | book, |
| Board * | board, | ||
| Position * | position, | ||
| const int | p_lower, | ||
| const int | o_lower, | ||
| const int | turn | ||
| ) |
count the number of "broad" best paths in book.
| book | Opening book. |
| board | Starting position. |
| position | the number of best paths(out parameter) |
| p_lower | lower limit for player (BESTPATH_BEST:best moves only) |
| o_lower | lower limit for opponent (BESTPATH_BEST:best moves only) |
| turn | turn of the position |
| void book_deepen | ( | Book * | book | ) |
Deepen a book.
Research all non link best move.
| book | opening book. |
| void book_deviate | ( | Book * | book, |
| Board * | board, | ||
| const int | relative_error, | ||
| const int | absolute_error | ||
| ) |
Deviate a book.
| book | opening book. |
| board | Position to start from. |
| relative_error | Error relative to the current position's score. |
| absolute_error | Error relative to the root position's score. |
Enhance a book.
| book | opening book. |
| board | Position to start from. |
| midgame_error | Error in midgame search. |
| endcut_error | Error in endgame search. |
| void book_export | ( | Book * | book, |
| const char * | file | ||
| ) |
Export an opening book.
Save the book in a portable text format.
| book | Opening book. |
| file | File name. |
| void book_extract_positions | ( | Book * | book, |
| const int | n_empties, | ||
| const int | n_positions | ||
| ) |
print a set of position.
| book | Opening book. |
| n_empties | Game stage. |
| n_positions | Number of positions to extract. |
Extract book draws to a game base.
This function supposes that f5d6c4 & f5f6e6f4 are draws and the only draws, excluding the transpositions f5d6c3d3c4 & f5f6e6c6 & c4..., d3..., e6...
| book | Opening book. |
| base | game database. |
feed hash table from the opening book.
| book | Opening book. |
| board | Position to start from. |
| search | HashTables container. |
| void book_fill | ( | Book * | book, |
| const int | depth | ||
| ) |
Fill a book.
| book | opening book. |
| depth | Distance to fill between two positions. |
| void book_fix | ( | Book * | book | ) |
Fix a book.
| book | opening book. |
| void book_free | ( | Book * | book | ) |
Free resources used by the opening book.
| book | Opening book. |
Get a variation from the book.
| book | Opening book. |
| board | Position. |
| move | First move; |
| line | Bariation. |
Get a list of moves from the book.
| book | Opening book. |
| board | Position to display. |
| movelist | List of moves. |
| int book_get_moves_with_position | ( | Book * | book, |
| const Board * | board, | ||
| MoveList * | movelist, | ||
| Position * | position | ||
| ) |
Get a list of moves from the book.
| book | Opening book. |
| board | Position to display. |
| movelist | List of moves. |
| position | position. |
Get a move at random from the opening book.
| book | Opening book. |
| board | Position to find a move from. |
| move | Chosen move. |
| randomness | Randomness. |
| void book_import | ( | Book * | book, |
| const char * | file | ||
| ) |
Import an opening book.
Read the opening book from a portable text format. After the book is imported, it is needed to relink & negamax it.
| book | Opening book. |
| file | File name. |
| void book_info | ( | Book * | book | ) |
display some book's informations.
| book | opening book. |
| void book_init | ( | Book * | book | ) |
Initialize the opening book.
Create an empty opening book.
| book | Opening book. |
| void book_load | ( | Book * | book, |
| const char * | file | ||
| ) |
Load the opening book.
| book | Opening book. |
| file | File name. |
Merge two opening books.
It is needed to relink & negamax the destination book after merging.
| dest | Destination opening book. |
| src | Source opening book. |
| void book_negamax | ( | Book * | book | ) |
Negamax a book.
| book | opening book. |
| void book_new | ( | Book * | book, |
| int | level, | ||
| int | n_empties | ||
| ) |
Create a new opening book.
Create an opening book with the initial position & a single non link move.
| book | Opening book. |
| level | search level to evaluate positions. |
| n_empties | number of empty positions up to which to evaluate positions. |
| void book_play | ( | Book * | book | ) |
Play.
Add positions to the opening book by adding links to position with no links.
| book | opening book. |
| void book_preprocess | ( | Book * | book | ) |
clean opening book.
| book | Opening book. |
| void book_prune | ( | Book * | book | ) |
Prune a book.
Remove positions Edax cannot reach.
| book | opening book. |
| void book_save | ( | Book * | book, |
| const char * | file | ||
| ) |
Save an opening book.
Save the book in a fast binary format.
| book | Opening book. |
| file | File name. |
Display a position from the book.
| book | opening book. |
| board | position to display. |
Display a position from the book.
| book | opening book. |
| board | position to display. |
| void book_sort | ( | Book * | book | ) |
Sort a book.
| book | opening book. |
| void book_stats | ( | Book * | book | ) |
print book statistics.
| book | Opening book. |
| void book_stats_clean | ( | Book * | book | ) |
| void book_stop_count_bestpath | ( | Book * | book | ) |