From f208e7b0b9454d1f62d930be23e629334e35ed68 Mon Sep 17 00:00:00 2001 From: Bendik Samseth Date: Thu, 31 Oct 2024 21:12:22 +0100 Subject: [PATCH] Add castle rights Will probably add a bunch of convenience methods here, but for now this is just a plain enum. --- goldchess/src/castlerights.rs | 8 ++++++++ goldchess/src/lib.rs | 2 ++ 2 files changed, 10 insertions(+) create mode 100644 goldchess/src/castlerights.rs diff --git a/goldchess/src/castlerights.rs b/goldchess/src/castlerights.rs new file mode 100644 index 0000000..fef9331 --- /dev/null +++ b/goldchess/src/castlerights.rs @@ -0,0 +1,8 @@ +/// Represent what castling rights are available to a player. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum CastleRights { + None, + KingSide, + QueenSide, + Both, +} diff --git a/goldchess/src/lib.rs b/goldchess/src/lib.rs index 9b54b29..34b18b6 100644 --- a/goldchess/src/lib.rs +++ b/goldchess/src/lib.rs @@ -7,6 +7,7 @@ //! This is a library useful for writing chess engines in Rust. Its primary reason to exist is to //! support the [Goldfish](https://github.com/bsamseth/goldfish) chess engine, but very well might be useful for other projects as well. mod bitboard; +mod castlerights; mod color; mod error; mod file; @@ -16,6 +17,7 @@ mod rank; mod square; pub use bitboard::Bitboard; +pub use castlerights::CastleRights; pub use color::Color; pub use error::{Error, Result}; pub use file::File;