Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
Functions ¶
Types ¶
type IllegalMoveError ¶
type IllegalMoveError struct { FullmoveIndex int Color PieceColor Notation string }
func (IllegalMoveError) Error ¶
func (err IllegalMoveError) Error() string
type InvalidRuneError ¶
func (InvalidRuneError) Error ¶
func (err InvalidRuneError) Error() string
type InvalidSyntaxError ¶
func (InvalidSyntaxError) Error ¶
func (err InvalidSyntaxError) Error() string
type MoveParser ¶
type MoveParser interface {
Parse(start Position, r io.RuneReader) ([]Move, error)
}
MoveParser parses UTF-8 representation of series of chess moves
func Algebraic ¶
func Algebraic() MoveParser
type Piece ¶
type Piece struct { Kind PieceKind Color PieceColor }
type PieceColor ¶
type PieceColor int
const ( White PieceColor = iota Black )
func (PieceColor) Name ¶
func (color PieceColor) Name() string
func (PieceColor) String ¶
func (color PieceColor) String() string
type PositionParser ¶
type PositionParser interface {
Parse(r io.RuneReader) (Position, error)
}
PositionParser parses UTF-8 representation of chess position
func FEN ¶
func FEN() PositionParser
type Square ¶
type Square struct {
// contains filtered or unexported fields
}
func MustNewSquare ¶
MustNewSquare acts like NewSquare, but silently ignores errors and returns zero-value ("A1") instead.
func MustNewSquareFromString ¶
MustNewSquareFromString acts like NewSquareFromString, but silently ignores errors and returns zero-value ("A1") instead.
func NewSquare ¶
NewSquare creates Square from file and rank coordinates. Both coordinates are represented as integers from 0 ("A" file or 1st rank) to 7 ("H" file or 8th rank). If either of coordinates falls out of this range, an error is returned.
func NewSquareFromString ¶
NewSquareFromString creates square from its string representation (e.g. "G5"). Both lowercase and uppercase file letters are allowed. If s is not a valid square string, an error is returned.