Belofte version 2.1.8
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 (bBoard &b, case_t const &cf, int8_t const ri, int8_t const ci) const override
 Check if move could be added by just checking there is not check.
 
bool canMovePreflightCheck (bBoard &b, case_t const &cf, int8_t const ri, int8_t const ci, piece_t const cPromotion) const override
 Check if pawn move could be added by just checking there is not check, case of possible promotion.
 
bool isAttacked (bBoard 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 ou asap.
 
movenum_t addMove (bBoard const &b, case_t const &cf, int8_t const ri, int8_t const ci, bMoveList &ml) const final
 Check for in-check position, single step move used for King and Knight.
 
movenum_t addMoves (bBoard const &b, case_t const &cf, int8_t const ri, int8_t const ci, bMoveList &ml) const final
 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
 
bool isWhite () const
 
bool isBlack () const
 
bool isEmpty () const
 
side_t invert ()
 
side_t opponent () const
 
side_t toMove () const
 

Additional Inherited Members

- Protected Member Functions inherited from bPieceColour
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 inherited from bPieceColour
side_t m_side = tSide::SIDE_UNDEFINED
 

Detailed Description

Definition at line 181 of file piece.h.

Constructor & Destructor Documentation

◆ bWhitePiece()

bWhitePiece::bWhitePiece ( )

Definition at line 331 of file piece.cpp.

◆ ~bWhitePiece()

bWhitePiece::~bWhitePiece ( )
override

Definition at line 336 of file piece.cpp.

Member Function Documentation

◆ canMovePreflightCheck() [1/2]

bool bWhitePiece::canMovePreflightCheck ( bBoard b,
case_t const &  cf,
int8_t const  ri,
int8_t const  ci 
) const
overridevirtual

Check if move could be added by just checking there is not check.

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

Implements bPieceColour.

Definition at line 408 of file piece.cpp.

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

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

◆ canMovePreflightCheck() [2/2]

bool bWhitePiece::canMovePreflightCheck ( bBoard b,
case_t const &  cf,
int8_t const  ri,
int8_t const  ci,
piece_t const  cPromotion 
) 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 440 of file piece.cpp.

+ Here is the call graph for this function:

◆ isAttacked()

bool bWhitePiece::isAttacked ( bBoard 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 ou asap.

Parameters
bboard
cfpiece position
Returns
true if attacked, false if not
Todo:
TOCHECK how about ep

Implements bPieceColour.

Definition at line 237 of file piece.cpp.

Referenced by bMoveList::addBlackMoveIfValid(), bMoveList::addBlackPromotionIfValid(), bMoveList::addWhiteMoveIfValid(), bMoveList::addWhitePromotionIfValid(), canMovePreflightCheck(), canMovePreflightCheck(), bWhiteKing::GenerateMoves(), and bPositionEvaluation::isGameEnded().

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

◆ addMove()

movenum_t bWhitePiece::addMove ( bBoard const &  b,
case_t const &  cf,
int8_t const  ri,
int8_t const  ci,
bMoveList ml 
) const
finalvirtual

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

Implements bPieceColour.

Definition at line 536 of file piece.cpp.

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

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

◆ addMoves()

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

Add moves for Queen, Rook and Bishop.

Returns
number of moves generated

Implements bPieceColour.

Definition at line 576 of file piece.cpp.

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

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