Documentation ¶
Overview ¶
Package openingbook The OpeningBook reads game databases of different formats into an internal data structure. It can then be queried for a book move on a certain position.
Supported formats are currently:
BookFormat::SIMPLE for files storing a game per line with from-square and to-square notation
BookFormat::SAN for files with lines of moves in SAN notation
BookFormat::PGN for PGN formatted games<br/>
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( FormatFromString = map[string]BookFormat{ "Simple": Simple, "San": San, "Pgn": Pgn, } )
Functions ¶
This section is empty.
Types ¶
type Book ¶
type Book struct {
// contains filtered or unexported fields
}
Book represents a structure for chess opening books which can be read from different file formats into an internal data structure.
Create new book instance with NewBook()
func (*Book) Initialize ¶
func (b *Book) Initialize(bookPath string, bookFile string, bookFormat BookFormat, useCache bool, recreateCache bool) error
Initialize reads game data from the given file into the internal data structure. A binary cache file will be created in the same folder (postfix .cache) to speedup subsequent loading if the opening book. Initialization only occurs once multiple calls will be ignored. To re-initialize call Reset() first.
func (*Book) NumberOfEntries ¶
NumberOfEntries returns the number of entries in the opening book
type BookEntry ¶
BookEntry represents a data structure for a move in the opening book data structure. It describes exactly one position defined by a zobrist key and has links to other entries representing moves and successor positions.
type BookFormat ¶
type BookFormat uint8
BookFormat represent the supported book formats defined as constants.
const ( Simple BookFormat = iota San BookFormat = iota Pgn BookFormat = iota )
Supported book formats.