Expand description

Author: Vilhelm Prytz vilhelm@prytznet.se or vprytz@kth.se

This is a chess library written in Rust. It is a work in progress and is not yet ready for use.

Usage

Functions

FunctionDescription
pub fn new() -> GameInitialises a new board with pieces.
pub fn make_move(&mut self, from: String, to: String) -> Option<GameState>If the current game state is InProgress and the move is legal, move a piece and return the resulting state of the game.
Not yet implemeted pub fn set_promotion(&mut self, piece: String) -> ()Set the piece type that a peasant becames following a promotion.
pub fn get_game_state(&self) -> GameStateGet the current game state.
pub fn get_possible_moves(&self, position: String) -> Optional<Vec<String>>If a piece is standing on the given tile, return all possible new positions of that piece. Don’t forget to the rules for check. (optional) Don’t forget to include en passent and castling.

Generate this README

You need cargo-readme to generate this README.

cargo readme > README.md

Structs

Represents a chess game, holding a board (2d array with all pieces) and the current state of the game. A new game can be created by calling the new() function.
Represents a piece on the board. A piece has a color, a type and a variable that tells if it has moved at least once or not. A piece can be moved by calling the make_move() function.

Enums

Possible colors for pieces is represented using this enum.
Possible states of the game is represented using this enum.