Documentation ¶
Index ¶
- type Bitboard
- func (b Bitboard) DepositBits(x uint64) Bitboard
- func (b Bitboard) GetFirst() Coord
- func (b Bitboard) Has(c Coord) bool
- func (b Bitboard) Has2(f File, r Rank) bool
- func (b Bitboard) IsEmpty() bool
- func (b Bitboard) Len() int
- func (b *Bitboard) Next() Coord
- func (b *Bitboard) Set(c Coord)
- func (b Bitboard) String() string
- func (b *Bitboard) Unset(c Coord)
- func (b Bitboard) With(c Coord) Bitboard
- func (b Bitboard) With2(f File, r Rank) Bitboard
- func (b Bitboard) Without(c Coord) Bitboard
- func (b Bitboard) Without2(f File, r Rank) Bitboard
- type Board
- func (b *Board) BbCell(c Cell) Bitboard
- func (b *Board) BbColor(c Color) Bitboard
- func (b *Board) BbPiece(c Color, p Piece) Bitboard
- func (b *Board) CalcOutcome() Outcome
- func (b *Board) Castling() CastlingRights
- func (b *Board) CellAttackers(coord Coord, c Color) Bitboard
- func (b *Board) Checkers() Bitboard
- func (b *Board) Clone() *Board
- func (b *Board) EpDest() MaybeCoord
- func (b *Board) EpSource() MaybeCoord
- func (b *Board) Eq(o *Board) bool
- func (b *Board) FEN() string
- func (b *Board) GenLegalMoves(preset MoveGenPreset, res []Move) []Move
- func (b *Board) GenSemilegalMoves(preset MoveGenPreset, res []Move) []Move
- func (b *Board) Get(c Coord) Cell
- func (b *Board) Get2(f File, r Rank) Cell
- func (b *Board) HasLegalMoves() bool
- func (b *Board) IsCellAttacked(coord Coord, c Color) bool
- func (b *Board) IsCheck() bool
- func (b *Board) IsInsufficientMaterial() bool
- func (b *Board) KingPos(c Color) Coord
- func (b *Board) MakeLegalMove(mv Move) Undo
- func (b *Board) MakeMove(mv Move) (Undo, error)
- func (b *Board) MakeMoveSAN(s string) (Undo, error)
- func (b *Board) MakeMoveUCI(s string) (Undo, error)
- func (b *Board) MakeSemilegalMove(mv Move) (Undo, bool)
- func (b *Board) MakeUCIMove(um UCIMove) (Undo, error)
- func (b *Board) MarshalJSON() ([]byte, error)
- func (b *Board) MoveCounter() uint8
- func (b *Board) MoveNumber() uint32
- func (b *Board) Pretty(style PrettyStyle) string
- func (b *Board) Raw() RawBoard
- func (b *Board) Side() Color
- func (b *Board) String() string
- func (b *Board) UnmakeMove(u Undo)
- func (b *Board) UnmarshalJSON(data []byte) error
- func (b *Board) ZHash() ZHash
- type CastlingRights
- func (r CastlingRights) Has(c Color, s CastlingSide) bool
- func (r CastlingRights) HasColor(c Color) bool
- func (r CastlingRights) IsValid() bool
- func (r CastlingRights) MarshalJSON() ([]byte, error)
- func (r *CastlingRights) Set(c Color, s CastlingSide)
- func (r CastlingRights) String() string
- func (r *CastlingRights) UnmarshalJSON(data []byte) error
- func (r *CastlingRights) Unset(c Color, s CastlingSide)
- func (r *CastlingRights) UnsetColor(c Color)
- func (r CastlingRights) With(c Color, s CastlingSide) CastlingRights
- func (r CastlingRights) Without(c Color, s CastlingSide) CastlingRights
- type CastlingSide
- type Cell
- func (c Cell) Color() (Color, bool)
- func (c Cell) HasColor(co Color) bool
- func (c Cell) IsFree() bool
- func (c Cell) IsOccupied() bool
- func (c Cell) IsValid() bool
- func (c Cell) MarshalJSON() ([]byte, error)
- func (c Cell) Piece() (Piece, bool)
- func (c Cell) String() string
- func (c Cell) ToByte() byte
- func (c Cell) ToRune() rune
- func (c *Cell) UnmarshalJSON(data []byte) error
- type Color
- type Coord
- func (c Coord) Add(delta int8) Coord
- func (c Coord) Antidiag() int
- func (c Coord) Diag() int
- func (c Coord) File() File
- func (c Coord) IsValid() bool
- func (c Coord) MarshalJSON() ([]byte, error)
- func (c Coord) Rank() Rank
- func (c Coord) Shift(d CoordDelta) MaybeCoord
- func (c Coord) String() string
- func (c *Coord) UnmarshalJSON(data []byte) error
- type CoordDelta
- type File
- type Game
- func (g *Game) CalcOutcome() Outcome
- func (g *Game) ClearOutcome()
- func (g *Game) Clone() *Game
- func (g *Game) CurBoard() *Board
- func (g *Game) CurPos() RawBoard
- func (g *Game) Eq(o *Game) bool
- func (g *Game) IsEmpty() bool
- func (g *Game) IsFinished() bool
- func (g *Game) Len() int
- func (g *Game) MoveAt(index int) Move
- func (g *Game) Outcome() Outcome
- func (g *Game) Pop() (Move, bool)
- func (g *Game) PushLegalMove(mv Move)
- func (g *Game) PushMove(mv Move) error
- func (g *Game) PushMoveSAN(s string) error
- func (g *Game) PushMoveUCI(s string) error
- func (g *Game) PushSemilegalMove(mv Move) bool
- func (g *Game) PushUCIList(ucis string) (int, error)
- func (g *Game) PushUCIMove(um UCIMove) error
- func (g *Game) SetAutoOutcome(filter VerdictFilter) Outcome
- func (g *Game) SetOutcome(o Outcome)
- func (g *Game) StartPos() RawBoard
- func (g *Game) Styled(style GameStyle) (string, error)
- func (g *Game) StyledExt(style GameStyle, ga GameAnnotations) (string, error)
- func (g *Game) UCIList() string
- func (g *Game) Walk() Walker
- type GameAnnotations
- type GameOutcomeStyle
- type GameStyle
- type MaybeCoord
- func (c MaybeCoord) ForceGet() Coord
- func (c MaybeCoord) IsNone() bool
- func (c MaybeCoord) IsSome() bool
- func (c MaybeCoord) IsValid() bool
- func (c MaybeCoord) MarshalJSON() ([]byte, error)
- func (c MaybeCoord) String() string
- func (c MaybeCoord) TryGet() (Coord, bool)
- func (c *MaybeCoord) UnmarshalJSON(data []byte) error
- type Move
- func LegalMoveFromSAN(s string, b *Board) (Move, error)
- func LegalMoveFromUCI(s string, b *Board) (Move, error)
- func LegalMoveFromUCIMove(u UCIMove, b *Board) (Move, error)
- func MoveFromCastling(c Color, s CastlingSide) Move
- func MoveFromUCI(s string, b *Board) (Move, error)
- func MoveFromUCIMove(u UCIMove, b *Board) (Move, error)
- func NewMove(kind MoveKind, srcCell Cell, src, dst Coord) (Move, error)
- func NewMoveUnchecked(kind MoveKind, srcCell Cell, src, dst Coord) Move
- func NullMove() Move
- func SemilegalMoveFromUCI(s string, b *Board) (Move, error)
- func SemilegalMoveFromUCIMove(u UCIMove, b *Board) (Move, error)
- func (m Move) Dst() Coord
- func (m Move) IsLegalWhenSemilegal(b *Board) bool
- func (m Move) IsWellFormed() bool
- func (m Move) Kind() MoveKind
- func (m Move) SemiValidate(b *Board) error
- func (m Move) Src() Coord
- func (m Move) SrcCell() Cell
- func (m Move) String() string
- func (m Move) Styled(b *Board, style MoveStyle) (string, error)
- func (m Move) UCI() string
- func (m Move) UCIMove() UCIMove
- func (m Move) Validate(b *Board) error
- type MoveGenPreset
- type MoveKind
- type MoveNumberStyle
- type MoveStyle
- type Outcome
- type Piece
- type PrettyStyle
- type Rank
- type RawBoard
- func (b *RawBoard) EpDest() MaybeCoord
- func (b RawBoard) FEN() string
- func (b *RawBoard) Get(c Coord) Cell
- func (b *RawBoard) Get2(f File, r Rank) Cell
- func (b RawBoard) MarshalJSON() ([]byte, error)
- func (b *RawBoard) Pretty(style PrettyStyle) string
- func (b *RawBoard) Put(c Coord, ce Cell)
- func (b *RawBoard) Put2(f File, r Rank, ce Cell)
- func (b RawBoard) String() string
- func (b *RawBoard) UnmarshalJSON(data []byte) error
- func (b *RawBoard) ZHash() ZHash
- type RepeatTable
- type Status
- type UCIMove
- func (m UCIMove) Dst() Coord
- func (m UCIMove) Kind() UCIMoveKind
- func (m UCIMove) MarshalJSON() ([]byte, error)
- func (m UCIMove) Promote() (Piece, bool)
- func (m UCIMove) Src() Coord
- func (m UCIMove) String() string
- func (m UCIMove) ToMove(b *Board) (Move, error)
- func (m *UCIMove) UnmarshalJSON(data []byte) error
- type UCIMoveKind
- type Undo
- type Verdict
- type VerdictFilter
- type VerdictKind
- type Walker
- type ZHash
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Bitboard ¶
type Bitboard uint64
func BbAntidiag ¶
func BitboardFromCoord ¶
func (Bitboard) DepositBits ¶
type Board ¶
type Board struct {
// contains filtered or unexported fields
}
func BoardFromFEN ¶
func InitialBoard ¶
func InitialBoard() *Board
func (*Board) CalcOutcome ¶
func (*Board) Castling ¶
func (b *Board) Castling() CastlingRights
func (*Board) EpDest ¶
func (b *Board) EpDest() MaybeCoord
func (*Board) EpSource ¶
func (b *Board) EpSource() MaybeCoord
func (*Board) GenLegalMoves ¶
func (b *Board) GenLegalMoves(preset MoveGenPreset, res []Move) []Move
func (*Board) GenSemilegalMoves ¶
func (b *Board) GenSemilegalMoves(preset MoveGenPreset, res []Move) []Move
func (*Board) HasLegalMoves ¶
func (*Board) IsInsufficientMaterial ¶
func (*Board) MakeLegalMove ¶
func (*Board) MarshalJSON ¶ added in v0.9.1
func (*Board) MoveCounter ¶
func (*Board) MoveNumber ¶
func (*Board) Pretty ¶
func (b *Board) Pretty(style PrettyStyle) string
func (*Board) UnmakeMove ¶
func (*Board) UnmarshalJSON ¶ added in v0.9.1
type CastlingRights ¶
type CastlingRights uint8
const ( CastlingRightsEmpty CastlingRights = 0 CastlingRightsFull CastlingRights = 15 CastlingRightsMax CastlingRights = CastlingRightsFull + 1 )
func CastlingRightsFromString ¶
func CastlingRightsFromString(s string) (CastlingRights, error)
func (CastlingRights) Has ¶
func (r CastlingRights) Has(c Color, s CastlingSide) bool
func (CastlingRights) HasColor ¶
func (r CastlingRights) HasColor(c Color) bool
func (CastlingRights) IsValid ¶
func (r CastlingRights) IsValid() bool
func (CastlingRights) MarshalJSON ¶ added in v0.9.1
func (r CastlingRights) MarshalJSON() ([]byte, error)
func (*CastlingRights) Set ¶
func (r *CastlingRights) Set(c Color, s CastlingSide)
func (CastlingRights) String ¶
func (r CastlingRights) String() string
func (*CastlingRights) UnmarshalJSON ¶ added in v0.9.1
func (r *CastlingRights) UnmarshalJSON(data []byte) error
func (*CastlingRights) Unset ¶
func (r *CastlingRights) Unset(c Color, s CastlingSide)
func (*CastlingRights) UnsetColor ¶
func (r *CastlingRights) UnsetColor(c Color)
func (CastlingRights) With ¶
func (r CastlingRights) With(c Color, s CastlingSide) CastlingRights
func (CastlingRights) Without ¶
func (r CastlingRights) Without(c Color, s CastlingSide) CastlingRights
type CastlingSide ¶
type CastlingSide uint8
const ( CastlingQueenside CastlingSide = iota CastlingKingside CastlingSideMax )
func (CastlingSide) IsValid ¶
func (s CastlingSide) IsValid() bool
type Cell ¶
type Cell uint8
func CellFromByte ¶
func CellFromParts ¶
func CellFromString ¶
func (Cell) IsOccupied ¶
func (Cell) MarshalJSON ¶ added in v0.9.1
func (*Cell) UnmarshalJSON ¶ added in v0.9.1
type Color ¶
type Color uint8
func ColorFromByte ¶
func ColorFromString ¶
func (Color) LongString ¶
func (Color) MarshalJSON ¶ added in v0.9.1
func (*Color) UnmarshalJSON ¶ added in v0.9.1
type Coord ¶
type Coord uint8
const CoordMax Coord = 64
func CoordFromParts ¶
func CoordFromString ¶
func (Coord) MarshalJSON ¶ added in v0.9.1
func (Coord) Shift ¶
func (c Coord) Shift(d CoordDelta) MaybeCoord
func (*Coord) UnmarshalJSON ¶ added in v0.9.1
type CoordDelta ¶
type Game ¶
type Game struct {
// contains filtered or unexported fields
}
func NewGameWithFEN ¶
func NewGameWithPosition ¶
func (*Game) CalcOutcome ¶
func (*Game) ClearOutcome ¶
func (g *Game) ClearOutcome()
func (*Game) CurBoard ¶
The board updates automatically after calls to Push...() or Pop().
Do not mutate the returned board.
func (*Game) IsFinished ¶
func (*Game) PushLegalMove ¶
func (*Game) PushMoveSAN ¶
func (*Game) PushMoveUCI ¶
func (*Game) PushSemilegalMove ¶
func (*Game) PushUCIMove ¶
func (*Game) SetAutoOutcome ¶
func (g *Game) SetAutoOutcome(filter VerdictFilter) Outcome
func (*Game) SetOutcome ¶
type GameAnnotations ¶
type GameAnnotations struct {
Comments [][]string
}
type GameOutcomeStyle ¶
type GameOutcomeStyle uint8
const ( GameOutcomeHide GameOutcomeStyle = iota GameOutcomeFinishedOnly GameOutcomeShow )
type GameStyle ¶
type GameStyle struct { Move MoveStyle MoveNumber MoveNumberStyle Outcome GameOutcomeStyle }
type MaybeCoord ¶
type MaybeCoord uint8
const NoCoord MaybeCoord = 255
func MaybeCoordFromString ¶
func MaybeCoordFromString(s string) (MaybeCoord, error)
func SomeCoord ¶
func SomeCoord(c Coord) MaybeCoord
func (MaybeCoord) ForceGet ¶
func (c MaybeCoord) ForceGet() Coord
func (MaybeCoord) IsNone ¶
func (c MaybeCoord) IsNone() bool
func (MaybeCoord) IsSome ¶
func (c MaybeCoord) IsSome() bool
func (MaybeCoord) IsValid ¶
func (c MaybeCoord) IsValid() bool
func (MaybeCoord) MarshalJSON ¶ added in v0.9.1
func (c MaybeCoord) MarshalJSON() ([]byte, error)
func (MaybeCoord) String ¶
func (c MaybeCoord) String() string
func (MaybeCoord) TryGet ¶
func (c MaybeCoord) TryGet() (Coord, bool)
func (*MaybeCoord) UnmarshalJSON ¶ added in v0.9.1
func (c *MaybeCoord) UnmarshalJSON(data []byte) error
type Move ¶
type Move struct {
// contains filtered or unexported fields
}
func MoveFromCastling ¶
func MoveFromCastling(c Color, s CastlingSide) Move
func (Move) IsLegalWhenSemilegal ¶
func (Move) IsWellFormed ¶
func (Move) SemiValidate ¶
type MoveGenPreset ¶
type MoveGenPreset uint8
const ( MoveGenAll MoveGenPreset = iota MoveGenCapture MoveGenSimple MoveGenSimpleNoPromote MoveGenSimplePromote MoveGenPresetMax )
type MoveKind ¶
type MoveKind uint8
func MoveKindFromCastlingSide ¶
func MoveKindFromCastlingSide(s CastlingSide) MoveKind
func MoveKindFromPromote ¶
func (MoveKind) CastlingSide ¶
func (k MoveKind) CastlingSide() (CastlingSide, bool)
func (MoveKind) MatchesPiece ¶
type MoveNumberStyle ¶
type Outcome ¶
type Outcome struct {
// contains filtered or unexported fields
}
func DrawOutcome ¶
func MustDrawOutcome ¶
func MustWinOutcome ¶
func NewOutcome ¶
func RunningOutcome ¶
func RunningOutcome() Outcome
func (Outcome) IsFinished ¶
func (Outcome) Passes ¶
func (o Outcome) Passes(filter VerdictFilter) bool
type PrettyStyle ¶
type PrettyStyle uint8
const ( PrettyStyleASCII PrettyStyle = iota PrettyStyleFancy )
type RawBoard ¶
type RawBoard struct { Cells [CoordMax]Cell Side Color Castling CastlingRights EpSource MaybeCoord MoveCounter uint8 MoveNumber uint32 }
func InitialRawBoard ¶
func InitialRawBoard() RawBoard
func RawBoardFromFEN ¶
func (*RawBoard) EpDest ¶
func (b *RawBoard) EpDest() MaybeCoord
func (RawBoard) MarshalJSON ¶ added in v0.9.1
func (*RawBoard) Pretty ¶
func (b *RawBoard) Pretty(style PrettyStyle) string
func (*RawBoard) UnmarshalJSON ¶ added in v0.9.1
type RepeatTable ¶
type RepeatTable struct {
// contains filtered or unexported fields
}
func NewRepeatTable ¶
func NewRepeatTable() *RepeatTable
func (*RepeatTable) Clone ¶
func (r *RepeatTable) Clone() *RepeatTable
func (*RepeatTable) Count ¶
func (r *RepeatTable) Count(b *Board) int
func (*RepeatTable) Pop ¶
func (r *RepeatTable) Pop(b *Board)
func (*RepeatTable) Push ¶
func (r *RepeatTable) Push(b *Board)
type Status ¶
type Status uint8
func StatusFromString ¶ added in v0.9.1
func (Status) IsFinished ¶
func (Status) MarshalJSON ¶ added in v0.9.1
func (*Status) UnmarshalJSON ¶ added in v0.9.1
type UCIMove ¶
type UCIMove struct {
// contains filtered or unexported fields
}
func NullUCIMove ¶
func NullUCIMove() UCIMove
func PromoteUCIMove ¶
func SimpleUCIMove ¶
func UCIMoveFromString ¶
func (UCIMove) Kind ¶
func (m UCIMove) Kind() UCIMoveKind
func (UCIMove) MarshalJSON ¶ added in v0.9.1
func (*UCIMove) UnmarshalJSON ¶ added in v0.9.1
type UCIMoveKind ¶
type UCIMoveKind uint8
const ( UCIMoveNull UCIMoveKind = iota UCIMoveSimple UCIMovePromote UCIMoveKindMax )
func (UCIMoveKind) IsValid ¶
func (k UCIMoveKind) IsValid() bool
type Verdict ¶
type Verdict uint8
const ( // Running game verdicts VerdictRunning Verdict = 0 // Draw game verdicts VerdictDrawUnknown Verdict = 32 VerdictStalemate Verdict = 33 VerdictInsufficientMaterial Verdict = 34 VerdictMoves75 Verdict = 35 VerdictRepeat5 Verdict = 36 VerdictMoves50 Verdict = 37 VerdictRepeat3 Verdict = 38 VerdictDrawAgreement Verdict = 39 // Win game verdicts VerdictWinUnknown Verdict = 64 VerdictCheckmate Verdict = 65 VerdictTimeForfeit Verdict = 66 VerdictInvalidMove Verdict = 67 VerdictEngineError Verdict = 68 VerdictResign Verdict = 69 VerdictOpponentAbandon Verdict = 70 )
func (Verdict) IsFinished ¶
func (Verdict) Kind ¶
func (v Verdict) Kind() VerdictKind
func (Verdict) Passes ¶
func (v Verdict) Passes(filter VerdictFilter) bool
type VerdictFilter ¶
type VerdictFilter uint8
const ( VerdictFilterForce VerdictFilter = iota VerdictFilterStrict VerdictFilterRelaxed )
type VerdictKind ¶
type VerdictKind uint8
const ( VerdictKindRunning VerdictKind = 0 VerdictKindDraw VerdictKind = 1 VerdictKindWin VerdictKind = 2 )
Click to show internal directories.
Click to hide internal directories.