pieces

package
v0.0.0-...-1a8bede Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Overview

Move generation

Index

Constants

View Source
const (
	PAWN     = uint8(0)
	KNIGHT   = uint8(1)
	BISHOP   = uint8(2)
	ROOK     = uint8(3)
	QUEEN    = uint8(4)
	KING     = uint8(5)
	NO_PIECE = uint8(9)

	MAX_PHASE = 1024
)

Variables

This section is empty.

Functions

func GetAllCaptures

func GetAllCaptures(cb *board.Board) []board.Move

Return slice of all pseudo-legal captures for color cb.WToMove, where any king moves are strictly legal. However, if the king is in check, only legal moves are returned

func GetAllMoves

func GetAllMoves(cb *board.Board) []board.Move

Return slice of all pseudo-legal moves for color cb.WToMove, where any king moves are strictly legal. However, if the king is in check, only legal moves are returned

func GetAttackedSquares

func GetAttackedSquares(cb *board.Board) uint64

Return the set of squares attacked by color cb.WToMove

func GetCheckingSquares

func GetCheckingSquares(cb *board.Board) (uint64, int)

Return the set of squares of pieces checking the king and interposition squares, and the number of checking pieces.

func GetKingMoves

func GetKingMoves(square int8, oppAttackedSquares uint64, cb *board.Board) uint64

Return legal king moves.

func GetPawnMoves

func GetPawnMoves(square int8, cb *board.Board) uint64

func IsValidMove

func IsValidMove(from, to int8, pieceType uint8, cb *board.Board) bool

Use for user-submitted moves only? Checks for blocking pieces and disallows captures of friendly pieces. Does not consider check, pins, or legality of a pawn movement direction.

func MovePiece

func MovePiece(move board.Move, cb *board.Board)

Types

This section is empty.

Jump to

Keyboard shortcuts

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