Belofte version 2.1.8
A promising chess program using the UCI or Winboard interface
bPieceColour Class Referenceabstract

#include <piece.h>

+ Inheritance diagram for bPieceColour:

Public Member Functions

 bPieceColour (side_t s)
 
virtual ~bPieceColour ()
 
 bPieceColour (bPieceColour const &)=delete
 
 bPieceColour (bPieceColour &&)=delete
 
bPieceColouroperator= (bPieceColour const &)=delete
 
bPieceColouroperator= (bPieceColour &&)=delete
 
bool isWhite () const
 
bool isBlack () const
 
bool isEmpty () const
 
side_t invert ()
 
side_t opponent () const
 
side_t toMove () const
 
virtual bool isAttacked (bBoard const &b, case_t const &cf) const =0
 
virtual bool canMovePreflightCheck (bBoard &b, case_t const &cf, int8_t const ri, int8_t const ci) const =0
 
virtual bool canMovePreflightCheck (bBoard &b, case_t const &cf, int8_t const ri, int8_t const ci, piece_t const cPromotion) const =0
 
virtual movenum_t addMove (bBoard const &b, case_t const &cf, int8_t const ri, int8_t const ci, bMoveList &ml) const =0
 
virtual movenum_t addMoves (bBoard const &b, case_t const &cf, int8_t const ri, int8_t const ci, bMoveList &ml) const =0
 

Protected Member Functions

bool isAttackedByPiece (bBoard const &b, column_t const fromcol, rank_t const fromrank, piece_t const cPiece, int8_t const ri, int8_t const ci) const
 Return true if position is attacked by opponent respecting move offsets.
 
bool isAttackedBySlider (bBoard const &b, column_t const fromcol, rank_t const fromrank, piece_t const cPiece, piece_t const cPiece2, int8_t const ri, int8_t const ci) const
 Return true if position is attacked by opponent respecting move offsets.
 

Protected Attributes

side_t m_side = tSide::SIDE_UNDEFINED
 

Detailed Description

Definition at line 130 of file piece.h.

Constructor & Destructor Documentation

◆ bPieceColour() [1/3]

bPieceColour::bPieceColour ( side_t  s)
explicit

Definition at line 221 of file piece.cpp.

◆ ~bPieceColour()

bPieceColour::~bPieceColour ( )
virtual

Definition at line 226 of file piece.cpp.

◆ bPieceColour() [2/3]

bPieceColour::bPieceColour ( bPieceColour const &  )
delete

◆ bPieceColour() [3/3]

bPieceColour::bPieceColour ( bPieceColour &&  )
delete

Member Function Documentation

◆ operator=() [1/2]

bPieceColour & bPieceColour::operator= ( bPieceColour const &  )
delete

◆ operator=() [2/2]

bPieceColour & bPieceColour::operator= ( bPieceColour &&  )
delete

◆ isWhite()

bool bPieceColour::isWhite ( ) const
inline

Definition at line 141 of file piece.h.

Referenced by invert(), and opponent().

+ Here is the caller graph for this function:

◆ isBlack()

bool bPieceColour::isBlack ( ) const
inline

Definition at line 142 of file piece.h.

Referenced by toMove().

+ Here is the caller graph for this function:

◆ isEmpty()

bool bPieceColour::isEmpty ( ) const
inline

Definition at line 143 of file piece.h.

◆ invert()

side_t bPieceColour::invert ( )
inline

Definition at line 145 of file piece.h.

+ Here is the call graph for this function:

◆ opponent()

side_t bPieceColour::opponent ( ) const
inline

Definition at line 149 of file piece.h.

+ Here is the call graph for this function:

◆ toMove()

side_t bPieceColour::toMove ( ) const
inline

Definition at line 152 of file piece.h.

+ Here is the call graph for this function:

◆ isAttacked()

virtual bool bPieceColour::isAttacked ( bBoard const &  b,
case_t const &  cf 
) const
pure virtual

Implemented in bEmptyPiece, bWhitePiece, and bBlackPiece.

◆ canMovePreflightCheck() [1/2]

virtual bool bPieceColour::canMovePreflightCheck ( bBoard b,
case_t const &  cf,
int8_t const  ri,
int8_t const  ci 
) const
pure virtual

Implemented in bEmptyPiece, bWhitePiece, and bBlackPiece.

◆ canMovePreflightCheck() [2/2]

virtual bool bPieceColour::canMovePreflightCheck ( bBoard b,
case_t const &  cf,
int8_t const  ri,
int8_t const  ci,
piece_t const  cPromotion 
) const
pure virtual

Implemented in bEmptyPiece, bWhitePiece, and bBlackPiece.

◆ addMove()

virtual movenum_t bPieceColour::addMove ( bBoard const &  b,
case_t const &  cf,
int8_t const  ri,
int8_t const  ci,
bMoveList ml 
) const
pure virtual

Implemented in bWhitePiece, bBlackPiece, and bEmptyPiece.

◆ addMoves()

virtual movenum_t bPieceColour::addMoves ( bBoard const &  b,
case_t const &  cf,
int8_t const  ri,
int8_t const  ci,
bMoveList ml 
) const
pure virtual

Implemented in bWhitePiece, bBlackPiece, and bEmptyPiece.

◆ isAttackedByPiece()

bool bPieceColour::isAttackedByPiece ( bBoard const &  b,
column_t const  fromcol,
rank_t const  fromrank,
piece_t const  cPiece,
int8_t const  ri,
int8_t const  ci 
) const
protected

Return true if position is attacked by opponent respecting move offsets.

Parameters
bboard
fromcolfield from
fromrankfield from
cPieceattacking piece
rirow increment
cicol increment
Returns
true/false

Definition at line 359 of file piece.cpp.

Referenced by bWhitePiece::isAttacked(), and bBlackPiece::isAttacked().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isAttackedBySlider()

bool bPieceColour::isAttackedBySlider ( bBoard const &  b,
column_t const  fromcol,
rank_t const  fromrank,
piece_t const  cPiece,
piece_t const  cPiece2,
int8_t const  ri,
int8_t const  ci 
) const
protected

Return true if position is attacked by opponent respecting move offsets.

Parameters
bboard
fromcolfield from
fromrankfield from
cPiecefirst possible piece (rook/bishop)
cPiece2second possible piece (queen)
rirow increment
cicol increment
Returns
true/false

Definition at line 377 of file piece.cpp.

Referenced by bWhitePiece::isAttacked(), and bBlackPiece::isAttacked().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ m_side

side_t bPieceColour::m_side = tSide::SIDE_UNDEFINED
protected

Definition at line 176 of file piece.h.

Referenced by invert(), isBlack(), isEmpty(), and isWhite().