1#ifndef _TARTAN_BOARD_EXCEPTIONS_HPP_
2#define _TARTAN_BOARD_EXCEPTIONS_HPP_
4#include <tartan/board.hpp>
20 using logic_error::logic_error;
33 const std::string& what_arg =
"Can not produce piece set"
47 ) :
tartan(what_arg) { e_piece = p; }
68 const std::string what_arg =
"Piece does not exists"
70 const Piece* piece()
const =
delete;
88 const std::string& what_arg =
"Piece does not belong to this board"
89 ) :
bad_piece(p, what_arg) { e_board = b; };
113 const std::string what_arg =
"Invalid piece specification"
133 const std::string& what_arg =
"Piece position is taken"
151 tartan(what_arg), e_piece(p), e_to(
to) {
169 const Piece* e_piece;
187 const std::string& what_arg =
"Selected tile is empty")
189 const Piece* piece() =
delete;
214 const std::string& what_arg =
"Moved piece is in wrong color")
232 const std::string& what_arg =
"Selected piece can't move")
251 const std::string& what_arg =
"Selected piece can't perform such move")
8x8 game board
Definition board.hpp:690
Piece position at the Board.
Definition board.hpp:36
Generic board memeber API.
Definition board.hpp:23
Thrown when Board::piece() can not recognize Piece specification.
Definition exceptions.hpp:105
const std::string & spec() const
Get the malformed spec string.
Definition exceptions.hpp:120
bad_piece_spec(const std::string &spec, const std::string what_arg="Invalid piece specification")
Definition exceptions.hpp:111
Thrown when tt::Board::getPieceType() returns std::type_info that is not mentioned in its argument.
Definition exceptions.hpp:274
Base class for exceptions about pieces.
Definition exceptions.hpp:38
bad_piece(const Piece *p, const std::string &what_arg="Invalid piece")
Definition exceptions.hpp:44
const Piece * piece() const
Get the reported tt::Piece object.
Definition exceptions.hpp:53
Exception when Board::set() functions fail.
Definition exceptions.hpp:30
Thrown when Board::makeMove() is performed on Piece that can not make any moves.
Definition exceptions.hpp:222
can_not_move(const Piece *p, const Piece::Position &to, const std::string &what_arg="Selected piece can't move")
Definition exceptions.hpp:229
Thrown when piece does not belong to Board object in which it is being processed.
Definition exceptions.hpp:77
foreign_piece(const Piece *p, const Board *b, const std::string &what_arg="Piece does not belong to this board")
Definition exceptions.hpp:85
const Board * board() const
Get the Board object.
Definition exceptions.hpp:96
Base class for Board::makeMove() function errors.
Definition exceptions.hpp:141
const Piece * piece() const
Get Piece object.
Definition exceptions.hpp:159
const Piece::Position & to() const
Get move target location.
Definition exceptions.hpp:166
illegal_move(const Piece *p, const Piece::Position &to, const std::string &what_arg="Illegal move")
Definition exceptions.hpp:149
Thrown when constructed Piece::Turn object is malformed.
Definition exceptions.hpp:259
illegal_turn(const std::string &what_arg)
Definition exceptions.hpp:264
Thrown when piece moved with Board::makeMove() can not have such move.
Definition exceptions.hpp:240
no_such_move(const Piece *p, const Piece::Position &to, const std::string &what_arg="Selected piece can't perform such move")
Definition exceptions.hpp:248
Thrown when Piece pointer is nullptr when it should not be.
Definition exceptions.hpp:62
null_piece(const std::string what_arg="Piece does not exists")
Definition exceptions.hpp:67
Thrown when trying to Board::makeMove() on Piece that has wrong Piece::Color.
Definition exceptions.hpp:204
piece_in_wrong_color(const Piece *p, const Piece::Position &to, const std::string &what_arg="Moved piece is in wrong color")
Definition exceptions.hpp:211
Thrown when Piece Position on Board is occupied when it should not to.
Definition exceptions.hpp:129
Base class for all tartan exceptions.
Definition exceptions.hpp:18
Thrown when selected Piece location is empty of the Board.
Definition exceptions.hpp:177
tile_is_empty(const Piece::Position &from, const Piece::Position &to, const std::string &what_arg="Selected tile is empty")
Definition exceptions.hpp:184
const Piece::Position & from() const
Get empli tile Position.
Definition exceptions.hpp:195
Tartan tt::Board exceptions set.
Definition exceptions.hpp:9