12#if defined(BELOFTE_NOUNICODE)
13#define ALPHABETA "alpha-beta"
15#define ALPHABETA "πΌπ½"
19#if defined(BELOFTE_NOUNICODE)
20#define GTOREQUAL " >= "
22#define GTOREQUAL " β₯ "
31#pragma GCC diagnostic push
32#pragma GCC diagnostic ignored "-Weffc++"
76#pragma GCC diagnostic pop
87 if (
getLevel()->searchDepthReached(nDepth)) {
98 +
" static: " + belofte::scoreAsStr(m_terminalscore)
99 + (b.
isInCheck() ?
" check" :
""), m_terminalscore);
116 for (
movenum_t moveid = 1; moveid <= m_nmoves; moveid++) {
118 bMove m = ml[moveid];
131 + GTOREQUAL + beta, chldscore.
getScore());
133 if (chldscore > alpha) {
136 +
" > " + alpha, chldscore.
getScore());
152 if (
getLevel()->searchDepthReached(nDepth)) {
163 +
" static: " + belofte::scoreAsStr(m_terminalscore)
164 + (b.
isInCheck() ?
" check" :
""), m_terminalscore);
181 for (
movenum_t moveid = 1; moveid <= m_nmoves; moveid++) {
183 bMove m = ml[moveid];
196 + GTOREQUAL + beta, beta.
getScore());
198 if (chldscore > alpha) {
201 +
" > " + alpha, chldscore.
getScore());
226 +
" static: " + belofte::scoreAsStr(terminalScore)
228 +
" +: " + belofte::to_string(nCheckCount), terminalScore);
240 if (
getLevel()->qsDepthReached(nDepth)) {
248 bool isAllMoves =
false;
250 if ((nCheckCount < 1) && (b.
isInCheck())) {
263 + GTOREQUAL + beta, terminalScore);
267 if (terminalScore > alpha) {
269 +
" > " + alpha, terminalScore);
270 alpha = terminalScore;
275 for (
movenum_t moveid = 1; moveid <= m_nmoves; moveid++) {
277 if (isAllMoves || (ml[moveid].isNonSilent())
278 || ((!nCheckCount) && (b.
isInCheck()))) {
280 bMove m = ml[moveid];
293 + GTOREQUAL + beta, chldscore.
getScore());
295 if (chldscore > alpha) {
298 +
" > " + alpha, chldscore.
getScore());
This is the main include file, needs to be included before any other include.
~SearchAlphaBetaFH() final
bScore CalcBestMove(bBoard &b, depth_t const nDepth, bSearchScore alpha, bSearchScore beta) override
bScore CalcBestMove(bBoard &b) final
~SearchAlphaBeta() override
bScore m_nBetaCutOffMargin
bScore Quiescence(bBoard &b, depth_t const nDepth, bSearchScore alpha, bSearchScore beta, uint8_t nCheckCount)
void setVariation(bBoard const &chldbrd)
bMoveList & getMoveListRef()
return reference to movelist
movenum_t setScoreOfMove(movenum_t const moveid, bScore const score)
Store score of move.
movenum_t getNumberOfQSMoves() const
return number of non silent moves
movenum_t generateMoves(bBoard const &b)
generate moves if not yet generated
void sendInfoCurrMove(bBoard const &b, depth_t const nDepth, movenum_t const moveid) const
bScore attenuateScore(bScore const sc) const
converge score towards zero in order to force immediate best move first
bScore RetrieveBoardEvaluation(bBoard &b) const
Cache score of board.
void CheckIfAbortingSearch() const
bScore getRealScore() const
constexpr bScore SCORE_WINNING
constexpr bScore SCORE_POSITIVE
constexpr bScore SCORE_UNDEFINED
constexpr bScore SCORE_BETAMARGIN
constexpr bScore SCORE_THEORETIC_DRAW
constexpr bScore SCORE_INFINITE
#define DEBUG_returnInfoSearching(b, depth, msg, sc)
#define DEBUG_sendInfoSearching(b, depth, msg, sc)