Documentation
¶
Overview ¶
Package opening implements chess opening determination and exploration.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Opening ¶
type Opening struct {
// contains filtered or unexported fields
}
A Opening represents a specific sequence of moves from the staring position.
func Find ¶
Find returns the most specific opening for the list of moves. If no opening is found, Find returns nil.
Example ¶
package main
import (
"fmt"
"github.com/notnil/chess"
"github.com/notnil/opening"
)
func main() {
g := chess.NewGame()
g.MoveStr("e4")
g.MoveStr("e6")
// print French Defense
o := opening.Find(g.Moves())
fmt.Println(o.Title())
}
Output:
func Possible ¶
Possible returns the possible openings after the moves given. If moves is empty or nil all openings are returned.
Example ¶
package main
import (
"fmt"
"github.com/notnil/chess"
"github.com/notnil/opening"
)
func main() {
g := chess.NewGame()
g.MoveStr("e4")
g.MoveStr("d5")
// print all variantions of the Scandinavian Defense
for _, o := range opening.Possible(g.Moves()) {
fmt.Println(o.Title())
}
}
Output:

