chessongo

package module
v0.22.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 30, 2026 License: MIT Imports: 10 Imported by: 0

README

chess-on-go

chess-on-go is a Go chess rules package built around bitboards. It provides legal move generation, FEN, PGN, EPD, SAN/UCI move handling, undo support, draw-rule tracking, binary serialization, and search-oriented traversal helpers.

This package powers www.chesshere.com.

Features

  • Standard chess legal move generation using bitboards.
  • Fast sliding attacks with magic bitboards.
  • FEN load/export with structured validation errors.
  • SAN and UCI move parsing/formatting.
  • PGN import/export with headers, comments, NAGs, variations, FEN tags, and result validation.
  • EPD parsing with typed helpers for common opcodes such as bm, am, id, and perft.
  • Check, checkmate, stalemate, en passant, castling, promotion, insufficient material, repetition, and 50/75-move-rule handling.
  • Opt-in Chess960, King of the Hill, and Three-check variant support.
  • Read-only public accessors, snapshots, and draw-state helpers.
  • Search/perft helpers that avoid game-status bookkeeping overhead.
  • Static exchange evaluation via Game.SEE(from, to) for material-only swap analysis on a target square.
  • Optional CLI for validating FEN, listing legal moves, and running perft.

Install

go get github.com/chesshere-com/chess-on-go
import chessongo "github.com/chesshere-com/chess-on-go"

Quick Start

package main

import (
	"fmt"

	chessongo "github.com/chesshere-com/chess-on-go"
)

func main() {
	game := chessongo.NewGame()

	for _, move := range game.LegalMovesInto(nil) {
		fmt.Println(move.UCI())
	}

	if err := game.TryMoveUCI("e2e4"); err != nil {
		panic(err)
	}

	fmt.Println(game.FEN())
	fmt.Println(game.SideToMove())
}

Public API

New code should use accessor methods instead of reading or mutating exported Game fields directly. The fields remain exported for compatibility with older callers, but they are deprecated and can become internally inconsistent if callers mutate them.

Use these stable APIs for normal integration work:

  • FEN, SideToMove, HalfMoveClock, FullMoveNumber, Status, and IsTerminal for game metadata.
  • Variant and Winner for variant-aware integrations.
  • Snapshot for a defensive value copy of the current public game state.
  • BoardView, PieceAt, Board, Pieces, PiecesOfKind, OccupiedSquares, EnPassantSquare, and CastlingRights for board inspection.
  • LegalMovesInto, LegalMovesList, TryMove, TryMoveUCI, TryMoveSAN, and TryMoveFromCoords for legal move handling.
  • DrawStatus, CanClaimThreefoldRepetition, CanClaimFiftyMoveRule, IsFivefoldRepetitionDraw, and IsSeventyFiveMoveRuleDraw for draw-rule state.
  • PositionKey for same-version Zobrist position comparisons and hash-table keys.
  • Clone when analysis code needs to branch without changing the original game.

Load And Export FEN

game, err := chessongo.NewGameFromFEN("rnbqkbnr/pppppppp/8/8/4P3/8/PPPP1PPP/RNBQKBNR b KQkq e3 0 1")
if err != nil {
	return err
}

fmt.Println(game.FEN())
fmt.Println(game.Status())

LoadFEN validates the position before replacing the current game state. Invalid board shapes, missing kings, illegal castling rights, malformed en-passant fields, pawns on promotion ranks, invalid counters, and illegal positions return errors. FEN errors support errors.Is(err, ErrInvalidFEN) and structured field inspection with errors.As.

Apply Moves

game := chessongo.NewGame()

if err := game.TryMoveUCI("e2e4"); err != nil {
	return err
}

if err := game.TryMoveSAN("e5"); err != nil {
	return err
}

TryMoveUCI accepts coordinate notation such as e2e4, e1g1, and a7a8q. TryMoveSAN accepts standard algebraic notation such as Nf3, O-O, exd5, and Qh5+. Illegal move errors support errors.Is(err, ErrIllegalMove).

Inspect A Position

game := chessongo.NewGame()
view := game.BoardView()

e1, _ := chessongo.ParseSquare("e1")
piece, ok := view.PieceAt(e1)
if ok {
	fmt.Println(piece)
}

snapshot := game.Snapshot()
fmt.Println(snapshot.PositionKey)
fmt.Println(len(snapshot.LegalMoves))

BoardView and Snapshot return value copies. Mutating their returned board or move slices does not mutate the game.

Draw And Game Status

status := game.Status()
draw := game.DrawStatus()

fmt.Println(status)
fmt.Println(draw.CanClaimThreefoldRepetition)
fmt.Println(draw.CanClaimFiftyMoveRule)
fmt.Println(draw.FivefoldRepetition)
fmt.Println(draw.SeventyFiveMoveRule)

Status reports terminal and check states. Threefold repetition and the 50-move rule are claimable draws; fivefold repetition and the 75-move rule are automatic draws.

PGN

game := &chessongo.Game{}
if err := game.LoadPGN("1. e4 e5 2. Nf3 Nc6 3. Bb5 a6"); err != nil {
	return err
}

fmt.Println(game.FEN())
fmt.Println(game.PGN())

PGN loading applies the main line, preserves tag pairs, accepts headers and FEN tags, ignores comments, NAGs, and variations, and validates result tags against movetext and forced terminal positions. Use PGN, PGNTags, and PGNResult to export the played main line.

EPD

record, err := chessongo.ParseEPD("rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - bm e4; id \"initial\";")
if err != nil {
	return err
}

fmt.Println(record.FEN)
fmt.Println(record.BestMoves())

Use ParseEPD or LoadEPDRecords for Extended Position Description test suites. EPD records expose normalized FEN and opcode operands such as bm, am, id, and perft.

Search And Perft

For search-style traversal, use SearchBoard or MakeMoveFast / UndoMoveFast. These APIs maintain board state while skipping repetition, PGN, and game-over bookkeeping that engine-style traversal usually does not need.

board, err := chessongo.NewSearchBoard(chessongo.STARTING_POSITION_FEN)
if err != nil {
	return err
}

nodes := board.Perft(4)
fmt.Println(nodes)

For normal game play, use TryMove, TryMoveUCI, TryMoveSAN, MakeMove, and UndoMove so draw, checkmate, repetition, and PGN state stay current.

CLI

The repository includes a small command-line tool:

go run ./cmd/chessongo fen "4k3/8/8/8/8/8/8/4K3 w - - 0 1"
go run ./cmd/chessongo legal "4k3/8/8/8/8/8/8/4K3 w - - 0 1"
go run ./cmd/chessongo perft -depth 2 "4k3/8/8/8/8/8/8/4K3 w - - 0 1"

Supported Rules

The package supports standard chess by default and variants through explicit constructors or variant loading APIs:

game, err := chessongo.NewChess960Game(518)
fen, err := chessongo.Chess960StartingFEN(0)
game, err = chessongo.NewGameFromFENWithVariant(fen, chessongo.VariantChess960)

standardFEN := chessongo.STARTING_POSITION_FEN
hill, err := chessongo.NewGameFromFENWithVariant(standardFEN, chessongo.VariantKingOfTheHill)

threeCheckFEN := chessongo.STARTING_POSITION_FEN + " +0+0"
threeCheck, err := chessongo.NewGameFromFENWithVariant(threeCheckFEN, chessongo.VariantThreeCheck)

Chess960 FEN export uses Shredder-FEN castling file letters so rook origins are not lost. Three-check FEN uses a seventh +W+B field for checks given, such as +0+0.

See docs/variants.md for variant-specific FEN, PGN, status, hashing, and binary serialization notes.

Covered rule areas include:

  • Legal move generation.
  • Check, checkmate, and stalemate.
  • King of the Hill center-square wins.
  • Three-check counters and third-check wins.
  • Castling legality, including attacked transit/destination squares.
  • En passant legality, including discovered-check edge cases.
  • Promotions.
  • Insufficient material.
  • Claimable threefold repetition and 50-move rule.
  • Automatic fivefold repetition and 75-move rule.
  • Variant-aware PGN, FEN, Zobrist hashes, snapshots, and binary serialization.

Testing

make test
make race
make vet
make staticcheck

Shallow known-position perft checks run with the normal test suite. Deeper perft checks are available with:

make perft

Short fuzzing and benchmark smoke checks are available with:

make fuzz-smoke
make bench-smoke

Benchmarking

Benchmark output is kept in a benchstat-friendly format. For a reviewable benchmark comparison:

go test -run '^$' -bench='BenchmarkGenerateLegalMoves|BenchmarkPerft|BenchmarkCompare' -benchmem -count=5 ./... | tee bench-before.txt

# make the change

make bench
make benchstat

Use make bench-snapshot to keep a dated benchmark snapshot under docs/benchmarks/.

Contributing And Releases

Development Notes

  • Prefer stable accessors over mutable Game fields.
  • Prefer LegalMovesInto when reusing caller-owned buffers.
  • Prefer SearchBoard for engine-style perft/search traversal.
  • Use PositionKey for in-memory position keys, and FEN for persisted positions.

Documentation

Overview

Package chessongo provides chess rules, legal move generation, FEN loading, PGN import/export, undo support, and search-oriented traversal helpers.

Standard chess is the default rule set. Chess960, King of the Hill, and Three-check are available through explicit variant constructors or LoadFENWithVariant.

The stable method API includes Game.FEN, Game.SideToMove, Game.BoardView, Game.Snapshot, Game.LegalMovesInto, Game.DrawStatus, Game.PositionKey, Game.TryMoveUCI, Game.TryMoveSAN, Game.Clone, and Game.Status. Prefer ParseSquare and PieceFromRune over the package-level lookup maps.

Index

Examples

Constants

View Source
const (
	CASTLE_WKS = 1 //White king side castling  0001
	CASTLE_WQS = 2 //White queen side castling 0010
	CASTLE_BKS = 4 //Black king side castling  0100
	CASTLE_BQS = 8 //Black queen side castling 1000
)

Castling permissions

View Source
const (
	W_KING_INIT_SQUARE       = 60 // e1
	B_KING_INIT_SQUARE       = 4  // e8
	WKS_KING_TO_SQUARE       = 62 // g1
	WQS_KING_TO_SQUARE       = 58 // c1
	BKS_KING_TO_SQUARE       = 6  // g8
	BQS_KING_TO_SQUARE       = 2  // c8
	WKS_ROOK_ORIGINAL_SQUARE = 63 // h1
	WQS_ROOK_ORIGINAL_SQUARE = 56 // a1
	BKS_ROOK_ORIGINAL_SQUARE = 7  // h8
	BQS_ROOK_ORIGINAL_SQUARE = 0  // a8
)

castling squares

View Source
const (
	DIRECTION_N = iota
	DIRECTION_S
	DIRECTION_E
	DIRECTION_W
	DIRECTION_NE
	DIRECTION_NW
	DIRECTION_SE
	DIRECTION_SW
)

Directions of movement

View Source
const (
	LSB = iota
	MSB
)

Significant bit type

View Source
const (
	RANK1_MASK Bitboard = 0xFF00000000000000 //1111111100000000000000000000000000000000000000000000000000000000
	RANK2_MASK Bitboard = 0xFF000000000000   //0000000011111111000000000000000000000000000000000000000000000000
	RANK3_MASK Bitboard = 0xFF0000000000
	RANK4_MASK Bitboard = 0xFF00000000
	RANK5_MASK Bitboard = 0xFF000000
	RANK6_MASK Bitboard = 0xFF0000
	RANK7_MASK Bitboard = 0xFF00
	RANK8_MASK Bitboard = 0xFF //0000000000000000000000000000000000000000000000000000000011111111

	FILE_A_MASK = 0x0101010101010101 //00000000000100000001000000010000000100000001000000010000000100000001
	FILE_B_MASK = 0x0202020202020202
	FILE_C_MASK = 0x0404040404040404
	FILE_D_MASK = 0x0808080808080808
	FILE_E_MASK = 0x1010101010101010
	FILE_F_MASK = 0x2020202020202020
	FILE_G_MASK = 0x4040404040404040
	FILE_H_MASK = 0x8080808080808080 //1000000010000000100000001000000010000000100000001000000010000000
)
View Source
const (
	MOVE_TO_BIT         = 6
	MOVE_ENPASSANT_BIT  = 12
	MOVE_CASTLING_BIT   = 13
	MOVE_PROMOTION_BIT  = 14
	MOVE_CAPTURE_BIT    = 17
	MOVE_TO_FROM_MASK   = 0x3F
	MOVE_CAPTURED_MASK  = 0x1F
	MOVE_PROMOTION_MASK = 0x7
)
View Source
const (
	WHITE    = 8  //White 0000 1000
	BLACK    = 16 //BLACK 0001 0000
	NO_COLOR = 0
)
View Source
const (
	EMPTY  = iota // 000
	PAWN          // 001
	KNIGHT        // 010
	BISHOP        // 011
	ROOK          // 100
	QUEEN         // 101
	KING          // 110
)
View Source
const (
	W_PAWN   = WHITE | PAWN   // 01001
	W_KNIGHT = WHITE | KNIGHT // 01010
	W_BISHOP = WHITE | BISHOP // 01011
	W_ROOK   = WHITE | ROOK   // 01100
	W_QUEEN  = WHITE | QUEEN  // 01101
	W_KING   = WHITE | KING   // 01110

	B_PAWN   = BLACK | PAWN   // 10001
	B_KNIGHT = BLACK | KNIGHT // 10010
	B_BISHOP = BLACK | BISHOP // 10011
	B_ROOK   = BLACK | ROOK   // 10100
	B_QUEEN  = BLACK | QUEEN  // 10101
	B_KING   = BLACK | KING   // 10110
)
View Source
const BLACK_MASK = 0x10
View Source
const STARTING_POSITION_FEN = "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1"

