Documentation
¶
Index ¶
- Constants
- Variables
- func IsDoubled(b *board.Board, sq board.Square, side int) bool
- func IsIsolated(b *board.Board, sq board.Square, side int) bool
- func IsPassed(b *board.Board, sq board.Square, side int) bool
- func IsProtected(b *board.Board, sq board.Square, side int) bool
- type Clock
- type EntryData
- func (ed EntryData) Age() int8
- func (ed EntryData) Depth() int8
- func (ed EntryData) Get() (board.Move, int8, EntryType, int16)
- func (ed EntryData) GetScore(depth, ply int8, alpha, beta int16) (int16, bool)
- func (ed EntryData) Move() board.Move
- func (ed EntryData) Score() int16
- func (ed EntryData) Type() EntryType
- type EntryType
- type EvalEngine
- func (e *EvalEngine) AddKillerMove(ply int8, move board.Move)
- func (e *EvalEngine) AddPly()
- func (e *EvalEngine) AgeHistory()
- func (e *EvalEngine) ConvertEvalToScore(eval int16) string
- func (e *EvalEngine) DecrementHistory(move board.Move)
- func (e *EvalEngine) GetEvaluation(b *board.Board) int
- func (e *EvalEngine) GetHistory(move board.Move) int
- func (e *EvalEngine) GetMove(ctx context.Context, depth int, infinite bool) (board.Move, board.Move)
- func (e *EvalEngine) GetMoveSelector(hashMove board.Move, moves, pvOrder []board.Move, ply int8) MoveSelector
- func (e *EvalEngine) GetMoveSelectorQ(moves []board.Move) MoveSelector
- func (e *EvalEngine) IDSearch(ctx context.Context, depth int, infinite bool) (board.Move, board.Move, bool)
- func (e *EvalEngine) IncrementHistory(depth int8, move board.Move)
- func (e *EvalEngine) IsDrawByRepetition() bool
- func (e *EvalEngine) MvvLva(move board.Move) int
- func (e *EvalEngine) PVS(ctx context.Context, pvOrder []board.Move, line *[]board.Move, depth, ply int8, ...) int16
- func (e *EvalEngine) PlayMovesUCI(uciMoves string) bool
- func (e *EvalEngine) RemovePly()
- func (e *EvalEngine) ReportMove(move, ponder board.Move, allowPonder bool)
- type EvalStats
- type HistoryHeuristic
- type MoveSelector
- type PickBookMove
- type SearchEntry
- type TTable
Constants ¶
const ( // Mate score to be adjusted by the ply that it is found on by subtracting the ply to favor shorter mates. CheckmateScore int16 = 8192 // ply adjusted adjusted mates scores should not exceed this value and anything above this should be considered a mate instead of normal eval. CheckmateThreshold = CheckmateScore - 1024 Inf = 2 * CheckmateScore )
Variables ¶
var PST = [2][2][6][64]int{
{{pawnPST, bishopPST, knightPST, rookPST, queenPST, kingPST}},
{{pawnEGPST, bishopEGPST, knightEGPST, rookEGPST, queenEGPST, kingEGPST}},
}
var PiecePawnBonus = [6][9]int{
{},
{},
{-25, -19, -13, -6, 0, 6, 13, 19, 25},
{50, 37, 25, 12, 0, -12, -25, -37, -50},
{},
{},
}
Based on L. Kaufman - rook and knight values are adjusted by the number of pawns on the board.
var PieceWeights = [6]int{100, 325, 325, 500, 975, 10000}
Functions ¶
func IsIsolated ¶
Has no friendly pawns on neighboring files.
Types ¶
type Clock ¶
type Clock struct { Wtime int Btime int Winc int Binc int Overhead int Movetime int Movestogo int Infinite bool }
func (*Clock) GetContext ¶
type EntryData ¶ added in v1.1.0
type EntryData uint64
LSB 0..31 move, 32..38 depth 39..40 type 41..47 age 48..63 score MSB.
type EvalEngine ¶
type EvalEngine struct { Board *board.Board TTable *TTable WG sync.WaitGroup Stats EvalStats Ponder bool OwnBook bool MateFound bool KillerMoves [100][2]board.Move History HistoryHeuristic Ply int Plys [512]uint64 SearchDepth int Clock Clock Stop context.CancelFunc }
func NewEvalEngine ¶
func NewEvalEngine() *EvalEngine
func (*EvalEngine) AddKillerMove ¶
func (e *EvalEngine) AddKillerMove(ply int8, move board.Move)
func (*EvalEngine) AddPly ¶ added in v1.1.0
func (e *EvalEngine) AddPly()
func (*EvalEngine) AgeHistory ¶ added in v1.1.0
func (e *EvalEngine) AgeHistory()
func (*EvalEngine) ConvertEvalToScore ¶
func (e *EvalEngine) ConvertEvalToScore(eval int16) string
Display centipawn score. If the eval is in the checkmate score threshold convert to mate score.
func (*EvalEngine) DecrementHistory ¶
func (e *EvalEngine) DecrementHistory(move board.Move)
func (*EvalEngine) GetEvaluation ¶
func (e *EvalEngine) GetEvaluation(b *board.Board) int
func (*EvalEngine) GetHistory ¶ added in v1.1.0
func (e *EvalEngine) GetHistory(move board.Move) int
func (*EvalEngine) GetMove ¶
func (e *EvalEngine) GetMove(ctx context.Context, depth int, infinite bool) (board.Move, board.Move)
Returns the best move and best opponent response - ponder.
func (*EvalEngine) GetMoveSelector ¶ added in v1.1.0
func (e *EvalEngine) GetMoveSelector(hashMove board.Move, moves, pvOrder []board.Move, ply int8) MoveSelector
Move ordering 1. PV 2. hash move 3. Captures orderd by MVVLVA, 4. killer moves 5. History Heuristic.
func (*EvalEngine) GetMoveSelectorQ ¶ added in v1.1.0
func (e *EvalEngine) GetMoveSelectorQ(moves []board.Move) MoveSelector
func (*EvalEngine) IDSearch ¶
func (e *EvalEngine) IDSearch(ctx context.Context, depth int, infinite bool) (board.Move, board.Move, bool)
Iterative deepening search. Returns best move, ponder and ok if search succeeded.
func (*EvalEngine) IncrementHistory ¶
func (e *EvalEngine) IncrementHistory(depth int8, move board.Move)
func (*EvalEngine) IsDrawByRepetition ¶
func (e *EvalEngine) IsDrawByRepetition() bool
IsDrawByRepetition checks if the current position has been seen before.
func (*EvalEngine) MvvLva ¶ added in v1.1.0
func (e *EvalEngine) MvvLva(move board.Move) int
Estimate the potential strength of the move for move ordering.
func (*EvalEngine) PlayMovesUCI ¶
func (e *EvalEngine) PlayMovesUCI(uciMoves string) bool
PlayMovesUCI plays a list of moves in UCI format and updates game history.
func (*EvalEngine) RemovePly ¶ added in v1.1.0
func (e *EvalEngine) RemovePly()
func (*EvalEngine) ReportMove ¶
func (e *EvalEngine) ReportMove(move, ponder board.Move, allowPonder bool)
type HistoryHeuristic ¶ added in v1.1.0
type HistoryHeuristic [2][64][64]int
type MoveSelector ¶ added in v1.3.0
type SearchEntry ¶
type SearchEntry struct {
// contains filtered or unexported fields
}