Struct chess::Board [] [src]

pub struct Board { /* fields omitted */ }

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

Methods

impl Board
[src]

Construct a new Board that is completely empty. Note: This does NOT give you the initial position. Just a blank slate.

Construct a board from a FEN string.

Is this game Ongoing, is it Stalemate, or is it Checkmate?

Grab the "combined" BitBoard. This is a BitBoard with every piece.

Grab the "color combined" BitBoard. This is a BitBoard with every piece of a particular color.

Give me the Square the color king is on.

Grab the "pieces" BitBoard. This is a BitBoard with every piece of a particular type.

Grab the CastleRights for a particular side.

Add castle rights for a particular side.

Remove castle rights for a particular side.

Who's turn is it?

Grab my CastleRights.

Add to my CastleRights.

Remove some of my CastleRights.

My opponents CastleRights.

Add to my opponents CastleRights.

Remove some of my opponents CastleRights.

For a chess UI: set a piece on a particular square.

For a chess UI: clear a particular square.

Switch the color of the player without actually making a move.

Does this board "make sense"? Do all the pieces make sense, do the bitboards combine correctly, etc? This is for sanity checking.

Get a hash of the board.

Get a pawn hash of the board (a hash that only changes on color change and pawn moves).

What piece is on a particular Square? Is there even one?

Give me all the legal moves for this board.

Note: You may want to build a MoveGen structure to iterate over the moves instead.

Give me the en_passant square, if it exists.

Is a particular move legal?

This function checks the legality only for moves generated by MoveGen.

Calling this function for moves not generated by MoveGen will result in possibly incorrect results, and making that move on the Board will result in undefined behavior. This function may panic! if these rules are not followed.

If you are validating a move from a user, you should call the .legal() function.

Make a chess move.

panic!() if king is captured.

Run a perft-test.

Run a perft-test using brute force move generation.

Run a perft test with a cache table.

Give me the BitBoard of my pinned pieces.

Give me the Bitboard of the pieces putting me in check.

Is a particular king move legal?

Is a particular en-passant capture legal?

Run every type of perft test, and panic! if the leaf-node count of any version is not equal to result.

Trait Implementations

impl Copy for Board
[src]

impl Clone for Board
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl Display for Board
[src]

Formats the value using the given formatter. Read more