STARTING_POSITION_FEN is the standard chess initial position.

View Source
const WHITE_MASK = 0x8

Variables

View Source
var (
	// ErrInvalidFEN identifies invalid FEN input.
	ErrInvalidFEN = errors.New("invalid fen")
	// ErrIllegalMove identifies legal move rejection.
	ErrIllegalMove = errors.New("illegal move")
	// ErrInvalidMoveNotation identifies malformed move notation.
	ErrInvalidMoveNotation = errors.New("invalid move notation")
)

ALL_DIRECTIONS lists all ray directions.

Compatibility: this low-level table is retained for older callers.

View Source
var ATTACKS_TO = [64]Bitboard{}

ATTACKS_TO contains ray attacks to each square on an empty board.

Compatibility: this low-level table is retained for older callers.

BISHOP_DIRECTIONS lists the diagonal ray directions.

Compatibility: this low-level table is retained for older callers.

View Source
var COORDS_TO_SQUARE = map[string]Square{
	"a8": Square(0), "b8": Square(1), "c8": Square(2), "d8": Square(3), "e8": Square(4), "f8": Square(5), "g8": Square(6), "h8": Square(7),
	"a7": Square(8), "b7": Square(9), "c7": Square(10), "d7": Square(11), "e7": Square(12), "f7": Square(13), "g7": Square(14), "h7": Square(15),
	"a6": Square(16), "b6": Square(17), "c6": Square(18), "d6": Square(19), "e6": Square(20), "f6": Square(21), "g6": Square(22), "h6": Square(23),
	"a5": Square(24), "b5": Square(25), "c5": Square(26), "d5": Square(27), "e5": Square(28), "f5": Square(29), "g5": Square(30), "h5": Square(31),
	"a4": Square(32), "b4": Square(33), "c4": Square(34), "d4": Square(35), "e4": Square(36), "f4": Square(37), "g4": Square(38), "h4": Square(39),
	"a3": Square(40), "b3": Square(41), "c3": Square(42), "d3": Square(43), "e3": Square(44), "f3": Square(45), "g3": Square(46), "h3": Square(47),
	"a2": Square(48), "b2": Square(49), "c2": Square(50), "d2": Square(51), "e2": Square(52), "f2": Square(53), "g2": Square(54), "h2": Square(55),
	"a1": Square(56), "b1": Square(57), "c1": Square(58), "d1": Square(59), "e1": Square(60), "f1": Square(61), "g1": Square(62), "h1": Square(63),
}

COORDS_TO_SQUARE maps algebraic coordinates to square indexes.

Compatibility: prefer ParseSquare or ParseUCISquare in new code.

View Source
var DIRECTION_LSB_MSP = [8]uint{}

DIRECTION_LSB_MSP identifies the blocking-bit side for each direction.

Compatibility: this low-level table is retained for older callers.

View Source
var DIRECTION_SHIFT = [8][2]int{}

DIRECTION_SHIFT contains rank/file deltas for each direction.

Compatibility: this low-level table is retained for older callers.

View Source
var FILE_TO_STRING = map[int]string{0: "a", 1: "b", 2: "c", 3: "d", 4: "e", 5: "f", 6: "g", 7: "h"}

FILE_TO_STRING maps zero-based file indexes to file strings.

Compatibility: prefer Square.FileLetter in new code.

View Source
var KING_ATTACKS_FROM = [64]Bitboard{}

KING_ATTACKS_FROM contains king attacks from each square on an empty board.

Compatibility: this low-level table is retained for older callers.

View Source
var KING_RANK_FILE_SHIFTS = [8][2]int{
	{-1, -1}, {0, -1}, {1, -1}, {-1, 0},
	{1, 0}, {-1, 1}, {0, 1}, {1, 1},
}

KING_RANK_FILE_SHIFTS lists king move rank/file offsets.

Compatibility: this low-level table is retained for older callers.

View Source
var KNIGHT_ATTACKS_FROM = [64]Bitboard{}

KNIGHT_ATTACKS_FROM contains knight attacks from each square on an empty board.

Compatibility: this low-level table is retained for older callers.

View Source
var KNIGHT_RANK_FILE_SHIFTS = [8][2]int{
	{-2, -1}, {-2, 1}, {2, -1}, {2, 1},
	{-1, -2}, {-1, 2}, {1, -2}, {1, 2},
}

KNIGHT_RANK_FILE_SHIFTS lists knight move rank/file offsets.

Compatibility: this low-level table is retained for older callers.

View Source
var PIECE_TO_RUNE = map[Piece]rune{
	W_PAWN: 'P', W_KNIGHT: 'N', W_BISHOP: 'B', W_ROOK: 'R', W_QUEEN: 'Q', W_KING: 'K',
	B_PAWN: 'p', B_KNIGHT: 'n', B_BISHOP: 'b', B_ROOK: 'r', B_QUEEN: 'q', B_KING: 'k',
}

PIECE_TO_RUNE maps pieces to FEN runes.

Compatibility: prefer Piece.ToRune in new code.

View Source
var RANK_TO_STRING = map[int]string{0: "8", 1: "7", 2: "6", 3: "5", 4: "4", 5: "3", 6: "2", 7: "1"}

