12 #if defined(BELOFTE_NOUNICODE)
13 #define GTOREQUAL " >= "
15 #define GTOREQUAL " ≥ "
23 #pragma GCC diagnostic push
24 #pragma GCC diagnostic ignored "-Weffc++"
29 , m_bEarlyBetaCutOff{false}
30 , m_bEarlyQSBetaCutOff{true}
33 , m_bAttenuateScore{true}
40 , m_bEarlyBetaCutOff{false}
41 , m_bEarlyQSBetaCutOff{true}
44 , m_bAttenuateScore{true}
105 + (b.
isInCheck() ?
" check" :
""), m_terminalscore);
113 m_isTerminal =
false;
138 m_isTerminal =
false;
143 #if defined(__GNUC__)
144 #pragma GCC diagnostic pop
156 if (
getLevel()->depthReached(nDepth)) {
158 result = Quiescence(b, nDepth, alpha, beta, inCheck);
165 if (n.isTerminal()) { ++
m_leafnodes;
return n.getNode(); }
179 for (
movenum_t moveid = 1; moveid <= n_moves; moveid++) {
184 else chldscore = -chldscore;
202 if (chldscore > alpha) {
205 +
" > " + alpha, chldscore);
206 bestscore = chldscore.getScore();
228 TerminalNode n(b, nDepth, alpha, beta, nCheckCount,
this);
229 if (n.isTerminal()) { ++
m_leafnodes;
return n.getScore(); }
231 if (
getLevel()->qsDepthReached(nDepth)) {
235 bool isAllMoves =
false;
237 if ((nCheckCount < 1) && (b.
isInCheck())) {
257 +
" > " + alpha, n.getScore());
266 for (
movenum_t moveid = 1; moveid <= n_moves; moveid++) {
268 if (isAllMoves || (ml[moveid].isNonSilent())
269 || ((!nCheckCount) && (b.
isInCheck()))) {
274 else chldscore = -chldscore;
286 if (chldscore > alpha) {
289 +
" > " + alpha, chldscore);
290 bestscore = chldscore.getScore();
This is the main include file, needs to be included before any other include.
uint_fast16_t movenum_t
moveflags (high order word) & basicmove (low order word)
int_fast16_t bScore
used to return id of move in movelist
~SearchAlphaBetaFH() final
~SearchAlphaBetaFS() override
~SearchAlphaBeta() override
bBestMoveInfo CalcBestMove(bBoard &b) final
bScore m_nBetaCutOffMargin
bool m_bEarlyQSBetaCutOff
TerminalNode(bBoard &b, depth_t const &nDepth, bSearchScore const &alpha, bSearchScore const &beta, bSearchAlgorithm *algo)
movenum_t generateMoves()
generate moves if not yet generated
void setVariation(bBoard const &chldbrd)
bMoveList & getMoves()
return moves in position, initialise structure if needed
bScore getMaterialEvaluation() const
movenum_t generateAtLeastOneQSMove()
movenum_t generateAtLeastOneMove()
see if at least one move can be played e.g.
movenum_t updateScoreOfBestMove(movenum_t const moveid, bScore const score)
Store score of move.
move_t getMoveT(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 handleInfoCurrMove(bBoard const &b, bMoveList const &ml, depth_t const &nDepth, movenum_t const moveid) const
bScore sendInfoSearching(bBoard const &b, depth_t const nDepth, std::string const &c, bScore const sc) const
constexpr bScore SCORE_WINNING
constexpr bScore SCORE_POSITIVE
constexpr bScore SCORE_BETAMARGIN
constexpr bScore SCORE_THEORETIC_DRAW
constexpr bScore SCORE_INFINITE
std::string scoreAsStr(bScore const sc)
bScore realScore(bScore const sc)
std::string to_string(long value)
std::to_string not compatible on Mac OS (Apple LLVM version 5.0) provide generic utility function