use viktoe-chess::prelude::*;
let game = ChessGame::default();
let game_state = GameState::Ongoing;
while (matches!(game_state, GameState::CheckMate)) {
let space_to_move_from = BoardPosition::from((E, Two));
let moves = game.get_valid_moves(&space_to_move_from);
let space_to_move_to = BoardPosition::from((E, Four));
game_state = game.move_piece(space_to_move_from, space_to_move_to)
if matches!(game_state, Promotion(_)) {
let promotion_target = Piece::Queen;
game_state = game.promote_pawn(promotion_target);
}
}
Documentation is aquired by cloning the repo and running cargo doc --open
- Normal moves
- King
- Queen
- Bishop
- Knight
- Rook
- Pawn
- Check
- Checkmate
- Board repetition
- 50-move rule
- No mating pieces
- Patt
- Castling
- Niether the king or the rook has moved
- There is no piece between the king and the rook
- The king does not move over a threatend piece
- The king is not in check when begining the move
- En passant
- Promotion