diff options
| author | Loic Guegan <manzerbredes@mailbox.org> | 2022-01-29 11:52:47 +0100 |
|---|---|---|
| committer | Loic Guegan <manzerbredes@mailbox.org> | 2022-01-29 11:52:47 +0100 |
| commit | e9d328acf4ee45bd8771d422fa4db40298e6e16a (patch) | |
| tree | 68a86c53539fe57b434c49555feafac9081f75e0 /src/Board.hpp | |
Init project
Diffstat (limited to 'src/Board.hpp')
| -rw-r--r-- | src/Board.hpp | 44 |
1 files changed, 44 insertions, 0 deletions
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 <algorithm> +#include <exception> +#include <iostream> +#include <string> + +namespace chessarbiter { + +class Board { + std::vector<Piece> 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<Piece> 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<std::string> ListPossibleMoves(bool); +}; + +struct NoPieceFound : public std::exception { + const char *what() const throw() { return "No piece found"; } +}; + +} // namespace chessarbiter
\ No newline at end of file |
