From e9d328acf4ee45bd8771d422fa4db40298e6e16a Mon Sep 17 00:00:00 2001 From: Loic Guegan Date: Sat, 29 Jan 2022 11:52:47 +0100 Subject: Init project --- src/Board.hpp | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 src/Board.hpp (limited to 'src/Board.hpp') diff --git a/src/Board.hpp b/src/Board.hpp new file mode 100644 index 0000000..aee2e10 --- /dev/null +++ b/src/Board.hpp @@ -0,0 +1,44 @@ +#include "Piece.hpp" +#include +#include +#include +#include + +namespace chessarbiter { + +class Board { + std::vector pieces; + +public: + /// @brief Check if a square is empty + bool IsEmpty(std::string); + /// @brief Add a piece (no checks are performed on coord) + bool AddPiece(char p, std::string); + /// @brief Remove a piece from a square + bool RemovePiece(std::string); + /// @brief Get piece at a specific coordinate + Piece GetPieceAt(std::string); + /// @brief Get the pieces of a player + std::vector GetPlayerPieces(bool); + /// @brief Count the number of a specific piece on the board + short CountPiece(char); + /// @brief Get the location of the first king found on the board + std::string GetKingLocation(bool); + /// @brief Check if a move is technically possible (does not means it is + /// legal) + bool IsMovePossible(std::string); + /// @brief Clear the board + void Clear(); + /// @brief Move a piece somewhere no matter what + void Move(std::string); + /// @brief Get a serialize version of the board + std::string Serialize(); + /// @brief List all the technically possible moves of a player + std::vector ListPossibleMoves(bool); +}; + +struct NoPieceFound : public std::exception { + const char *what() const throw() { return "No piece found"; } +}; + +} // namespace chessarbiter \ No newline at end of file -- cgit v1.2.3