Crate chess [] [src]

Rust Chess Library

This is a chess move generation library for rust. It is designed to be fast, so that it can be used in a chess engine or UI without performance issues.

Structs

BitBoard

A good old-fashioned bitboard You do not have access to the actual value. You do have access to operators

Board

A representation of a chess board. That's why you're here, right?

CacheTable

Store a cache of entries, each with an associated hash.

ChessMove

Represent a ChessMove in memory

MoveGen

The move generation iterator

Square

Represent a square on the chess board

Enums

BoardStatus

What is the status of this game?

CastleRights

What castle rights does a particular player have?

Color

Represent a color.

File

Describe a file (column) on a chess board

Piece

Represent a chess piece as a very simple enum

Rank

Describe a rank (row) on a chess board

Constants

ALL_CASTLE_RIGHTS

Enumerate all castle rights.

ALL_COLORS

List all colors

ALL_FILES

Enumerate all files

ALL_PIECES

An array representing each piece type, in order of ascending value.

ALL_RANKS

Enumerate all ranks

ALL_SQUARES

A list of every square on the chessboard.

EMPTY

An empty bitboard

NUM_CASTLE_RIGHTS

How many different types of CastleRights are there?

NUM_COLORS

How many colors are there?

NUM_FILES

How many files are there?

NUM_PIECES

How many piece types are there?

NUM_PROMOTION_PIECES

How many ways can I promote?

NUM_RANKS

How many ranks are there?

NUM_SQUARES

How many squares are there?

PROMOTION_PIECES

What pieces can I promote to?

Functions

between

Get a line between these two squares, not including the squares themselves.

construct

Call before using any objects within this library. Must be called at least once. Can be called more than once, and is thread safe.

get_adjacent_files

Get a BitBoard that represents the squares on the 1 or 2 files next to this file.

get_bishop_moves

Get the moves for a bishop on a particular square, given blockers blocking my movement.

get_bishop_rays

Get the rays for a bishop on a particular square.

get_file

Get a BitBoard that represents all the squares on a particular file.

get_king_moves

Get the king moves for a particular square.

get_knight_moves

Get the knight moves for a particular square.

get_pawn_attacks

Get the pawn capture move for a particular square, given the pawn's color and the potential victims

get_pawn_moves

Get all the pawn moves for a particular square, given the pawn's color and the potential blocking pieces and victims.

get_pawn_quiets

Get the quiet pawn moves (non-captures) for a particular square, given the pawn's color and the potential blocking pieces.

get_rank

Get a BitBoard that represents all the squares on a particular rank.

get_rook_moves

Get the moves for a rook on a particular square, given blockers blocking my movement.

get_rook_rays

Get the rays for a rook on a particular square.

line

Get a line (extending to infinity, which in chess is 8 squares), given two squares. This line does extend past the squares.