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

#include <Pawn.hpp>

Inheritance diagram for chesspp::piece::Pawn:
chesspp::piece::Piece

Public Member Functions

 Pawn (board::Board &b, Position_t const &pos, Suit_t const &s, Class_t const &pc, util::Direction const &face)
 
virtual void tick (Position_t const &p) override
 Called when another piece moves on the same board. More...
 
- 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::Pawn::Pawn ( board::Board b,
Position_t const &  pos,
Suit_t const &  s,
Class_t const &  pc,
util::Direction const &  face 
)

Member Function Documentation

void chesspp::piece::Pawn::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.

void chesspp::piece::Pawn::tick ( Position_t const &  m)
overridevirtual

Called when another piece moves on the same board.

Parameters
mThe position of the piece that moved.

Reimplemented from chesspp::piece::Piece.


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