RANK_TO_STRING maps zero-based rank indexes to rank strings.

Compatibility: prefer Square.RankDigit in new code.

View Source
var RAY_MASKS = [8][64]Bitboard{}

RAY_MASKS contains ray masks for each direction and square.

Compatibility: this low-level table is retained for older callers.

ROOK_DIRECTIONS lists the orthogonal ray directions.

Compatibility: this low-level table is retained for older callers.

View Source
var RUNE_TO_PIECE = map[rune]Piece{
	'P': W_PAWN, 'N': W_KNIGHT, 'B': W_BISHOP, 'R': W_ROOK, 'Q': W_QUEEN, 'K': W_KING,
	'p': B_PAWN, 'n': B_KNIGHT, 'b': B_BISHOP, 'r': B_ROOK, 'q': B_QUEEN, 'k': B_KING,
}

RUNE_TO_PIECE maps FEN piece runes to pieces.

Compatibility: prefer PieceFromRune in new code.

View Source
var SQUARE_TO_COORDS = [64]string{
	"a8", "b8", "c8", "d8", "e8", "f8", "g8", "h8",
	"a7", "b7", "c7", "d7", "e7", "f7", "g7", "h7",
	"a6", "b6", "c6", "d6", "e6", "f6", "g6", "h6",
	"a5", "b5", "c5", "d5", "e5", "f5", "g5", "h5",
	"a4", "b4", "c4", "d4", "e4", "f4", "g4", "h4",
	"a3", "b3", "c3", "d3", "e3", "f3", "g3", "h3",
	"a2", "b2", "c2", "d2", "e2", "f2", "g2", "h2",
	"a1", "b1", "c1", "d1", "e1", "f1", "g1", "h1",
}

SQUARE_TO_COORDS maps square indexes to algebraic coordinates.

Compatibility: prefer Square.String or Square.UCI in new code.

View Source
var STRING_TO_KIND = map[string]uint{
	"P": PAWN, "N": KNIGHT, "B": BISHOP, "R": ROOK, "Q": QUEEN, "K": KING,
	"p": PAWN, "n": KNIGHT, "b": BISHOP, "r": ROOK, "q": QUEEN, "k": KING,
}

STRING_TO_KIND maps piece letters to piece kinds.

Compatibility: this low-level lookup table is retained for older callers.

Functions

func Chess960BackRank

func Chess960BackRank(position int) (string, error)

Chess960BackRank returns the white back rank for a Chess960 position ID.

func Chess960StartingFEN

func Chess960StartingFEN(position int) (string, error)

Chess960StartingFEN returns the initial Shredder-FEN position for a Chess960 position ID.

func CoordsToIndex

func CoordsToIndex(rank, file int) uint

Convert rank, file coordinates to a 64 based index

func IsCoordsOutofBoard

func IsCoordsOutofBoard(rank, file int) bool

Tells whether coords are out of board or not

func PrintBitboard

func PrintBitboard(bb Bitboard, title string)

func ValidateChess960BackRank

func ValidateChess960BackRank(rank string) error

ValidateChess960BackRank verifies that rank is a legal white Chess960 back rank.

Types

type Bitboard

type Bitboard uint64

Bitboard

func (Bitboard) NumberOfSetBits

func (b Bitboard) NumberOfSetBits() int

type BoardView

type BoardView struct {
	// contains filtered or unexported fields
}

BoardView wraps board internals with read-only accessor methods.

func (BoardView) OccupiedSquares

func (v BoardView) OccupiedSquares() Bitboard

OccupiedSquares returns the occupied-square bitboard.

func (BoardView) PieceAt

func (v BoardView) PieceAt(square Square) (Piece, bool)

PieceAt returns the piece on square. The bool is false for out-of-range squares.

func (BoardView) Pieces

func (v BoardView) Pieces(color Color) Bitboard

Pieces returns all occupied squares for color.

func (BoardView) PiecesOfKind

func (v BoardView) PiecesOfKind(color Color, kind Piece) Bitboard

PiecesOfKind returns all occupied squares for color and piece kind.

func (BoardView) Squares

func (v BoardView) Squares() [64]Piece

Squares returns a copy of the board squares.

type CastlingRights

type CastlingRights uint8

CastlingRights is a bitset of available castling rights.

const (
	// CastlingWhiteKingSide allows white to castle king side.
	CastlingWhiteKingSide CastlingRights = CASTLE_WKS
	// CastlingWhiteQueenSide allows white to castle queen side.
	CastlingWhiteQueenSide CastlingRights = CASTLE_WQS
	// CastlingBlackKingSide allows black to castle king side.
	CastlingBlackKingSide CastlingRights = CASTLE_BKS
	// CastlingBlackQueenSide allows black to castle queen side.
	CastlingBlackQueenSide CastlingRights = CASTLE_BQS
)

func (CastlingRights) Has

func (r CastlingRights) Has(rights CastlingRights) bool

Has reports whether all requested castling rights are present.

func (CastlingRights) String

func (r CastlingRights) String() string

String returns the FEN castling-rights field.

type Color

type Color uint8

func (Color) String

func (c Color) String() string

String returns a stable lower-case color name.

type Direction

type Direction uint

type DrawStatus

type DrawStatus struct {
	InsufficientMaterial        bool
	CanClaimThreefoldRepetition bool
	CanClaimFiftyMoveRule       bool
	FivefoldRepetition          bool
	SeventyFiveMoveRule         bool
}

DrawStatus describes claimable and automatic draw state.

type EPDRecord

type EPDRecord struct {
	FEN        string
	Operations map[string][]string
}

EPDRecord is one Extended Position Description record.

func LoadEPDRecords

func LoadEPDRecords(input string) ([]EPDRecord, error)

LoadEPDRecords parses multiple EPD records, skipping blank and comment lines.

func ParseEPD

func ParseEPD(line string) (EPDRecord, error)

ParseEPD parses one Extended Position Description record.

Example
package main

import (
	"fmt"

	chessongo "github.com/chesshere-com/chess-on-go"
)

func main() {
	record, err := chessongo.ParseEPD(`rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - bm e4 d4; id "initial"; perft 1 20;`)
	if err != nil {
		panic(err)
	}

	id, _ := record.ID()
	perft, _ := record.PerftExpectations()
	fmt.Println(id)
	fmt.Println(record.BestMoves())
	fmt.Println(perft[1])

}
Output:
initial
[e4 d4]
20

