27void bMoveList::addMoveToList(
bBasicBoard const& b,
bMove& m,
bool const isInCheck)
31 bBasicBoard newboard(b);
32 newboard.applyMove(m);
72#if defined(INCOMPLETE_C11)
73 m_lmoves.insert(m_lmoves.end(), m);
76 if (bestMoveHasImproved(sc)) {
90 if (bestMoveHasImproved(sc)) {
91 m_lmoves.insert(m_lmoves.begin(), m);
95 m_lmoves.insert(m_lmoves.end(), m);
103 m_lmoves.insert(m_lmoves.end(), m);
104 if (bestMoveHasImproved(sc)) {
111 m_lmoves.insert(m_lmoves.end(), m);
118 m_lmoves.insert(m_lmoves.end(), m);
134 if (bestMoveHasImproved(score)) {
160 if (bestMoveHasImproved(score)) {
295 size_t nMoves = m_lmoves.size();
301 if (m_nQSMoves < 3) {
304 std::partial_sort(m_lmoves.begin(), m_lmoves.begin() + 2, m_lmoves.end(),
305 [](
bMove const& a,
bMove const& b) { return a > b; });
306 }
else if (m_nQSMoves < nMoves) {
308 std::partial_sort(m_lmoves.begin(), m_lmoves.begin() + m_nQSMoves, m_lmoves.end(),
309 [](
bMove const& a,
bMove const& b) { return a > b; });
312 std::sort(m_lmoves.begin(), m_lmoves.end(),
313 [](
bMove const& a,
bMove const& b) { return a > b; });
317 std::sort(m_lmoves.begin(), m_lmoves.end(),
318 [](
bMove const& a,
bMove const& b) { return a > b; });
323 }
else if (nMoves == 1) {
329#if defined(INCOMPLETE_C11)
346 for (
case_t iCase = 0; iCase < 64; ++iCase) {
353 for (
case_t iCase = 64; iCase > 0;) {
385 if (m_bestmoveid && (m_nQSMoves > 1) &&
isSorted()) {
388 bScore currentScore = m_lmoves[m_bestmoveid - 1].getScore();
389 for (
movenum_t nMoveID = 1; nMoveID < m_nQSMoves - 1 && nMoveID < m_lmoves.size() - 1; ++nMoveID) {
390 if (m_lmoves[nMoveID].getScore() < currentScore - 200) {
392 m_nQSMoves = nMoveID;
411 for (
case_t iCase = 0; iCase < 64; ++iCase) {
421 for (
case_t iCase = 64; iCase > 0;) {
441 for (
bMove const& m: ml.m_lmoves) {
This is the main include file, needs to be included before any other include.
constexpr piece_t getPiece(case_t const cf) const
boardInfo_t applyBlackMove(bMove const &m)
boardInfo_t applyWhiteMove(bMove const &m)
constexpr case_t getBlackKingPos() const
constexpr case_t getWhiteKingPos() const
constexpr int8_t pieceCount() const
constexpr side_t getColourToMove() const
void setPiece(case_t const cf, piece_t const piece)
constexpr plynum_t getPly() const
constexpr bool isCastleMove() const
constexpr bool isNonSilent() const
constexpr bool isPawnMove() const
constexpr bool isCapture() const
constexpr case_t to() const
constexpr bool isPromotion() const
constexpr bool isMajorPromotion() const
void setPromotion(const ppiece_t p)
constexpr bool getGameEnd() const
constexpr bool isCheck() const
constexpr case_t from() const
std::string getMoveEvalStr() const
void setScore(bScore const score)
constexpr bool isGenerated() const
movenum_t generateMoves(bBasicBoard const &b)
generate moves if not yet generated
void setScoreOfMoveUnsorted(movenum_t const moveid, bScore const score)
Store score of move and update best move.
void setBestMoveScore(movenum_t const moveid, bScore const score)
constexpr bool isKeepScores() const
movenum_t addBlackMoveIfValid(bBasicBoard const &b, bMove &m)
Only add move to movelist if valid.
void sortMoves()
sort moves and update bestmove id if less than 5 moves, sort all if more than 5 moves,...
void setMoveScore(movenum_t const moveid, bScore const score)
bool setScoreOfMove(movenum_t const moveid, bScore const score)
Store score of move and update best move.
movenum_t addBlackPromotionIfValid(bBasicBoard const &b, bMove &m)
Only add move to movelist if valid.
void clearIsPossibleMove()
constexpr movenum_t getBestMoveId() const
constexpr bool isPossibleMove() const
constexpr bool isNotSorted() const
movenum_t addWhiteMoveIfValid(bBasicBoard const &b, bMove &m)
Only add move to movelist if valid.
constexpr movenum_t getNumberOfMoves() const
bool atLeastOneMovePossible(bBasicBoard &b)
see if at least one move can be played e.g.
constexpr movenum_t getNumberOfQSMoves() const
void setBestMoveId(movenum_t const n)
movenum_t adjustQSMoves()
reduce the number of QS moves to filter out the best ones only
constexpr bool isNeedSorted() const
constexpr bool isSorted() const
movenum_t addWhitePromotionIfValid(bBasicBoard const &b, bMove &m)
Only add move to movelist if valid.
static bPiece * getPieceClass(piece_t const piece)
static class member function
static bool isBlackPiece(piece_t const p)
static class member function
static bool isWhitePiece(piece_t const p)
static class member function
constexpr bScore SCORE_MATE
std::ostream & operator<<(std::ostream &os, bMoveList const &ml)
Allow index mapper for char values of piece into int in 1-12 range to reduce space and easy initialis...
bBlackKing const * cBlackKingClass
bWhiteKing const * cWhiteKingClass
bScore centerplayvalues[]
bScore piecevalues_movepenalty[]