From 159d5334128ff0bb90a8e4e85739dc8bc44baad8 Mon Sep 17 00:00:00 2001 From: Loic Guegan Date: Sun, 30 Jan 2022 10:00:28 +0100 Subject: - Add drawing methods to the API - Improve tests --- src/ChessArbiter.hpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'src/ChessArbiter.hpp') diff --git a/src/ChessArbiter.hpp b/src/ChessArbiter.hpp index 5739904..488ca7c 100644 --- a/src/ChessArbiter.hpp +++ b/src/ChessArbiter.hpp @@ -1,6 +1,7 @@ #include "Board.hpp" #include "Fen.hpp" #include +#include namespace chessarbiter { class ChessArbiter { @@ -8,12 +9,15 @@ class ChessArbiter { FEN fen; FEN fen_last; // To undo a move int wPawn, wRook, wKnight, wBishop, wQueen, wKing; + /// @brief Use to compute occurences of positions + std::unordered_map positions; + /// @brief FEN methods used internally + void SetFEN(std::string); + void SetFEN(FEN); public: ChessArbiter(); void Setup(std::string); - void SetFEN(std::string); - void SetFEN(FEN); std::string GetFEN(); /// @brief Check which player is going to play bool IsBlackTurn(); @@ -27,7 +31,7 @@ public: std::string GetBoard(); /// @brief Get current position evaluation according to player's material int GetMaterialScore(); - /// @brief Check if position is legal + /// @brief Check if position is legal to be played bool IsPlayable(); /// @brief Get pieces captures by a player std::string GetCaptures(bool); @@ -36,5 +40,10 @@ public: /// @brief Check if a specific castle is possible by a player bool IsCastlePossible(bool, bool); bool IsCheckMate(); + /// @brief Draws check + bool IsDrawByFiftyMoveRule(); + bool IsDrawByNoMoves(); + bool IsDrawByRepetitions(); + bool IsDraw(); }; } // namespace chessarbiter \ No newline at end of file -- cgit v1.2.3