func (EPDRecord) AvoidMoves

func (r EPDRecord) AvoidMoves() []string

AvoidMoves returns the `am` operands.

func (EPDRecord) BestMoves

func (r EPDRecord) BestMoves() []string

BestMoves returns the `bm` operands.

func (EPDRecord) Game

func (r EPDRecord) Game() (*Game, error)

Game returns a game loaded from the EPD position.

func (EPDRecord) ID

func (r EPDRecord) ID() (string, bool)

ID returns the first `id` operand.

func (EPDRecord) Operation

func (r EPDRecord) Operation(opcode string) []string

Operation returns a copy of the operands for opcode.

func (EPDRecord) PerftExpectations

func (r EPDRecord) PerftExpectations() (map[int]uint64, error)

PerftExpectations returns perft depth/node expectations from `perft` or `D<n>` opcodes.

type FENError

type FENError struct {
	Field  FENField
	Reason string
}

FENError provides structured context for FEN validation failures.

Example
package main

import (
	"errors"
	"fmt"

	chessongo "github.com/chesshere-com/chess-on-go"
)

func main() {
	game := &chessongo.Game{}
	err := game.LoadFEN("8/8/8/8/8/8/8/8 w - - 0 1")

	var fenErr *chessongo.FENError
	fmt.Println(errors.Is(err, chessongo.ErrInvalidFEN))
	fmt.Println(errors.As(err, &fenErr), fenErr.Field)

}
Output:
true
true piece placement

func (*FENError) Error

func (e *FENError) Error() string

func (*FENError) Unwrap

func (e *FENError) Unwrap() error

type FENField

type FENField string

FENField identifies the FEN field that failed validation.

const (
	FENFieldFormat         FENField = "format"
	FENFieldPiecePlacement FENField = "piece placement"
	FENFieldSideToMove     FENField = "side to move"
	FENFieldCastling       FENField = "castling"
	FENFieldEnPassant      FENField = "en passant"
	FENFieldHalfMoveClock  FENField = "halfmove clock"
	FENFieldFullMoveNumber FENField = "fullmove number"
	FENFieldVariantState   FENField = "variant state"
	FENFieldLegality       FENField = "legality"
)

type Game

type Game struct {
	// contains filtered or unexported fields
}

func CloneGame

func CloneGame(g *Game) Game

func LoadPGNGame

func LoadPGNGame(pgn string) (*Game, error)

LoadPGNGame is a helper that constructs a fresh board, loads the PGN, and returns the populated board.

func NewChess960Game

func NewChess960Game(position int) (*Game, error)

NewChess960Game creates a Chess960 game from a position ID in [0, 959].

func NewGame

func NewGame() *Game

func NewGameFromFEN

func NewGameFromFEN(fen string) (*Game, error)

NewGameFromFEN creates a game initialized from FEN.

func NewGameFromFENWithVariant

func NewGameFromFENWithVariant(fen string, variant Variant) (*Game, error)

NewGameFromFENWithVariant creates a game initialized from FEN under a specific variant.

func (*Game) Board

func (g *Game) Board() [64]Piece

Board returns a copy of the board squares.

Example
package main

import (
	"fmt"

	chessongo "github.com/chesshere-com/chess-on-go"
)

func main() {
	game := chessongo.NewGame()
	board := game.Board()
	e1, err := chessongo.ParseSquare("e1")
	if err != nil {
		panic(err)
	}

	fmt.Println(board[e1])
	fmt.Println(game.CastlingRights().String())

}
Output:
wK
KQkq

func (*Game) BoardView

func (g *Game) BoardView() BoardView

BoardView returns a read-only view of the current board internals.

Example
package main

import (
	"fmt"

	chessongo "github.com/chesshere-com/chess-on-go"
)

func main() {
	game := chessongo.NewGame()
	view := game.BoardView()
	e1, err := chessongo.ParseSquare("e1")
	if err != nil {
		panic(err)
	}

	piece, ok := view.PieceAt(e1)
	fmt.Println(ok, piece)
	fmt.Println(view.Pieces(chessongo.WHITE).NumberOfSetBits())

}
Output:
true wK
16

func (*Game) CanClaimFiftyMoveRule

func (g *Game) CanClaimFiftyMoveRule() bool

CanClaimFiftyMoveRule reports whether the halfmove clock allows a 50-move-rule claim.

func (*Game) CanClaimThreefoldRepetition

func (g *Game) CanClaimThreefoldRepetition() bool

CanClaimThreefoldRepetition reports whether the current position has occurred at least three times.

func (*Game) CanMove

func (g *Game) CanMove(m Move) bool

Checks whether the given move is possible or not

func (*Game) CastlingRights

func (g *Game) CastlingRights() CastlingRights

CastlingRights returns the current castling rights bitset.

func (*Game) Clone

func (g *Game) Clone() *Game

Clone returns a deep copy of the game.

Example
package main

import (
	"fmt"

	chessongo "github.com/chesshere-com/chess-on-go"
)

func main() {
	game := chessongo.NewGame()
	analysis := game.Clone()
	if err := analysis.TryMoveSAN("e4"); err != nil {
		panic(err)
	}

	fmt.Println(game.FEN())
	fmt.Println(analysis.FEN())

}
Output:
rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1
rnbqkbnr/pppppppp/8/8/4P3/8/PPPP1PPP/RNBQKBNR b KQkq e3 0 1

func (*Game) ComputeIsCheck

func (g *Game) ComputeIsCheck() bool

Checks whether our king is in check or not

func (*Game) CopyLegalMoves

func (g *Game) CopyLegalMoves(dst []Move) []Move

CopyLegalMoves copies the current legal moves into dst and returns the resulting slice.

It lets search code reuse a caller-owned buffer instead of allocating a fresh slice at each node.

func (*Game) DrawStatus

func (g *Game) DrawStatus() DrawStatus

DrawStatus returns the current draw rule state without exposing mutable fields.

Example
package main

import (
	"fmt"

	chessongo "github.com/chesshere-com/chess-on-go"
)

func main() {
	game := &chessongo.Game{}
	if err := game.LoadFEN("4k3/8/8/8/8/8/6R1/4K3 w - - 99 1"); err != nil {
		panic(err)
	}
	if err := game.TryMoveUCI("g2g3"); err != nil {
		panic(err)
	}

	draw := game.DrawStatus()
	fmt.Println(draw.CanClaimFiftyMoveRule)
	fmt.Println(draw.SeventyFiveMoveRule)

}
Output:
true
false

