Belofte version 2.1.9
A promising chess program using the UCI or Winboard interface
bWhitePiece Class Reference

#include <piece.h>

+ Inheritance diagram for bWhitePiece:
+ Collaboration diagram for bWhitePiece:

Public Member Functions

 bWhitePiece ()
 
 ~bWhitePiece () override
 
bool canMovePreflightCheck (bBasicBoard &b, case_t const &cf, case_t const &ct) const override
 Check if any could be added by just checking there.
 
bool canMovePreflightCheck (bBasicBoard &b, case_t const &cf, int8_t const ri, int8_t const ci, uint_fast8_t nMax=1) const override
 Check if any could be added by just checking there is not check, break on first.
 
bool canPawnMovePreflightCheck (bBasicBoard &b, case_t const &cf, int8_t const ri, int8_t const ci) const override
 Check if pawn move could be added by just checking there is not check, case of possible promotion.
 
bool isAttacked (bBasicBoard const &b, case_t const &cf) const override
 Check if piece on position is attacked, start with piece always on board and then with pieces with greatest mobility, goal is to break out asap.
 
movenum_t addMove (bBasicBoard const &b, case_t const &cf, case_t const &ct, bMoveList &ml) const override
 Check for in-check position, used for King and Knight.
 
movenum_t addMoves (bBasicBoard const &b, case_t const &cf, int8_t const ri, int8_t const ci, bMoveList &ml) const override
 Add moves for Queen, Rook and Bishop.
 
- Public Member Functions inherited from bPieceColour
 bPieceColour (side_t s)
 
virtual ~bPieceColour ()
 
 bPieceColour (bPieceColour const &)=delete
 
 bPieceColour (bPieceColour &&)=delete
 
bPieceColouroperator= (bPieceColour const &)=delete
 
bPieceColouroperator= (bPieceColour &&)=delete
 
constexpr bool isWhite () const
 
constexpr bool isBlack () const
 
constexpr bool isEmpty () const
 
constexpr side_t opponent () const
 
constexpr side_t toMove () const
 
side_t invert ()
 

Additional Inherited Members

- Protected Member Functions inherited from bPieceColour
bool isAttackedBySlider (bBasicBoard const &b, case_t cf, column_t fromcol, rank_t fromrank, int8_t const ci, int8_t const ri, piece_t const cPiece, piece_t const cPiece2) const
 Return true if position is attacked by opponent respecting move offsets.
 
- Protected Attributes inherited from bPieceColour
side_t m_side = tSide::SIDE_UNDEFINED
 

Detailed Description

Definition at line 198 of file piece.h.

Constructor & Destructor Documentation

◆ bWhitePiece()

bWhitePiece::bWhitePiece ( )
inline

Definition at line 200 of file piece.h.

+ Here is the call graph for this function:

◆ ~bWhitePiece()

bWhitePiece::~bWhitePiece ( )
inlineoverride

Definition at line 203 of file piece.h.

Member Function Documentation

◆ canMovePreflightCheck() [1/2]

bool bWhitePiece::canMovePreflightCheck ( bBasicBoard & b,
case_t const & cf,
case_t const & ct ) const
overridevirtual

Check if any could be added by just checking there.

Returns
true if move seems valid, false if in check after move

Implements bPieceColour.

Definition at line 381 of file piece.cpp.

Referenced by bWhiteBishop::hasValidMovePreflightCheck(), bWhiteKing::hasValidMovePreflightCheck(), bWhiteKnight::hasValidMovePreflightCheck(), bWhiteQueen::hasValidMovePreflightCheck(), and bWhiteRook::hasValidMovePreflightCheck().

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

◆ canMovePreflightCheck() [2/2]

bool bWhitePiece::canMovePreflightCheck ( bBasicBoard & b,
case_t const & cf,
int8_t const ri,
int8_t const ci,
uint_fast8_t nMax = 1 ) const
overridevirtual

Check if any could be added by just checking there is not check, break on first.

Returns
true if move seems valid, false if in check after move

Implements bPieceColour.

Definition at line 403 of file piece.cpp.

+ Here is the call graph for this function:

◆ canPawnMovePreflightCheck()

bool bWhitePiece::canPawnMovePreflightCheck ( bBasicBoard & b,
case_t const & cf,
int8_t const ri,
int8_t const ci ) const
overridevirtual

Check if pawn move could be added by just checking there is not check, case of possible promotion.

Returns
true if move seems valid, false if in check after move

Implements bPieceColour.

Definition at line 439 of file piece.cpp.

+ Here is the call graph for this function:

◆ isAttacked()

bool bWhitePiece::isAttacked ( bBasicBoard const & b,
case_t const & cf ) const
overridevirtual

Check if piece on position is attacked, start with piece always on board and then with pieces with greatest mobility, goal is to break out asap.

Parameters
bboard
cfpiece position
Returns
true if attacked, false if not

Reimplemented from bPieceColour.

Definition at line 269 of file piece.cpp.

Referenced by canMovePreflightCheck(), canMovePreflightCheck(), canPawnMovePreflightCheck(), and bWhiteKing::GenerateMoves().

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

◆ addMove()

movenum_t bWhitePiece::addMove ( bBasicBoard const & b,
case_t const & cf,
case_t const & ct,
bMoveList & ml ) const
overridevirtual

Check for in-check position, used for King and Knight.

Implements bPieceColour.

Definition at line 552 of file piece.cpp.

Referenced by bWhiteKing::GenerateMoves(), and bWhiteKnight::GenerateMoves().

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

◆ addMoves()

movenum_t bWhitePiece::addMoves ( bBasicBoard const & b,
case_t const & cf,
int8_t const ri,
int8_t const ci,
bMoveList & ml ) const
overridevirtual

Add moves for Queen, Rook and Bishop.

Returns
number of moves generated

Implements bPieceColour.

Definition at line 586 of file piece.cpp.

Referenced by bWhiteBishop::GenerateMoves(), bWhiteQueen::GenerateMoves(), and bWhiteRook::GenerateMoves().

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