Belofte  version 2.1.5
A promising chess program using the UCI or Winboard interface
bMoveList Class Referencefinal

Public Member Functions

 bMoveList ()
 
 bMoveList (bBoard const &b)
 
 bMoveList (bMoveList &&ml) noexcept
 
 ~bMoveList ()
 
 bMoveList (bMoveList const &)=delete
 
bMoveListoperator= (bMoveList const &)=delete
 
bMoveListoperator= (bMoveList &&)=delete
 
movenum_t generateMoves (bBoard const &b)
 generate moves if not yet generated More...
 
movenum_t generateAtLeastOneMove (bBoard const &b)
 see if at least one move can be played e.g. More...
 
movenum_t generateEscapeKingMove (bBoard const &b)
 see if at least one move can be played e.g. More...
 
movenum_t generateAtLeastOneQSMove (bBoard const &b)
 see if at least one QS move can be played More...
 
void clearGeneratedMoves ()
 
movenum_t getNumberOfMoves () const
 
bMove const & operator[] (movenum_t const moveid) const
 
basicmove_t getBasicMoveT (movenum_t const moveid) const
 
move_t getMoveT (movenum_t const moveid) const
 
uint8_t addMoveIfValid (bBoard const &b, bMove const &m, side_t const side)
 Only add move to movelist if valid. More...
 
uint8_t addPromotionIfValid (bBoard const &b, bMove const &m, side_t const side)
 Only add move to movelist if valid. More...
 
movenum_t updateScoreOfBestMove (movenum_t const moveid, bScore const score)
 Store score of move. More...
 
movenum_t getBestMoveId () const
 
bBestMoveInfo getBestMoveInfo () const
 
bScore getScoreOfBestMove () const
 
movenum_t sortMoves ()
 

Protected Attributes

movelist_t m_lmoves
 

Friends

std::ostream & operator<< (std::ostream &os, bMoveList const &ml)
 

Detailed Description

Definition at line 15 of file movelist.h.

Constructor & Destructor Documentation

◆ bMoveList() [1/4]

bMoveList::bMoveList ( )

Definition at line 10 of file movelist.cpp.

◆ bMoveList() [2/4]

bMoveList::bMoveList ( bBoard const &  b)
explicit

Definition at line 15 of file movelist.cpp.

+ Here is the call graph for this function:

◆ bMoveList() [3/4]

bMoveList::bMoveList ( bMoveList &&  ml)
noexcept

◆ ~bMoveList()

bMoveList::~bMoveList ( )

Definition at line 21 of file movelist.cpp.

◆ bMoveList() [4/4]

bMoveList::bMoveList ( bMoveList const &  )
delete

Member Function Documentation

◆ operator=() [1/2]

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

◆ operator=() [2/2]

bMoveList& bMoveList::operator= ( bMoveList &&  )
delete

◆ generateMoves()

movenum_t bMoveList::generateMoves ( bBoard const &  b)

generate moves if not yet generated

Definition at line 279 of file movelist.cpp.

Referenced by bMoveList(), and bBoard::generateMoves().

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

◆ generateAtLeastOneMove()

movenum_t bMoveList::generateAtLeastOneMove ( bBoard const &  b)

see if at least one move can be played e.g.

(stale-)mate eval

Returns
case last evaluated + 1, 0 if no moves found return range: >= 0 and <= 64 updates m_generateFromCase

Definition at line 298 of file movelist.cpp.

Referenced by bBoard::generateAtLeastOneMove().

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

◆ generateEscapeKingMove()

movenum_t bMoveList::generateEscapeKingMove ( bBoard const &  b)

see if at least one move can be played e.g.

(stale-)mate eval in case player is in check, to speed up, start with king position

Returns
case last evaluated + 1, 0 if no moves found return range: >= 0 and <= 64 updates m_generateFromCase, but should not be used in conjunction with generateAtLeastOneQSMove and generateMoves because it will insert kingmoves twice (wrong movecount!)

Definition at line 323 of file movelist.cpp.

+ Here is the call graph for this function:

◆ generateAtLeastOneQSMove()

movenum_t bMoveList::generateAtLeastOneQSMove ( bBoard const &  b)

see if at least one QS move can be played