func (*Game) EnPassantSquare

func (g *Game) EnPassantSquare() Square

EnPassantSquare returns the current en-passant target square, or 0 if none.

func (*Game) FEN

func (g *Game) FEN() string

FEN returns the current FEN string.

func (*Game) FullMoveNumber

func (g *Game) FullMoveNumber() int

FullMoveNumber returns the fullmove number.

func (*Game) GenerateLegalMoves

func (g *Game) GenerateLegalMoves()

Generate all legal moves

func (*Game) GenerateLegalMovesFast

func (g *Game) GenerateLegalMovesFast()

GenerateLegalMovesFast generates legal moves using check and pin masks.

func (*Game) GeneratePseudoMoves

func (g *Game) GeneratePseudoMoves()

Generate all peseudo moves

func (*Game) GetColors

func (g *Game) GetColors() (Color, Color)

Get our color and opponent's

func (*Game) GetMoveSan

func (g *Game) GetMoveSan(m Move) string
  1. moving piece letter(exclude pawn) 1.1 originating file letter of the moving piece 1.2 OR: the originating rank digit of the moving piece 1.3 OR: originating square
  2. if capturing pawn -> include originating file
  3. x for caputures
  4. destination square
  5. PawnPromotion -> "=" followed by promoted piece rune in uppercase

func (*Game) GetMoveSanWithoutSuffix

func (g *Game) GetMoveSanWithoutSuffix(m Move) string

