ChessPlusPlus  WIP
cplusplus.com Community Project
chesspp::piece::King Class Reference

#include <King.hpp>

Inheritance diagram for chesspp::piece::King:
chesspp::piece::Piece

Public Member Functions

 King (board::Board &b, Position_t const &pos, Suit_t const &s, Class_t const &pc)
 
- Public Member Functions inherited from chesspp::piece::Piece
 Piece (board::Board &b, Position_t const &pos, Suit_t const &s, Class_t const &pc)
 Construct onto a board at the given position with the given suit and class. More...
 
virtual ~Piece ()=default
 
void makeTrajectory ()
 Update movement information. More...
 

Protected Member Functions

virtual void calcTrajectory () override
 Called by makeTrajectory() to calculate movement information. More...
 
- Protected Member Functions inherited from chesspp::piece::Piece
void addTrajectory (Position_t const &tile)
 Mark a position as a valid position to move to without capturing. More...
 
void removeTrajectory (Position_t const &tile)
 Unmark a position as a valid position to move to without capturing. More...
 
void addCapturing (Position_t const &tile)
 Mark a position as a valid position to move to when capturing. More...
 
void removeCapturing (Position_t const &tile)
 Unmark a position as a valid position to move to when capturing. More...
 
void addCapturable (Position_t const &tile)
 Mark a position as a valid position to capture this piece from. More...
 
void removeCapturable (Position_t const &tile)
 Unmark a position as a valid position to capture this piece from. More...
 

Additional Inherited Members

- Public Types inherited from chesspp::piece::Piece
using Position_t = config::BoardConfig::Position_t
 
using Suit_t = config::BoardConfig::SuitClass_t
 
using Class_t = config::BoardConfig::PieceClass_t
 
- Public Attributes inherited from chesspp::piece::Piece
board::Boardboard
 The chesspp::board::Board in which the Piece exists. More...
 
Position_t const & pos = p
 The position of this piece. More...
 
Suit_t const & suit = s
 The display suit of this piece (e.g. Black or White). More...
 
Class_t const & pclass = c
 The display class of this piece (e.g. Pawn, Rook, etc). More...
 
std::size_t const & moves = m
 The number of moves this piece has made. More...
 

Constructor & Destructor Documentation

chesspp::piece::King::King ( board::Board b,
Position_t const &  pos,
Suit_t const &  s,
Class_t const &  pc 
)

Member Function Documentation

void chesspp::piece::King::calcTrajectory ( )
overrideprotectedvirtual

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.

Implements chesspp::piece::Piece.


The documentation for this class was generated from the following files: