Documentation ¶
Index ¶
- Variables
- func FORFromBoard(b *Board) string
- func ParseMoves(s *scanner.Scanner, g *Game) error
- func ParseTags(s *scanner.Scanner, g *Game) error
- type Board
- func (b Board) FindKing(color Color) Position
- func (b Board) GetPiece(p Position) Piece
- func (b *Board) MakeAlgebraicMove(str string, color Color) error
- func (b *Board) MakeMove(m Move) error
- func (b *Board) MoveFromAlgebraic(str string, color Color) (Move, error)
- func (b *Board) RemovePiece(pos Position, p Piece)
- func (b *Board) SetPiece(pos Position, p Piece)
- func (b *Board) String() string
- type CastleStatus
- type Color
- type FEN
- type File
- type Game
- type Move
- type PGNScanner
- type Piece
- type Position
- type Rank
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrAmbiguousMove error = errors.New("pgn: ambiguous algebraic move") ErrUnknownMove error = errors.New("pgn: unknown move") ErrAttackerNotFound error = errors.New("pgn: attacker not found") ErrMoveFromEmptySquare error = errors.New("pgn: move from empty square") ErrMoveWrongColor error = errors.New("pgn: move from wrong color") ErrMoveThroughPiece error = errors.New("pgn: move through piece") ErrMoveThroughCheck error = errors.New("pgn: move through check") ErrMoveIntoCheck error = errors.New("pgn: move into check") ErrMoveInvalidCastle error = errors.New("pgn: move invalid castle") )
Functions ¶
func FORFromBoard ¶
Types ¶
type Board ¶
type Board struct {
// contains filtered or unexported fields
}
func NewBoardFEN ¶
func (*Board) MoveFromAlgebraic ¶
func (*Board) RemovePiece ¶
type CastleStatus ¶
type CastleStatus int8
const ( Both CastleStatus = iota None Kingside Queenside )
func (CastleStatus) String ¶
func (cs CastleStatus) String(c Color) string
type FEN ¶
type FEN struct { FOR string ToMove Color WhiteCastleStatus CastleStatus BlackCastleStatus CastleStatus EnPassantVulnerable Position HalfmoveClock int Fullmove int }
func FENFromBoard ¶
type Move ¶
var (
NilMove Move = Move{From: NoPosition, To: NoPosition}
)
type PGNScanner ¶
type PGNScanner struct {
// contains filtered or unexported fields
}
func NewPGNScanner ¶
func NewPGNScanner(r io.Reader) *PGNScanner
func (*PGNScanner) Next ¶
func (ps *PGNScanner) Next() bool
func (*PGNScanner) Scan ¶
func (ps *PGNScanner) Scan() (*Game, error)
type Piece ¶
type Piece byte
const ( NoPiece Piece = ' ' BlackPawn Piece = 'p' BlackKnight Piece = 'n' BlackBishop Piece = 'b' BlackRook Piece = 'r' BlackQueen Piece = 'q' BlackKing Piece = 'k' WhitePawn Piece = 'P' WhiteKnight Piece = 'N' WhiteBishop Piece = 'B' WhiteRook Piece = 'R' WhiteQueen Piece = 'Q' WhiteKing Piece = 'K' )
type Position ¶
type Position uint64
const ( A1 Position = 1 << iota B1 Position = 1 << iota C1 Position = 1 << iota D1 Position = 1 << iota E1 Position = 1 << iota F1 Position = 1 << iota G1 Position = 1 << iota H1 Position = 1 << iota A2 Position = 1 << iota B2 Position = 1 << iota C2 Position = 1 << iota D2 Position = 1 << iota E2 Position = 1 << iota F2 Position = 1 << iota G2 Position = 1 << iota H2 Position = 1 << iota A3 Position = 1 << iota B3 Position = 1 << iota C3 Position = 1 << iota D3 Position = 1 << iota E3 Position = 1 << iota F3 Position = 1 << iota G3 Position = 1 << iota H3 Position = 1 << iota A4 Position = 1 << iota B4 Position = 1 << iota C4 Position = 1 << iota D4 Position = 1 << iota E4 Position = 1 << iota F4 Position = 1 << iota G4 Position = 1 << iota H4 Position = 1 << iota A5 Position = 1 << iota B5 Position = 1 << iota C5 Position = 1 << iota D5 Position = 1 << iota E5 Position = 1 << iota F5 Position = 1 << iota G5 Position = 1 << iota H5 Position = 1 << iota A6 Position = 1 << iota B6 Position = 1 << iota C6 Position = 1 << iota D6 Position = 1 << iota E6 Position = 1 << iota F6 Position = 1 << iota G6 Position = 1 << iota H6 Position = 1 << iota A7 Position = 1 << iota B7 Position = 1 << iota C7 Position = 1 << iota D7 Position = 1 << iota E7 Position = 1 << iota F7 Position = 1 << iota G7 Position = 1 << iota H7 Position = 1 << iota A8 Position = 1 << iota B8 Position = 1 << iota C8 Position = 1 << iota D8 Position = 1 << iota E8 Position = 1 << iota F8 Position = 1 << iota G8 Position = 1 << iota H8 Position = 1 << iota )
const NoPosition Position = 0
func ParsePosition ¶
func PositionFromFileRank ¶
Click to show internal directories.
Click to hide internal directories.