GetMoveSanWithoutSuffix returns the SAN notation for a move without checking for check (+) or checkmate (#). This prevents expensive board cloning and is sufficient for PGN parsing matching.

func (*Game) GetOthersOfSameKindMovingToSameTargetCounts

func (g *Game) GetOthersOfSameKindMovingToSameTargetCounts(themove Move) (otherOfSameKind int, onSameFileCount int, onSameRankCount int)

func (*Game) GetPawns

func (g *Game) GetPawns() (Bitboard, Bitboard)

Get our pawns and opponent's

func (*Game) HalfMoveClock

func (g *Game) HalfMoveClock() int

HalfMoveClock returns the halfmove clock used by the fifty/seventy-five move rules.

func (*Game) IsFivefoldRepetition

func (g *Game) IsFivefoldRepetition() bool

func (*Game) IsFivefoldRepetitionDraw

func (g *Game) IsFivefoldRepetitionDraw() bool

IsFivefoldRepetitionDraw reports whether fivefold repetition makes the game automatically drawn.

func (*Game) IsSeventyFiveMoveRuleDraw

func (g *Game) IsSeventyFiveMoveRuleDraw() bool

IsSeventyFiveMoveRuleDraw reports whether the 75-move rule makes the game automatically drawn.

func (*Game) IsStalemate

func (g *Game) IsStalemate() bool

IsStalemate reports whether the current side to move has no legal moves and is not in check.

func (*Game) IsTerminal

func (g *Game) IsTerminal() bool

IsTerminal reports whether the game is finished.

func (*Game) IsToPromotionRank

func (g *Game) IsToPromotionRank(to Square) bool

func (*Game) LegalMovesInto

func (g *Game) LegalMovesInto(dst []Move) []Move

LegalMovesInto copies legal moves into dst and returns the resulting slice.

func (*Game) LegalMovesList

func (g *Game) LegalMovesList() []Move

LegalMovesList returns a copy of the currently legal moves.

func (*Game) LoadFEN

func (g *Game) LoadFEN(fen string) error

LoadFEN initializes the game from a FEN string and refreshes legal moves and status flags.

func (*Game) LoadFENWithVariant

func (g *Game) LoadFENWithVariant(fen string, variant Variant) error

LoadFENWithVariant initializes the game from FEN using variant-specific parsing and rules.

func (*Game) LoadPGN

func (g *Game) LoadPGN(pgn string) error

LoadPGN loads a PGN string into the board, playing all main-line moves and recording position history via Zobrist hashing. Variations and comments are ignored; only the main line is applied.

func (*Game) MakeMove

func (g *Game) MakeMove(m Move)

func (*Game) MakeMoveFast

func (g *Game) MakeMoveFast(m Move)

MakeMoveFast applies a legal move and regenerates legal moves without updating repetition or game-over status.

It is intended for search/perft-style traversal where callers only need the next legal move list and will undo the move before observing public status flags. Use MakeMove for normal game play.

func (*Game) MarshalBinary

func (g *Game) MarshalBinary() ([]byte, error)

MarshalBinary encodes the board state into a byte slice.

func (*Game) OccupiedSquares

func (g *Game) OccupiedSquares() Bitboard

OccupiedSquares returns the occupied-square bitboard.

func (*Game) PGN

func (g *Game) PGN() string

PGN exports the game as a PGN with tag pairs and main-line movetext.

Example
package main

import (
	"fmt"

	chessongo "github.com/chesshere-com/chess-on-go"
)

func main() {
	game := chessongo.NewGame()
	for _, uci := range []string{"e2e4", "e7e5", "g1f3"} {
		if err := game.TryMoveUCI(uci); err != nil {
			panic(err)
		}
	}

	fmt.Println(game.PGN())

}
Output:
[Event "?"]
[Site "?"]
[Date "????.??.??"]
[Round "?"]
[White "?"]
[Black "?"]
[Result "*"]

1. e4 e5 2. Nf3 *

func (*Game) PGNResult

func (g *Game) PGNResult() string

PGNResult returns the loaded or inferred PGN result.

func (*Game) PGNTags

func (g *Game) PGNTags() map[string]string

PGNTags returns a copy of the PGN tag pairs loaded with the game.

func (*Game) ParseMoveSAN

func (g *Game) ParseMoveSAN(san string) (Move, error)

ParseMoveSAN parses SAN by matching against the current legal move list.

func (*Game) ParseMoveUCI

func (g *Game) ParseMoveUCI(uci string) (Move, error)

ParseMoveUCI parses a UCI move string into a move request.

func (*Game) PieceAt

func (g *Game) PieceAt(square Square) (Piece, bool)

PieceAt returns the piece on square. The bool is false for out-of-range squares.

func (*Game) Pieces

func (g *Game) Pieces(color Color) Bitboard

Pieces returns all occupied squares for color.

func (*Game) PiecesOfKind

func (g *Game) PiecesOfKind(color Color, kind Piece) Bitboard

PiecesOfKind returns all occupied squares for color and piece kind.

func (*Game) PositionKey

func (g *Game) PositionKey() uint64

PositionKey returns the current Zobrist position key.

The key is useful for hash tables and same-version position comparisons. Use FEN when persisting positions across package versions.

func (*Game) PrintBoard

func (g *Game) PrintBoard(title string)

func (*Game) Reset

func (g *Game) Reset()

func (*Game) SEE

func (g *Game) SEE(from, to Square) int

SEE returns the static exchange evaluation of capturing on `to` with the piece currently on `from`, in centipawns from the moving side's perspective. Positive values mean the moving side gains material; negative values mean it loses material after optimal recaptures.

SEE is square-based, not move-based: it derives the moving side's color from the piece on `from`, not from g.SideToMove. Callers passing promotion or en-passant moves supply the move's from/to squares; SEE detects both from the source piece and engine state (g.enPassant, the rank of `to`).

SEE assumes both sides recapture with their cheapest legal attacker until continuing would lose material. It honors absolute pins (precomputed once at entry) and reveals x-ray attackers as front pieces are removed from a working occupancy. Mid-sequence pawn captures that reach the promotion rank receive the Q-P bonus; promotions are always to queen.

SEE does not validate move legality: it does not check that the initial capture is a real legal move, nor does it filter en-passant discovered checks. Callers should only pass moves the engine considers legal in the current position.

Returns 0 (no error, no panic) when either square is out of range or the piece on `from` is empty.

func (*Game) SeedPositionHistory

func (g *Game) SeedPositionHistory(keys []uint64)

SeedPositionHistory appends each Zobrist key in `keys` to the position-history counter, then refreshes the cached game status so any repetition draw triggered by the seeded history is reflected in Status and IsTerminal.

Use it after constructing a Game from FEN to provide the prior position keys needed for threefold and fivefold repetition detection in applications that persist position keys per game (instead of replaying the full PGN on every load).

The current position's key (PositionKey()) is already recorded during the FEN load; pass only the keys of PRIOR positions, in chronological order. Passing an empty or nil slice is a no-op. The halfmove clock and every other board field are untouched — only positionHistory and the derived isThreefoldRepetition / isFinished flags change.

Typical usage:

g, _ := chessongo.NewGameFromFEN(currentFEN)
g.SeedPositionHistory(priorKeysFromDB)
// g.CanClaimThreefoldRepetition() / g.Status() now reflect repetitions
// across the entire game history, not just positions reached on *g.

func (*Game) ShouldIncFullMoves

func (g *Game) ShouldIncFullMoves(m Move) bool

func (*Game) ShouldResetHalfMoves

func (g *Game) ShouldResetHalfMoves(m Move) bool

func (*Game) SideToMove

func (g *Game) SideToMove() Color

SideToMove returns the side whose turn it is.

func (*Game) Snapshot

func (g *Game) Snapshot() GameSnapshot

Snapshot returns a defensive value copy of the current game state.

func (*Game) Status

func (g *Game) Status() GameStatus

Status returns the current game status.

func (*Game) ToFEN

func (g *Game) ToFEN() string

ToFEN returns the FEN representation of the current game state.

func (*Game) TryMove

func (g *Game) TryMove(m Move) error

TryMove applies a move only if it matches one of the current legal moves.

func (*Game) TryMoveFromCoords

func (g *Game) TryMoveFromCoords(from, to string, promotion ...Piece) error

TryMoveFromCoords applies a legal move from algebraic coordinates like "e2", "e4".

func (*Game) TryMoveSAN

func (g *Game) TryMoveSAN(san string) error

TryMoveSAN parses and applies a legal move in standard algebraic notation.

func (*Game) TryMoveUCI

func (g *Game) TryMoveUCI(uci string) error

TryMoveUCI parses and applies a legal move in UCI coordinate notation.

Examples: "e2e4", "e1g1", "a7a8q".

Example
package main

import (
	"fmt"

	chessongo "github.com/chesshere-com/chess-on-go"
)

func main() {
	game := chessongo.NewGame()
	if err := game.TryMoveUCI("e2e4"); err != nil {
		panic(err)
	}

	fmt.Println(game.SideToMove())
	fmt.Println(game.FEN())

}
Output:
black
rnbqkbnr/pppppppp/8/8/4P3/8/PPPP1PPP/RNBQKBNR b KQkq e3 0 1

func (*Game) UndoMove

func (g *Game) UndoMove(m Move)

func (*Game) UndoMoveFast

func (g *Game) UndoMoveFast(m Move)

UndoMoveFast reverses a move made by MakeMoveFast.

func (*Game) UnmarshalBinary

func (g *Game) UnmarshalBinary(data []byte) error

UnmarshalBinary decodes the board state from a byte slice.

func (*Game) Variant

func (g *Game) Variant() Variant

Variant returns the rule variant for this game.

func (*Game) WillMoveCauseCheck

func (g *Game) WillMoveCauseCheck(m Move) bool

func (*Game) Winner

func (g *Game) Winner() Color

Winner reports the winning color for decisive terminal positions, or NO_COLOR.

type GameSnapshot

type GameSnapshot struct {
	FEN            string
	Variant        Variant
	SideToMove     Color
	Board          [64]Piece
	WhitePieces    Bitboard
	BlackPieces    Bitboard
	WhiteByKind    [7]Bitboard
	BlackByKind    [7]Bitboard
	Occupied       Bitboard
	EnPassant      Square
	Castling       CastlingRights
	HalfMoveClock  int
	FullMoveNumber int
	PositionKey    uint64
	LegalMoves     []Move
	Status         GameStatus
	Terminal       bool
	Draw           DrawStatus
}

GameSnapshot is a defensive value copy of the public game state.

type GameState

type GameState struct {
	CapturedPiece    Piece
	Castling         int
	CastlingRookFrom [16]Square
	VariantState     variantState
	EnPassant        Square
	Ply              int
	HalfMoves        int
	FullMoves        int
	ZobristHash      uint64
}

type GameStatus

type GameStatus uint8

GameStatus describes the current terminal/check state of a game.

const (
	GameStatusOngoing GameStatus = iota
	GameStatusCheck
	GameStatusCheckmate
	GameStatusStalemate
	GameStatusDrawInsufficientMaterial
	GameStatusDrawFivefoldRepetition
	GameStatusDrawSeventyFiveMoveRule
	GameStatusVariantWin
)

func (GameStatus) String

func (s GameStatus) String() string

String returns a stable machine-readable status name.

type IllegalMoveError

type IllegalMoveError struct {
	Move     Move
	Notation string
	Reason   IllegalMoveReason
}

IllegalMoveError provides structured context for legal move rejection.

func (*IllegalMoveError) Error

func (e *IllegalMoveError) Error() string

func (*IllegalMoveError) Unwrap

func (e *IllegalMoveError) Unwrap() error

type IllegalMoveReason

type IllegalMoveReason string

IllegalMoveReason identifies why a move request was rejected.

const (
	IllegalMoveReasonNotLegal            IllegalMoveReason = "not legal"
	IllegalMoveReasonNoMatchingLegalMove IllegalMoveReason = "no matching legal move"
)

type Move

type Move uint32

* FROM bits 0-5 * TO bits 6-11 * EnPassant bit 12 * Castling bit 13 * Promotion bits 14 - 16 * CapturedPieceKind bits 17 - 20

func NewCastlingMove

func NewCastlingMove(from, to Square) Move

func NewEnPassantMove

func NewEnPassantMove(from, to Square, captured Piece) Move

func NewMove

func NewMove(from, to Square, captured Piece) Move

func NewMoveFromCoords

func NewMoveFromCoords(from, to string) (Move, error)

NewMoveFromCoords creates a basic move from algebraic coordinates.

func NewMoveFromUCI

func NewMoveFromUCI(uci string) (Move, error)

NewMoveFromUCI creates a move request from UCI coordinate notation.

func NewPromotionMove

func NewPromotionMove(from, to Square, captured Piece, promotionTo Piece) Move

func (Move) From

func (m Move) From() Square

func (Move) GetCapturedPiece

func (m Move) GetCapturedPiece() Piece

func (Move) GetPromotionTo

func (m Move) GetPromotionTo() Piece

func (Move) IsCastlingMove

func (m Move) IsCastlingMove() bool

func (Move) IsEnPassant

func (m Move) IsEnPassant() bool

func (Move) IsPromotingTo

func (m Move) IsPromotingTo(promotingTo string) bool

func (Move) IsPromotionMove

func (m Move) IsPromotionMove() bool

func (Move) To

func (m Move) To() Square

func (Move) ToFromToStrings

func (m Move) ToFromToStrings() (string, string)

func (Move) ToString

func (m Move) ToString() string

func (Move) UCI

func (m Move) UCI() string

UCI returns the move in coordinate notation, including promotion suffix when present.

type Piece

type Piece uint8

func PieceFromRune

func PieceFromRune(r rune) (Piece, bool)

PieceFromRune converts a FEN piece rune into a Piece.

func (Piece) Color

func (p Piece) Color() Color

func (Piece) IsBlack

func (p Piece) IsBlack() bool

func (Piece) IsWhite

func (p Piece) IsWhite() bool

func (Piece) Kind

func (p Piece) Kind() Piece

func (Piece) String

func (p Piece) String() string

String returns the piece name used by ToString.

func (Piece) ToRune

func (p Piece) ToRune() rune

func (Piece) ToString

func (p Piece) ToString() string

type Ray

type Ray struct {
	// contains filtered or unexported fields
}

type SearchBoard

type SearchBoard struct {
	// contains filtered or unexported fields
}

SearchBoard is a lightweight wrapper around Game for search and perft traversal.

It uses fast make/unmake operations and caller-owned move buffers. Status flags such as repetition, checkmate, and draw state are not refreshed during traversal.

func NewSearchBoard

func NewSearchBoard(fen string) (*SearchBoard, error)

NewSearchBoard creates a search board from FEN.

func (*SearchBoard) FEN

func (b *SearchBoard) FEN() string

FEN returns the current board position as FEN.

func (*SearchBoard) LegalMoves

func (b *SearchBoard) LegalMoves(dst []Move) []Move

LegalMoves copies legal moves into dst and returns the resulting slice.

func (*SearchBoard) MakeMove

func (b *SearchBoard) MakeMove(move Move)

MakeMove applies a legal move without refreshing game-over status.

func (*SearchBoard) Perft

func (b *SearchBoard) Perft(depth int) uint64

Perft returns the legal move tree node count at depth.

Example
package main

import (
	"fmt"

	chessongo "github.com/chesshere-com/chess-on-go"
)

func main() {
	board, err := chessongo.NewSearchBoard(chessongo.STARTING_POSITION_FEN)
	if err != nil {
		panic(err)
	}

	fmt.Println(board.Perft(2))

}
Output:
400

func (*SearchBoard) UndoMove

func (b *SearchBoard) UndoMove(move Move)

UndoMove reverses a move made by MakeMove.

type Square

type Square uint8

func CoordsToSquare

func CoordsToSquare(rank, file int) Square

Convert rank, file coordinates to a 64 based square

func ParseSquare

func ParseSquare(coord string) (Square, error)

ParseSquare converts algebraic coordinates like "e4" into a Square.

func ParseUCISquare

func ParseUCISquare(square string) (Square, error)

ParseUCISquare converts a UCI square like "e4" into a Square.

func (Square) Coords

func (s Square) Coords() string

func (Square) File

func (s Square) File() int

get file from square

func (Square) FileLetter

func (s Square) FileLetter() string

func (Square) Rank

func (s Square) Rank() int

get rank from square

func (Square) RankDigit

func (s Square) RankDigit() string

RankDigit returns the rank character ('1'-'8') as a string

func (Square) String

func (s Square) String() string

String returns algebraic coordinates for valid squares, or "-" otherwise.

func (Square) UCI

func (s Square) UCI() string

UCI returns the square in UCI coordinate form.

func (Square) Valid

func (s Square) Valid() bool

Valid reports whether s is a board square.

type Variant

type Variant uint8

Variant identifies the rule set used by a Game.

const (
	VariantStandard Variant = iota
	VariantChess960
	VariantKingOfTheHill
	VariantThreeCheck
	VariantAtomic
	VariantAntichess
	VariantHorde
	VariantCrazyhouse
)

func (Variant) String

func (v Variant) String() string

Directories

Path Synopsis
cmd
chessongo command

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL