Crate chess_move_gen [] [src]

chess_move_gen

Provides structs and methods for generating chess moves efficiently

Example usage:

use chess_move_gen::*;
init_all();
let mut list = MoveVec::new();
let board = &Board::from_fen("rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w QqKk - 0 1").unwrap();
legal_moves::<MoveVec>(board, &mut list);
assert_eq!(list.len(), 20);

Reexports

pub use bb::BB;

Modules

bb

Structs

Board

Board encodes all positional information and non-positional game state

Castle

Represents a castleove

CastlingRights

Represents the right to castle in a particular director for a particular side

Kind

Represents a kind of piece (eg knight)

Move

Represents a move on the chess board. Uses a compact 16 bit representation

MoveCounter

MoveCounter implements MoveList and keeps a count of different types of moves added to it. It can count at most 256 moves since it uses u8 internally

MoveVec

MoveCounter implements MoveList and collects moves in a vector. Use iter to access the moves once they have been added.

Piece

Represents a piece for a particular side (eg black knight)

PiecesIter
Side

Represents a side to move

Square

Represents a square on the chessboard

State

State encodes all game state except position

Constants

BISHOP
BLACK
BLACK_BISHOP
BLACK_KING
BLACK_KNIGHT
BLACK_KS
BLACK_PAWN
BLACK_QS
BLACK_QUEEN
BLACK_ROOK
KING
KING_SIDE
KNIGHT
PAWN
QUEEN
QUEEN_SIDE
ROOK
STARTING_POSITION_FEN
WHITE
WHITE_BISHOP
WHITE_KING
WHITE_KNIGHT
WHITE_KS
WHITE_PAWN
WHITE_QS
WHITE_QUEEN
WHITE_ROOK

Traits

MoveList

MoveList represents a way to collect moves from move generation functions. Use this if you want to collect or record moves in a way not supported by MoveVec or MoveCounter

Functions

init_all
legal_moves

Adds legal moves to the provided MoveList. Returns true if mover is in check

Type Definitions

Internal