README
¶
opening
opening provides interactivity to opening books such as Encyclopaedia of Chess Openings (ECO) which is loadable from the package. Source: https://github.com/lichess-org/chess-openings
Visual
Advance Variation subtree of the French Defense:
Example
package main
import (
"fmt"
"github.com/cubuzz/chess"
"github.com/cubuzz/chess/opening"
)
func main(){
g := chess.NewGame()
g.MoveStr("e4")
g.MoveStr("e6")
// print French Defense
book := opening.NewBookECO()
o := book.Find(g.Moves())
fmt.Println(o.Title())
}
Documentation
¶
Overview ¶
Package opening implements chess opening determination and exploration.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Book ¶
type Book interface { // Find returns the most specific opening for the list of moves. If no opening is found, Find returns nil. Find(moves []*chess.Move) *Opening // Possible returns the possible openings after the moves given. If moves is empty or nil all openings are returned. Possible(moves []*chess.Move) []*Opening }
Book is an opening book that returns openings for move sequences
type BookECO ¶
type BookECO struct {
// contains filtered or unexported fields
}
BookECO represents the Encyclopedia of Chess Openings https://en.wikipedia.org/wiki/Encyclopaedia_of_Chess_Openings BookECO is safe for concurrent use.
func NewBookECO ¶
func NewBookECO() *BookECO
NewBookECO returns a new BookECO. This operation has to parse 2k rows of CSV data and insert it into a graph so it can take some time.