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

#include <movelist.h>

Public Member Functions

 bMoveList ()
 
 bMoveList (bMoveList &&) noexcept
 
 bMoveList (bBoard const &b)
 
 ~bMoveList ()
 
 bMoveList (bMoveList const &)=delete
 
bMoveListoperator= (bMoveList const &)=delete
 
bMoveListoperator= (bMoveList &&)=delete
 
movenum_t generateMoves (bBoard const &b)
 generate moves if not yet generated
 
void emptyMoveList ()
 
bool atLeastOneMovePossible (bBoard const &b) const
 see if at least one move can be played e.g.
 
movenum_t getNumberOfMoves () const
 
movenum_t getNumberOfQSMoves () const
 return number of non silent moves
 
bMove const & operator[] (movenum_t const moveid) const
 
basicmove_t getMoveT (movenum_t const moveid) const
 
movenum_t addWhiteMoveIfValid (bBoard const &b, bMove const &m)
 Only add move to movelist if valid.
 
movenum_t addWhiteCaptureIfValid (bBoard const &b, case_t const &cf, case_t const &to)
 
movenum_t addBlackMoveIfValid (bBoard const &b, bMove const &m)
 Only add move to movelist if valid.
 
movenum_t addBlackCaptureIfValid (bBoard const &b, case_t const &cf, case_t const &to)
 
movenum_t addWhitePromotionIfValid (bBoard const &b, bMove const &m)
 Only add move to movelist if valid.
 
movenum_t addBlackPromotionIfValid (bBoard const &b, bMove const &m)
 Only add move to movelist if valid.
 
movenum_t setScoreOfMove (movenum_t const moveid, bScore const score)
 Store score of move.
 
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 ( bMoveList &&  )
explicitnoexcept

◆ bMoveList() [3/4]

bMoveList::bMoveList ( bBoard const &  b)
explicit

Definition at line 15 of file movelist.cpp.

+ Here is the call graph for this function:

◆ ~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 259 of file movelist.cpp.

Referenced by bBoard::bBoard(), bMoveList(), bPgnMoveList::bPgnMoveList(), SearchRandom::CalcBestMove(), SearchAlphaBeta::CalcBestMove(), SearchAlphaBetaFH::CalcBestMove(), bel_debug::execute(), SearchAlphaBeta::Quiescence(), and bSearchAlgorithm::SearchBestMove().

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

◆ emptyMoveList()

void bMoveList::emptyMoveList ( )

Definition at line 284 of file movelist.cpp.

Referenced by bGame::revertGameMove().

+ Here is the caller graph for this function:

◆ atLeastOneMovePossible()

bool bMoveList::atLeastOneMovePossible ( bBoard const &  b) const

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

(stale-)mate eval

Definition at line 296 of file movelist.cpp.

Referenced by bBoard::atLeastOneMovePossible().

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

◆ getNumberOfMoves()

movenum_t bMoveList::getNumberOfMoves ( ) const

Definition at line 332 of file movelist.cpp.

Referenced by bPgnMove::bPgnMove(), SearchEvalPosOnly::CalcBestMove(), and bGame::playGameMove().

+ Here is the caller graph for this function:

◆ getNumberOfQSMoves()

movenum_t bMoveList::getNumberOfQSMoves ( ) const

return number of non silent moves

Definition at line 339 of file movelist.cpp.

Referenced by SearchAlphaBeta::Quiescence().

+ Here is the caller graph for this function:

◆ operator[]()

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

Definition at line 322 of file movelist.cpp.

◆ getMoveT()

basicmove_t bMoveList::getMoveT ( movenum_t const  moveid) const

Definition at line 327 of file movelist.cpp.

Referenced by bPgnMove::bPgnMove().

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

◆ addWhiteMoveIfValid()

movenum_t bMoveList::addWhiteMoveIfValid ( bBoard const &  b,
bMove const &  m 
)

Only add move to movelist if valid.

Parameters
bboard on which move is calculated
mmove to be added
Returns
number of moves added (1), meaning player is not in check after move

Definition at line 79 of file movelist.cpp.

Referenced by bWhitePawn::addEPMove(), bWhitePiece::addMove(), bWhitePiece::addMoves(), bWhitePawn::addNonCaptureDoublePawnMove(), bWhitePawn::addNonCapturePawnMove(), addWhiteCaptureIfValid(), and bWhiteKing::GenerateMoves().

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

◆ addWhiteCaptureIfValid()

movenum_t bMoveList::addWhiteCaptureIfValid ( bBoard const &  b,
case_t const &  cf,
case_t const &  to 
)

Definition at line 89 of file movelist.cpp.

Referenced by bWhitePawn::addCapturePawnMove(), bWhitePiece::addMove(), and bWhitePiece::addMoves().

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

◆ addBlackMoveIfValid()

movenum_t bMoveList::addBlackMoveIfValid ( bBoard const &  b,
bMove const &  m 
)

Only add move to movelist if valid.

Parameters
bboard on which move is calculated
mmove to be added
Returns
number of moves added (1), meaning player is not in check after move

Definition at line 102 of file movelist.cpp.

Referenced by addBlackCaptureIfValid(), bBlackPawn::addEPMove(), bBlackPiece::addMove(), bBlackPiece::addMoves(), bBlackPawn::addNonCaptureDoublePawnMove(), bBlackPawn::addNonCapturePawnMove(), and bBlackKing::GenerateMoves().

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

◆ addBlackCaptureIfValid()

movenum_t bMoveList::addBlackCaptureIfValid ( bBoard const &  b,
case_t const &  cf,
case_t const &  to 
)

Definition at line 112 of file movelist.cpp.

Referenced by bBlackPawn::addCapturePawnMove(), bBlackPiece::addMove(), and bBlackPiece::addMoves().

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

◆ addWhitePromotionIfValid()

movenum_t bMoveList::addWhitePromotionIfValid ( bBoard const &  b,
bMove const &  m 
)

Only add move to movelist if valid.

Parameters
bboard on which move is calculated
mmove to be added
Returns
number of moves added (4), meaning, player is not in check after move
Todo:
optimize in case of uncover check just by moving pawn

Definition at line 125 of file movelist.cpp.

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

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

◆ addBlackPromotionIfValid()

movenum_t bMoveList::addBlackPromotionIfValid ( bBoard const &  b,
bMove const &  m 
)

Only add move to movelist if valid.

Parameters
bboard on which move is calculated
mmove to be added
Returns
number of moves added (4), meaning, player is not in check after move
Todo:
optimize in case of uncover check just by moving pawn

Definition at line 165 of file movelist.cpp.

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

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

◆ setScoreOfMove()

movenum_t bMoveList::setScoreOfMove ( 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 207 of file movelist.cpp.

Referenced by SearchEvalPosOnly::CalcBestMove(), SearchRandom::CalcBestMove(), SearchAlphaBeta::CalcBestMove(), SearchAlphaBetaFH::CalcBestMove(), and SearchAlphaBeta::Quiescence().

+ Here is the caller graph for this function:

◆ sortMoves()

movenum_t bMoveList::sortMoves ( )

Definition at line 225 of file movelist.cpp.

Referenced by SearchAlphaBeta::CalcBestMove(), SearchAlphaBetaFH::CalcBestMove(), SearchAlphaBeta::Quiescence(), and bSearchAlgorithm::SearchBestMove().

+ Here is the caller graph for this function:

Friends And Related Symbol Documentation

◆ operator<<

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

Definition at line 346 of file movelist.cpp.

Member Data Documentation

◆ m_lmoves