tartan 1.2.2.1
Chess API
Loading...
Searching...
No Matches
tt::chess::Pawn::Turn Class Reference

Pawn Turn. More...

#include <chess.hpp>

Inheritance diagram for tt::chess::Pawn::Turn:
[legend]
Collaboration diagram for tt::chess::Pawn::Turn:
[legend]

Public Member Functions

bool isEqual (const Piece::Turn &) const override
 Compare turns.
 
virtual void apply (int mode=0) override
 Apply turn.
 
const std::type_indexpromoteTo () const
 Get prometion Piece type.
 
- Public Member Functions inherited from tt::Piece::Turn
 Turn (const Piece *tpiece, const Position &to, const Piece *cap=nullptr, bool possible=true)
 Construct new Turn object.
 
Position to () const
 Position where piece will end up after turn.
 
Position from () const
 Position the turn is started at.
 
const Piecepiece () const
 Turn Piece.
 
Piecepiece ()
 Turn Piece.
 
const Piececapture () const
 Captured piece.
 
Piececapture ()
 Captured piece.
 
bool possible () const
 Turn viability.
 
bool setPossible (bool c)
 Set the turn viability.
 
virtual std::string str () const
 String Turn representation.
 
virtual void undo ()
 Undo turn.
 
virtual auto clone () const -> std::decay< decltype(*this)>::type *
 Clone current Turn.
 

Additional Inherited Members

- Protected Attributes inherited from tt::Piece::Turn
Position t_from
 Turn piece starting position
 
Position t_to
 Turn piece finishing position
 
Piecet_piece
 Turn Piece inself
 
Piecet_capture
 Piece that is captured as the resul of turn.
 
bool t_possible
 Turn viability.
 

Detailed Description

Pawn Turn.

Accomodates Piece::Turn for Pawn promotion logic.

Member Function Documentation

◆ apply()

virtual void tt::chess::Pawn::Turn::apply ( int  mode = 0)
overridevirtual

Apply turn.

Applies current turn. Should be reimplemented in child Piece class if it have to do something special on move.

This does the next:

You can define unscoped enum and use it with this fucntion to perform different applying logic on demand.

Parameters
modeoptional apply mode parameter

Reimplemented from tt::Piece::Turn.

◆ isEqual()

bool tt::chess::Pawn::Turn::isEqual ( const Piece::Turn rhs) const
overridevirtual

Compare turns.

Should be reimplemented in child Piece class if it's Turn logic differs.

Parameters
rhsTurn object compare to
Returns
true if rhs turn is the same as current object

Reimplemented from tt::Piece::Turn.

◆ promoteTo()

const std::type_index & tt::chess::Pawn::Turn::promoteTo ( ) const
inline

Get prometion Piece type.

Used on Pawn promotion Turn

Returns
type of Piece that that the Pawn were promoted to

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