A chess piece.
More...
#include <Piece.hpp>
Construct onto a board at the given position with the given suit and class.
- Parameters
-
b | The chesspp::board::Board on which this piece is to live, must outlive this instance. |
pos | The initial position of this piece. |
s | The display suit of the piece. |
pc | The display class of the piece. |
virtual chesspp::piece::Piece::~Piece |
( |
| ) |
|
|
virtualdefault |
void chesspp::piece::Piece::addCapturable |
( |
Position_t const & |
tile | ) |
|
|
protected |
Mark a position as a valid position to capture this piece from.
- Parameters
-
tile | The position to mark. |
void chesspp::piece::Piece::addCapturing |
( |
Position_t const & |
tile | ) |
|
|
protected |
Mark a position as a valid position to move to when capturing.
- Parameters
-
tile | The position to mark. |
void chesspp::piece::Piece::addTrajectory |
( |
Position_t const & |
tile | ) |
|
|
protected |
Mark a position as a valid position to move to without capturing.
- Parameters
-
tile | The position to mark. |
virtual void chesspp::piece::Piece::calcTrajectory |
( |
| ) |
|
|
protectedpure virtual |
Called by makeTrajectory()
to calculate movement information.
Implementations should call addTrajectory()
, addCapturing()
, and addCapturable()
, as well as their remove
counterparts if necessary. By default, addCapturable()
is called with the current position of the piece before this member function is called.
Implemented in chesspp::piece::Pawn, chesspp::piece::Archer, chesspp::piece::Bishop, chesspp::piece::King, chesspp::piece::Knight, chesspp::piece::Queen, and chesspp::piece::Rook.
void chesspp::piece::Piece::makeTrajectory |
( |
| ) |
|
|
inline |
Update movement information.
- Note
- Should not be overridden or shadowed by deriving classes.
void chesspp::piece::Piece::removeCapturable |
( |
Position_t const & |
tile | ) |
|
|
protected |
Unmark a position as a valid position to capture this piece from.
- Parameters
-
tile | The position to mark. |
void chesspp::piece::Piece::removeCapturing |
( |
Position_t const & |
tile | ) |
|
|
protected |
Unmark a position as a valid position to move to when capturing.
- Parameters
-
tile | The position to unmark. |
void chesspp::piece::Piece::removeTrajectory |
( |
Position_t const & |
tile | ) |
|
|
protected |
Unmark a position as a valid position to move to without capturing.
- Parameters
-
tile | The position to unmark. |
std::ostream& operator<< |
( |
std::ostream & |
os, |
|
|
Piece const & |
p |
|
) |
| |
|
friend |
Outputs a basic human-readable description of this piece to an output stream.
- Parameters
-
os | The stream to which to describe this piece. |
p | The piece to describe. |
std::size_t const& chesspp::piece::Piece::moves = m |
The number of moves this piece has made.
Class_t const& chesspp::piece::Piece::pclass = c |
The display class of this piece (e.g. Pawn, Rook, etc).
- Note
- This cannot be used to determine what kind of piece this is, as this value is only for display purposes and may not match the actual type.
The position of this piece.
Suit_t const& chesspp::piece::Piece::suit = s |
The display suit of this piece (e.g. Black or White).
The documentation for this class was generated from the following files: