Skip to content

INDA24PlusPlus/viktoe-chess

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 

Repository files navigation

viktoe-chess

Example

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

Documentation is aquired by cloning the repo and running cargo doc --open

Rules implemented

  • 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

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages