Documentation ¶
Index ¶
- Constants
- Variables
- func LoadNetwork(path string) error
- func Pack(hashmove Move, eval int16, depth int8, nodeType NodeType, age uint16) uint64
- func ReLu(x float32) float32
- func RoundPowerOfTwo(size int) int
- func Unpack(data uint64) (hashmove Move, eval int16, depth int8, nodeType NodeType, age uint16)
- type Bitboard
- func (b *Bitboard) AllPieces() map[Square]Piece
- func (b *Bitboard) Bishops() uint64
- func (b *Bitboard) Clear(square Square, piece Piece)
- func (b *Bitboard) Draw() string
- func (b *Bitboard) Fen() string
- func (b *Bitboard) GetBitboardOf(piece Piece) uint64
- func (b *Bitboard) GetBlackPieces() uint64
- func (b *Bitboard) GetWhitePieces() uint64
- func (b *Bitboard) HasThreats(color Color) bool
- func (b *Bitboard) IsEndGame(turn Color) bool
- func (b *Bitboard) Kings() uint64
- func (b *Bitboard) Knights() uint64
- func (b *Bitboard) Move(src Square, dest Square, sourcePiece Piece, destinationPiece Piece)
- func (b *Bitboard) Pawns() uint64
- func (b *Bitboard) PieceAt(sq Square) Piece
- func (b *Bitboard) Queens() uint64
- func (b *Bitboard) Rooks() uint64
- func (b *Bitboard) SeeGe(toSq Square, target Piece, frSq Square, aPiece Piece, bound int16) int16
- func (b *Bitboard) StaticExchangeEval(toSq Square, target Piece, frSq Square, aPiece Piece) int16
- func (b *Bitboard) UpdateSquare(sq Square, newPiece Piece, oldPiece Piece)
- type Cache
- type CachedEval
- type Color
- type Direction
- type File
- type Game
- type Move
- func (m Move) CapturedPiece() Piece
- func (m Move) Destination() Square
- func (m Move) IsCapture() bool
- func (m Move) IsCastle() bool
- func (m Move) IsEnPassant() bool
- func (m Move) IsKingSideCastle() bool
- func (m Move) IsQueenSideCastle() bool
- func (m Move) MovingPiece() Piece
- func (m Move) PromoType() PieceType
- func (m Move) Source() Square
- func (m Move) Tag() MoveTag
- func (m Move) ToString() string
- type MoveList
- type MoveTag
- type NetworkState
- type NodeType
- type Piece
- type PieceType
- type Position
- func (p *Position) ClearTag(tag PositionTag)
- func (p *Position) Copy() *Position
- func (p *Position) Evaluate() int16
- func (p *Position) Fen() string
- func (p *Position) GameMakeMove(move Move) (Square, PositionTag, uint8, bool)
- func (p *Position) GameUnMakeMove(move Move, tag PositionTag, enPassant Square, halfClock uint8)
- func (p *Position) GetCaptureMoves(ml *MoveList)
- func (p *Position) GetQuietMoves(ml *MoveList)
- func (p *Position) HasCastling() bool
- func (p *Position) HasTag(tag PositionTag) bool
- func (p *Position) Hash() uint64
- func (p *Position) IsDraw() bool
- func (p *Position) IsEndGame() bool
- func (p *Position) IsFIDEDrawRule() bool
- func (p *Position) IsInCheck() bool
- func (p *Position) IsPseudoLegal(move Move) bool
- func (p *Position) MakeMove(move Move) (Square, PositionTag, uint8, bool)
- func (p *Position) MakeNullMove() Square
- func (p *Position) MoveToPGN(move Move) string
- func (p *Position) NetInput() []int16
- func (p *Position) ParseSearchMoves(moveStr []string) []Move
- func (p *Position) PseudoLegalMoves() []Move
- func (p *Position) SetTag(tag PositionTag)
- func (p *Position) ToggleTag(tag PositionTag)
- func (p *Position) ToggleTurn()
- func (p *Position) Turn() Color
- func (p *Position) UnMakeMove(move Move, tag PositionTag, enPassant Square, halfClock uint8)
- func (p *Position) UnMakeNullMove(ep Square)
- type PositionTag
- type Rank
- type Square
- type Status
- type Updates
Constants ¶
View Source
const AGE_MASK uint64 = 0b1111111111 // age << 54, 10 bits
View Source
const Add int8 = 1
View Source
const CASTLING_FLAG = WhiteCanCastleQueenSide | WhiteCanCastleKingSide | BlackCanCastleQueenSide | BlackCanCastleKingSide
View Source
const CHECKMATE_EVAL int16 = 30000
View Source
const DEFAULT_CACHE_SIZE = 128
View Source
const DEPTH_MASK uint64 = 0b1111111 // depth << 44, 7 bits
View Source
const DarkSquares uint64 = 0xAA55AA55AA55AA55
View Source
const EVAL_MASK uint64 = 0b1111111111111111 // eval << 28, 16 bits
View Source
const EmptyMove = Move(0)
View Source
const MAX_CACHE_SIZE = 120_000
View Source
const MAX_INT = int16(32767)
View Source
const MAX_NON_CHECKMATE float32 = 25000
View Source
const MIN_NON_CHECKMATE float32 = -MAX_NON_CHECKMATE
View Source
const MOVE_MASK uint64 = 0b1111111111111111111111111111 // move << 0, 28 bits
View Source
const MaximumDepth = 128
View Source
const NetInputSize = 769
View Source
const NetLayers = 1
View Source
const NetOutputSize = 1
View Source
const OldAge = uint16(5)
View Source
const Remove int8 = -1
View Source
const TYPE_MASK uint64 = 0b111 // type << 51, 3 bits
Variables ¶
View Source
var CACHE_ENTRY_SIZE = int(unsafe.Sizeof(CachedEval{}))
View Source
var CurrentHiddenBiases []float32
View Source
var CurrentHiddenWeights []float32
View Source
var CurrentNetworkId uint32
View Source
var CurrentOutputBias float32
View Source
var CurrentOutputWeights []float32
View Source
var DefaultHiddenBiases []float32
View Source
var DefaultHiddenWeights []float32
View Source
var DefaultNetHiddenSize int
View Source
var DefaultNetworkId uint32
View Source
var DefaultOutputBias float32
View Source
var DefaultOutputWeights []float32
View Source
var NameToSquareMap = map[string]Square{ "a1": A1, "a2": A2, "a3": A3, "a4": A4, "a5": A5, "a6": A6, "a7": A7, "a8": A8, "b1": B1, "b2": B2, "b3": B3, "b4": B4, "b5": B5, "b6": B6, "b7": B7, "b8": B8, "c1": C1, "c2": C2, "c3": C3, "c4": C4, "c5": C5, "c6": C6, "c7": C7, "c8": C8, "d1": D1, "d2": D2, "d3": D3, "d4": D4, "d5": D5, "d6": D6, "d7": D7, "d8": D8, "e1": E1, "e2": E2, "e3": E3, "e4": E4, "e5": E5, "e6": E6, "e7": E7, "e8": E8, "f1": F1, "f2": F2, "f3": F3, "f4": F4, "f5": F5, "f6": F6, "f7": F7, "f8": F8, "g1": G1, "g2": G2, "g3": G3, "g4": G4, "g5": G5, "g6": G6, "g7": G7, "g8": G8, "h1": H1, "h2": H2, "h3": H3, "h4": H4, "h5": H5, "h6": H6, "h7": H7, "h8": H8, }
View Source
var NetHiddenSize = 128
View Source
var Skills1HiddenBiases []float32
View Source
var Skills1HiddenWeights []float32
View Source
var Skills1NetHiddenSize int
View Source
var Skills1NetworkId uint32
View Source
var Skills1OutputBias float32
View Source
var Skills1OutputWeights []float32
View Source
var Skills2HiddenBiases []float32
View Source
var Skills2HiddenWeights []float32
View Source
var Skills2NetHiddenSize int
View Source
var Skills2NetworkId uint32
View Source
var Skills2OutputBias float32
View Source
var Skills2OutputWeights []float32
View Source
var Skills3HiddenBiases []float32
View Source
var Skills3HiddenWeights []float32
View Source
var Skills3NetHiddenSize int
View Source
var Skills3NetworkId uint32
View Source
var Skills3OutputBias float32
View Source
var Skills3OutputWeights []float32
View Source
var Skills4HiddenBiases []float32
View Source
var Skills4HiddenWeights []float32
View Source
var Skills4NetHiddenSize int
View Source
var Skills4NetworkId uint32
View Source
var Skills4OutputBias float32
View Source
var Skills4OutputWeights []float32
View Source
var Skills5HiddenBiases []float32
View Source
var Skills5HiddenWeights []float32
View Source
var Skills5NetHiddenSize int
View Source
var Skills5NetworkId uint32
View Source
var Skills5OutputBias float32
View Source
var Skills5OutputWeights []float32
View Source
var Skills6HiddenBiases []float32
View Source
var Skills6HiddenWeights []float32
View Source
var Skills6NetHiddenSize int
View Source
var Skills6NetworkId uint32
View Source
var Skills6OutputBias float32
View Source
var Skills6OutputWeights []float32
View Source
var SquareMask = initSquareMask()
View Source
var TranspositionTable = NewCache(DEFAULT_CACHE_SIZE)
Functions ¶
func RoundPowerOfTwo ¶
Types ¶
type Bitboard ¶
type Bitboard struct {
// contains filtered or unexported fields
}
func StartingBoard ¶
func StartingBoard() Bitboard
func (*Bitboard) GetBitboardOf ¶
func (*Bitboard) GetBlackPieces ¶
func (*Bitboard) GetWhitePieces ¶
func (*Bitboard) HasThreats ¶
func (*Bitboard) StaticExchangeEval ¶
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
func (*Cache) AdvanceAge ¶
func (c *Cache) AdvanceAge()
type CachedEval ¶
func (*CachedEval) Update ¶
func (c *CachedEval) Update(key uint64, data uint64)
type Game ¶
type Game struct {
// contains filtered or unexported fields
}
func (*Game) ParseGameMoves ¶
type Move ¶
type Move uint32
func (Move) CapturedPiece ¶
func (Move) Destination ¶
func (Move) IsEnPassant ¶
func (Move) IsKingSideCastle ¶
func (Move) IsQueenSideCastle ¶
func (Move) MovingPiece ¶
type MoveList ¶
func NewMoveList ¶
type MoveTag ¶
type MoveTag uint8
const ( // KingSideCastle indicates that the move is a king side castle. KingSideCastle MoveTag = 1 << iota // QueenSideCastle indicates that the move is a queen side castle. QueenSideCastle // Capture indicates that the move captures a piece. Capture // EnPassant indicates that the move captures via en passant. EnPassant )
type NetworkState ¶
type NetworkState struct { HiddenOutputs [][]float32 EmptyHiddenOutput []float32 CurrentHidden int HiddenWeights []float32 HiddenBiases []float32 OutputWeights []float32 OutputBias float32 }
func NewNetworkState ¶
func NewNetworkState() NetworkState
func (*NetworkState) QuickFeed ¶
func (n *NetworkState) QuickFeed() float32
func (*NetworkState) Recalculate ¶
func (n *NetworkState) Recalculate(input []int16)
func (*NetworkState) RevertHidden ¶
func (n *NetworkState) RevertHidden()
func (*NetworkState) UpdateHidden ¶
func (n *NetworkState) UpdateHidden(updates *Updates)
type Position ¶
type Position struct { Board Bitboard Net NetworkState Updates Updates EnPassant Square Tag PositionTag Positions map[uint64]int HalfMoveClock uint8 // contains filtered or unexported fields }
func (*Position) ClearTag ¶
func (p *Position) ClearTag(tag PositionTag)
func (*Position) GameMakeMove ¶
func (*Position) GameUnMakeMove ¶
func (p *Position) GameUnMakeMove(move Move, tag PositionTag, enPassant Square, halfClock uint8)
func (*Position) GetCaptureMoves ¶
func (*Position) GetQuietMoves ¶
func (*Position) HasCastling ¶
func (*Position) HasTag ¶
func (p *Position) HasTag(tag PositionTag) bool
func (*Position) IsFIDEDrawRule ¶
func (*Position) IsPseudoLegal ¶
func (*Position) MakeNullMove ¶
func (*Position) ParseSearchMoves ¶
func (*Position) PseudoLegalMoves ¶
func (*Position) SetTag ¶
func (p *Position) SetTag(tag PositionTag)
func (*Position) ToggleTag ¶
func (p *Position) ToggleTag(tag PositionTag)
func (*Position) ToggleTurn ¶
func (p *Position) ToggleTurn()
func (*Position) UnMakeMove ¶
func (p *Position) UnMakeMove(move Move, tag PositionTag, enPassant Square, halfClock uint8)
func (*Position) UnMakeNullMove ¶
type PositionTag ¶
type PositionTag uint8
const ( WhiteCanCastleKingSide PositionTag = 1 << iota WhiteCanCastleQueenSide BlackCanCastleKingSide BlackCanCastleQueenSide InCheck BlackToMove WhiteToMove )
Click to show internal directories.
Click to hide internal directories.