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

#include <search_ab.h>

+ Inheritance diagram for SearchAlphaBeta:
+ Collaboration diagram for SearchAlphaBeta:

Public Member Functions

 SearchAlphaBeta ()
 
 ~SearchAlphaBeta () override
 
 SearchAlphaBeta (SearchAlphaBeta const &)=delete
 
 SearchAlphaBeta (SearchAlphaBeta &&)=delete
 
SearchAlphaBetaoperator= (SearchAlphaBeta const &)=delete
 
SearchAlphaBetaoperator= (SearchAlphaBeta &&)=delete
 
- Public Member Functions inherited from bSearchAlgorithm
 bSearchAlgorithm (std::string const &s)
 
 ~bSearchAlgorithm () override
 
 bSearchAlgorithm (bSearchAlgorithm const &)=delete
 
 bSearchAlgorithm (bSearchAlgorithm &&)=delete
 
bSearchAlgorithmoperator= (bSearchAlgorithm const &)=delete
 
bSearchAlgorithmoperator= (bSearchAlgorithm &&)=delete
 
constexpr int64_t getNodes () const
 
constexpr int64_t getNonLeafNodes () const
 
void StartSearch (bScore const sc)
 
void StopSearch ()
 
void InterruptSearch ()
 
void SearchBestMove (bBoard &b, bMoveList &ml)
 Generic search, will call (non-)recursive method per algorithm only when there are moves to be played.
 
void sendInfoSearching (bBoard const &b, depth_t const nDepth, std::string const &comment) const
 
bScore sendInfoSearching (bBoard const &b, depth_t const nDepth, std::string const &comment, bScore const sc) const
 
bScore RetrieveBoardEvaluation (bBoard &b, gameResult_t const gr=GR_UNSET) const
 Get score of board, eventually from cache.
 
constexpr bool isNoBench () const
 
void setBench ()
 
void clearBench ()
 
 operator std::string () const &
 
- Public Member Functions inherited from TimedExecution
 TimedExecution ()
 implementation of timing functions
 
virtual ~TimedExecution ()=default
 
std::string getDuration () const
 
long long getDurationMicroSec () const
 

Protected Member Functions

 SearchAlphaBeta (std::string const &s)
 
bScore CalcBestMove (bBoard &b, bMoveList &ml) override
 Root search for algorithm.
 
virtual bScore CalcBestMove (bBoard &b, bMoveList &ml, depth_t const nDepth, bSearchScore alpha, bSearchScore beta)
 Calculate best move from this position at given depth, iterative call.
 
bScore Quiescence (bBoard &b, depth_t const nDepth, bSearchScore alpha, bSearchScore beta, uint8_t nCheckCount)
 Calculate best move from this position considering only non-silent moves.
 
- Protected Member Functions inherited from bSearchAlgorithm
void CheckIfAbortingSearch () const
 
void adjustMaxSearchedDepth (depth_t const nDepth)
 
constexpr depth_t getMaxSearchedDepth () const
 
void initMaxSearchedDepth ()
 
void setLevel (bLevel *l)
 
bLevelgetLevel ()
 
void sendInfoCurrMove (bBoard const &b, depth_t const nCurDepth, bMove const &m, movenum_t const moveid) const
 
- Protected Member Functions inherited from TimedExecution
void ClockStart ()
 
void ClockEnd ()
 
long long getDurationSec () const
 
long long getDurationMilliSec () const
 

Protected Attributes

bScore m_nBetaCutOffMargin
 

Additional Inherited Members

- Public Attributes inherited from bSearchAlgorithm
int64_t m_leafnodes = 0LL
 
int64_t m_nonleafnodes = 0LL
 
bool m_iterativesearch = false
 

Detailed Description

Definition at line 13 of file search_ab.h.

Constructor & Destructor Documentation

◆ SearchAlphaBeta() [1/4]

SearchAlphaBeta::SearchAlphaBeta ( std::string const & s)
inlineexplicitprotected

Definition at line 15 of file search_ab.h.

Referenced by operator=(), operator=(), SearchAlphaBeta(), SearchAlphaBeta(), and SearchAlphaBetaFH::SearchAlphaBetaFH().

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

◆ SearchAlphaBeta() [2/4]

SearchAlphaBeta::SearchAlphaBeta ( )
inlineexplicit

Definition at line 21 of file search_ab.h.

+ Here is the call graph for this function:

◆ ~SearchAlphaBeta()

SearchAlphaBeta::~SearchAlphaBeta ( )
inlineoverride

Definition at line 25 of file search_ab.h.

◆ SearchAlphaBeta() [3/4]

SearchAlphaBeta::SearchAlphaBeta ( SearchAlphaBeta const & )
delete
+ Here is the call graph for this function:

◆ SearchAlphaBeta() [4/4]

SearchAlphaBeta::SearchAlphaBeta ( SearchAlphaBeta && )
delete
+ Here is the call graph for this function:

Member Function Documentation

◆ operator=() [1/2]

SearchAlphaBeta & SearchAlphaBeta::operator= ( SearchAlphaBeta const & )
delete
+ Here is the call graph for this function:

◆ operator=() [2/2]

SearchAlphaBeta & SearchAlphaBeta::operator= ( SearchAlphaBeta && )
delete
+ Here is the call graph for this function:

◆ CalcBestMove() [1/2]

bScore SearchAlphaBeta::CalcBestMove ( bBoard & b,
bMoveList & ml )
overrideprotectedvirtual

Root search for algorithm.

Parameters
bboard
mlmovelist of this position
Todo
check why not test for winning before evaluating moves

Implements bSearchAlgorithm.

Definition at line 18 of file search_ab.cpp.

Referenced by CalcBestMove(), and CalcBestMove().

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

◆ CalcBestMove() [2/2]

bScore SearchAlphaBeta::CalcBestMove ( bBoard & b,
bMoveList & ml,
depth_t const nDepth,
bSearchScore alpha,
bSearchScore beta )
protectedvirtual

Calculate best move from this position at given depth, iterative call.

Parameters
bBoard
mlmovelist of this position
nDepthdepth to search for, increasing until searchDepth
alphamaximum for minimizing player
betaminimum for maximizing player
Bug
alpha/beta values do not bubble up to calling function

Reimplemented in SearchAlphaBetaFH.

Definition at line 38 of file search_ab.cpp.

+ Here is the call graph for this function:

◆ Quiescence()

bScore SearchAlphaBeta::Quiescence ( bBoard & b,
depth_t const nDepth,
bSearchScore alpha,
bSearchScore beta,
uint8_t nCheckCount )
protected

Calculate best move from this position considering only non-silent moves.

Parameters
bBoard
nDepthdepth to search for, increasing from searchDepth to qsSearchDepth
alphamaximum for minimizing player
betaminimum for maximizing player
nCheckCountnumber of checks inside qs search tree
Bug
alpha/beta values do not bubble up to calling function
Bug
quit after first move

Definition at line 124 of file search_ab.cpp.

Referenced by CalcBestMove(), SearchAlphaBetaFH::CalcBestMove(), and Quiescence().

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

Member Data Documentation

◆ m_nBetaCutOffMargin

bScore SearchAlphaBeta::m_nBetaCutOffMargin
protected