chess

package
v0.0.0-...-fa77049 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const BISHOP uint8 = 1 << 3
View Source
const B_BISHOP uint8 = BISHOP | COLOR_BLACK
View Source
const B_KING uint8 = KING | COLOR_BLACK
View Source
const B_KNIGHT uint8 = KNIGHT | COLOR_BLACK
View Source
const B_PAWN uint8 = PAWN | COLOR_BLACK
View Source
const B_QUEEN uint8 = QUEEN | COLOR_BLACK
View Source
const B_ROOK uint8 = ROOK | COLOR_BLACK
View Source
const COLOR_BLACK uint8 = 1 << 7
View Source
const COLOR_WHITE uint8 = 1 << 6
View Source
const EMPTY uint8 = 0
View Source
const File = "abcdefgh"
View Source
const INVALID_MOVE uint8 = 255
View Source
const KING uint8 = 1 << 0
View Source
const KNIGHT uint8 = 1 << 4
View Source
const PAWN uint8 = 1 << 5
View Source
const QUEEN uint8 = 1 << 1
View Source
const ROOK uint8 = 1 << 2
View Source
const Rank = "12345678"
View Source
const W_BISHOP uint8 = BISHOP | COLOR_WHITE
View Source
const W_KING uint8 = KING | COLOR_WHITE
View Source
const W_KNIGHT uint8 = KNIGHT | COLOR_WHITE
View Source
const W_PAWN uint8 = PAWN | COLOR_WHITE
View Source
const W_QUEEN uint8 = QUEEN | COLOR_WHITE
View Source
const W_ROOK uint8 = ROOK | COLOR_WHITE

Variables

Functions

func Attacks

func Attacks(board []uint8, color uint8, enPassant []uint8) []uint8

func CmdExperiment

func CmdExperiment(c *cli.Context) error

func CmdPerft

func CmdPerft(c *cli.Context) error

func CmdPerftDivide

func CmdPerftDivide(c *cli.Context) error

func CmdPieces

func CmdPieces(c *cli.Context) error

func ColorCode

func ColorCode(color string) uint8

func ColorName

func ColorName(color uint8) string

func Contains

func Contains(arr []uint8, v uint8) bool

func DebugAttacks

func DebugAttacks(list []uint8) string

func DebugBoard

func DebugBoard(board []uint8) string

func DebugGame

func DebugGame(game Game) string

func DebugHash

func DebugHash(board []uint8) int

func DebugMove

func DebugMove(move *Move) string

func DebugMoves

func DebugMoves(board []uint8, depth int, color uint8, enpassant []uint8) string

func DebugPerft

func DebugPerft(depth int) string

func DebugPerftDivide

func DebugPerftDivide(depth int) string

func DebugPos

func DebugPos(i uint8) string

func MakeMove

func MakeMove(board []uint8, move *Move) []uint8

func PieceCode

func PieceCode(piece string) uint8

func PieceName

func PieceName(piece uint8) string

func PosCode

func PosCode(pos string) uint8

func Save

func Save(game Game) string

func UndoMove

func UndoMove(board []uint8, move *Move) []uint8

Types

type Game

type Game struct {
	Board                []uint8
	Color                uint8
	WhiteCastleKingSide  bool
	WhiteCastleQueenSide bool
	BlackCastleKingSide  bool
	BlackCastleQueenSide bool
	EnPassant            uint8
	Halfmove             int
	Fullmove             int
}

func Load

func Load(fen string) Game

type Move

type Move struct {
	Piece     uint8
	Prev      uint8
	From      uint8
	To        uint8
	EnPassant uint8
}

func Generate

func Generate(board []uint8, color uint8, enPassant []uint8) []*Move

type PerftDivideResult

type PerftDivideResult struct {
	Move  *Move
	Nodes int
}

func PerftDivide

func PerftDivide(depth int) []PerftDivideResult

type PerftResult

type PerftResult struct {
	Nodes      int
	Captures   int
	EnPassant  int
	Castles    int
	Promotions int
	Checks     int
	Checkmates int
}

func Perft

func Perft(depth int) PerftResult

Jump to

Keyboard shortcuts

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