polyglot

package
v0.0.0-...-a3cfd58 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 3, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package polyglot reads and provides an interface to polyglot opening book files (.bin) and provides an interface to.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Book

type Book struct {
	// contains filtered or unexported fields
}

Book holds the opening book data.

func New

func New() *Book

New returns a new empty Book.

func (*Book) Bounds

func (b *Book) Bounds() (min, max int)

Bounds returns the mix and max values of all weights.

func (*Book) Init

func (b *Book) Init(reader io.Reader) error

Init takes a reader to binary data from Polyglot files (.bin) and initializes it. It may be called several times with data from different books and data will be merged. Weights will be returned as is so it is up to the user to ensures they are consistent across books.

func (*Book) Lookup

func (b *Book) Lookup(position *chess.Position) []WeightedMove

Lookup takes a position and returns a sorted list of weighted moves. If the position is not found, nil is returned.

type WeightedMove

type WeightedMove struct {
	Move   *chess.Move
	Weight int
}

WeightedMove is a single weight move. The weight is positive but no bounds are enforced.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL