28void bMoveList::addMoveAndSetScore(
bBoard const& b,
bMove const& m,
36 if (!nb.atLeastOneMovePossible())
40 if (nm.getGameEnd()) {
50 if (nm.isPromotion()) {
52 if (nm.isMajorPromotion()) sc += 500;
55 if (nm.isCheck()) sc += 80;
56 if (nm.isCastleMove()) sc += 250;
58 if (nm.isNonSilent()) m_nQSMoves++;
59#if !defined(INCOMPLETE_C11)
60 if (m_bestmoveid && (sc >=
m_lmoves[m_bestmoveid - 1].getScore())) {
68#if !defined(INCOMPLETE_C11)
141 bool oppInCheckByQueen = bking->
isAttacked(newboard, bKingPos);
145 bool oppInCheck = bking->
isAttacked(newboard, bKingPos);
150 oppInCheck = oppInCheckByQueen && bking->
isAttacked(newboard, bKingPos);
154 oppInCheck = oppInCheckByQueen && bking->
isAttacked(newboard, bKingPos);
181 bool oppInCheckByQueen = wking->
isAttacked(newboard, wKingPos);
185 bool oppInCheck = wking->
isAttacked(newboard, wKingPos);
190 oppInCheck = oppInCheckByQueen && wking->
isAttacked(newboard, wKingPos);
194 oppInCheck = oppInCheckByQueen && wking->
isAttacked(newboard, wKingPos);
210 if (score >
m_lmoves[m_bestmoveid - 1].getScore()) {
212 m_bestmoveid = moveid;
217 m_bestmoveid = moveid;
220 m_lmoves[moveid - 1].setScore(score);
234 [](
bMove const& a,
bMove const& b) { return a > b; });
238 [](
bMove const& a,
bMove const& b) { return a > b; });
243 [](
bMove const& a,
bMove const& b) { return a > b; });
261 if (!m_isGenerated) {
262 m_isGenerated =
true;
265 for (
case_t iCase = 0; iCase < 64; ++iCase) {
272 for (
case_t iCase = 64; iCase > 0;) {
287 m_isGenerated =
false;
298 if (m_isGenerated)
return (
m_lmoves.size() > 0);
302 for (
case_t iCase = 0; iCase < 64; ++iCase) {
310 for (
case_t iCase = 64; iCase > 0;) {
This is the main include file, needs to be included before any other include.
void setPiece(case_t const bc, piece_t const piece)
used for promotion move generation
piece_t getPiece(case_t const bc) const
1 for white, 2 for black
side_t getColourToMove() const
case_t getBlackKingPos() const
case_t getWhiteKingPos() const
basicmove_t getBasicMoveT() const
MEMBER_CONSTEXPR case_t to() const
bool isAttacked(bBoard const &b, case_t const &cf) const override
bGameStage getStage() const
std::string getMoveEvalStr() const
void setPromotion(const ppiece_t p)
movenum_t addWhiteCaptureIfValid(bBoard const &b, case_t const &cf, case_t const &to)
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 addWhitePromotionIfValid(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 getNumberOfQSMoves() const
return number of non silent moves
movenum_t getNumberOfMoves() const
movenum_t addBlackMoveIfValid(bBoard const &b, bMove const &m)
Only add move to movelist if valid.
movenum_t addWhiteMoveIfValid(bBoard const &b, bMove const &m)
Only add move to movelist if valid.
movenum_t generateMoves(bBoard const &b)
generate moves if not yet generated
bool atLeastOneMovePossible(bBoard const &b) const
see if at least one move can be played e.g.
basicmove_t getMoveT(movenum_t const moveid) const
bMove const & operator[](movenum_t const moveid) const
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
static bScore pieceValue(piece_t const p)
static bScore centerplay_pieceValue(case_t const p)
static bScore mymove_pieceValue(piece_t const p)
bool isAttacked(bBoard const &b, case_t const &cf) const override
Check if piece on position is attacked, start with piece always on board and then with pieces with gr...
constexpr bScore SCORE_MATE
std::ostream & operator<<(std::ostream &os, bMoveList const &ml)