Returns
case last evaluated + 1, 0 if no QS moves found return range: >= 0 and <= 64 updates m_generateFromCase and might generate all moves

Definition at line 355 of file movelist.cpp.

Referenced by bBoard::generateAtLeastOneQSMove().

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

◆ clearGeneratedMoves()

void bMoveList::clearGeneratedMoves ( )

Definition at line 371 of file movelist.cpp.

Referenced by bGame::revertGameMove().

+ Here is the caller graph for this function:

◆ getNumberOfMoves()

movenum_t bMoveList::getNumberOfMoves ( ) const

Definition at line 396 of file movelist.cpp.

Referenced by bPgnMove::bPgnMove(), bPgnMoveList::bPgnMoveList(), and SearchRandom::CalcBestMove().

+ Here is the caller graph for this function:

◆ operator[]()

bMove const & bMoveList::operator[] ( movenum_t const  moveid) const

Definition at line 381 of file movelist.cpp.

◆ getBasicMoveT()

basicmove_t bMoveList::getBasicMoveT ( movenum_t const  moveid) const

Definition at line 386 of file movelist.cpp.

Referenced by bPgnMove::bPgnMove().

+ Here is the caller graph for this function:

◆ getMoveT()

move_t bMoveList::getMoveT ( movenum_t const  moveid) const

Definition at line 391 of file movelist.cpp.

Referenced by bPgnMove::bPgnMove(), SearchEvalPosOnly::CalcBestMove(), getBestMoveInfo(), and bSearchAlgorithm::SearchBestMove().

+ Here is the caller graph for this function:

◆ addMoveIfValid()

uint8_t bMoveList::addMoveIfValid ( bBoard const &  b,
bMove const &  m,
side_t const  side 
)

Only add move to movelist if valid.

Parameters
bboard to act on
mmove to be added
sideplayer to move
Returns
number of moves added, meaning player is not in check after move

Definition at line 78 of file movelist.cpp.

Referenced by bPawn::addCapturePawnMove(), bPawn::addEPMove(), bPiece::addMove(), bPiece::addMoves(), bPawn::addNonCaptureDoublePawnMove(), bPawn::addNonCapturePawnMove(), bWhiteKing::GenerateMoves(), and bBlackKing::GenerateMoves().

+ Here is the caller graph for this function:

◆ addPromotionIfValid()

uint8_t bMoveList::addPromotionIfValid ( bBoard const &  b,
bMove const &  m,
side_t const  side 
)

Only add move to movelist if valid.

Parameters
bboard to act on
mmove to be added
sideplayer to move
Returns
number of moves added, meaning, player is not in check after move

Definition at line 114 of file movelist.cpp.

Referenced by bPawn::addCapturePromotionMove(), and bPawn::addNonCapturePromotionMove().

+ Here is the caller graph for this function:

◆ updateScoreOfBestMove()

movenum_t bMoveList::updateScoreOfBestMove ( movenum_t const  moveid,
bScore const  score 
)

Store score of move.

Parameters
moveidof move to be stored [1 -> max number of moves]
scoreto be stored
Returns
moveid of new best move if updated, or zero if no update

Definition at line 203 of file movelist.cpp.

Referenced by SearchEvalPosOnly::CalcBestMove(), and SearchRandom::CalcBestMove().

+ Here is the caller graph for this function:

◆ getBestMoveId()

movenum_t bMoveList::getBestMoveId ( ) const

Definition at line 225 of file movelist.cpp.

Referenced by bSearchAlgorithm::SearchBestMove().

+ Here is the caller graph for this function:

◆ getBestMoveInfo()

bBestMoveInfo bMoveList::getBestMoveInfo ( ) const

Definition at line 230 of file movelist.cpp.

Referenced by SearchRandom::CalcBestMove().

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

◆ getScoreOfBestMove()

bScore bMoveList::getScoreOfBestMove ( ) const

Definition at line 239 of file movelist.cpp.

◆ sortMoves()

movenum_t bMoveList::sortMoves ( )

Definition at line 245 of file movelist.cpp.

Referenced by bSearchAlgorithm::SearchBestMove().

+ Here is the caller graph for this function:

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  os,
bMoveList const &  ml 
)
friend

Definition at line 403 of file movelist.cpp.

Member Data Documentation

◆ m_lmoves