Documentation
¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Divide ¶
Divide returns a map from legal moves to Perft node counts at a decremented depth.
Divide returns nil if depth is not positive.
Example ¶
var ( p = core.NewPosition() m = pcn.MustDecode("e2e4") ) // How many leaf nodes at depth 3 start with e2e4? fmt.Println("e2e4:", Divide(p, 3)[m]) // After e2e4, how many leaf nodes are at depth 2? p.Make(m) fmt.Println("e2e4:", Perft(p, 2))
Output: e2e4: 600 e2e4: 600
func LegalMoves ¶
LegalMoves returns all legal moves in a position.
func Perft ¶
Perft returns the number of leaf nodes at the selected depth in a position's move tree.
Perft returns zero if depth is negative.
Example ¶
p := core.NewPosition() // Count the number of leaf nodes at each depth in the move tree. for i := range 4 { fmt.Printf("Perft(%d) = %d\n", i, Perft(p, i)) }
Output: Perft(0) = 1 Perft(1) = 20 Perft(2) = 400 Perft(3) = 8902
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.