Belofte version 2.1.9
A promising chess program using the UCI or Winboard interface
|
#include <basicboard.h>
Public Member Functions | |
bBasicBoard (bBasicBoard const &bb) | |
virtual | ~bBasicBoard () |
constexpr plynum_t | getPly () const |
void | setPly (plynum_t const p) |
void | incPly () |
void | decPly () |
constexpr bool | isEpSet () const |
constexpr case_t | getEp () const |
constexpr column_t | getEpColumn () const |
void | setEp (case_t const e) |
set ep case, it will actually be stored as column only rank will be calculated based on side to move function is never called to clear ep case or when ep is not set | |
void | clearEp () |
constexpr movenum50_t | getPly50Moves () const |
void | setPly50Moves (movenum50_t const p) |
void | incPly50Moves () |
void | clearPly50Moves () |
constexpr bool | hasCastleRights (uint8_t const f) const |
void | setWhiteHasCastled () |
void | setBlackHasCastled () |
void | clearWhiteHasCastled () |
void | clearBlackHasCastled () |
constexpr bool | whiteHasCastled () const |
constexpr bool | blackHasCastled () const |
void | setCastleRights (uint8_t const f) |
void | setCastleRights (uint8_t const f, bool const c) |
void | clearCastleRights (uint8_t const f) |
constexpr bool | isInCheck () const |
void | setInCheck () |
void | clearInCheck () |
constexpr bool | isNonSilent () const |
void | setNonSilent () |
void | clearNonSilent () |
constexpr piece_t | getCapturedPiece () const |
void | setCapturedPiece (piece_t p) |
void | clearCapturedPiece () |
constexpr bool | whiteToMove () const |
constexpr bool | blackToMove () const |
constexpr int16_t | getMoveNumber () const |
constexpr side_t | getColourToMove () const |
constexpr bScore | minimizing () const |
constexpr piece_t | getPiece (case_t const cf) const |
constexpr piece_t | getPiece (column_t const iColumn, rank_t const iRank) const |
piece_t | getPieceCtl (column_t const iColumn, rank_t const iRank) const |
void | setPiece (case_t const cf, piece_t const piece) |
void | setPiece (case_t const cf, uint8_t const piece) |
piece_t | setGetPiece (column_t const newcol, rank_t const newrank, piece_t const piece) |
piece_t | removePiece (column_t const newcol, rank_t const newrank) |
void | clearPiece (case_t const cf) |
constexpr bool | isFieldEmpty (case_t const cf) const |
constexpr bool | isFieldEmpty (column_t const iColumn, rank_t const iRank) const |
constexpr case_t | getWhiteKingPos () const |
constexpr case_t | getBlackKingPos () const |
void | movePiece (case_t const cf, case_t const ct, piece_t const np) |
void | swapPiece (case_t const cf, piece_t const op, piece_t const np) |
void | clearPiece (case_t const cf, piece_t const op) |
void | restorePiece (case_t const cf, piece_t const op) |
void | moveWhiteKing (case_t const cf, case_t const ct) |
void | moveBlackKing (case_t const cf, case_t const ct) |
bFen | getFEN () const |
constexpr int8_t | pieceCount () const |
std::string | getHashStr () const |
constexpr hashkey_t | getHash () const |
void | setHash (hashkey_t const newHash) |
boardInfo_t | getBoardInfo () const |
void | setBoardInfo (boardInfo_t boardInfo) |
virtual boardInfo_t | applyMove (bMove const &m) |
play game move on board | |
boardInfo_t | applyWhiteMove (bMove const &m) |
boardInfo_t | applyBlackMove (bMove const &m) |
void | unApplyMove (bMove const &m, boardInfo_t const oldBoardInfo) |
exact restoration of basic board using move details | |
boardInfo_t | makeBoardMove (column_t const oldcol, rank_t const oldrank, column_t const newcol, rank_t const newrank) |
apply move to check if in check only, board to be discarded as it will be in incomplete state, no hash update no check flag set, etc. | |
void | unMakeBoardMove (case_t const &cf, column_t const newcol, rank_t const newrank, boardInfo_t const oldBoardInfo) |
undo makeBoardMove, restoring previous situation | |
Protected Member Functions | |
bBasicBoard () | |
bBasicBoard (bBasicBoard &&bb) | |
bBasicBoard (bFen const &fen) | |
bBasicBoard & | operator= (bBasicBoard const &)=delete |
bBasicBoard & | operator= (bBasicBoard &&)=delete |
void | calcHash () |
Set hash based on board position, also calc pieces Byte 0: bits 4-6 capture count (masked) bit 7 player to move We are using 64 bits for hash. | |
void | capturePieceOn (piece_t const capturedPiece, case_t const ct) |
Clear castle flag if rook captured update piece counter, update hash, clear field. | |
void | setPieceKU (case_t const cf, piece_t const piece) |
void | setPieceCount (int8_t const n) |
void | incPieceCount () |
void | decPieceCount () |
Definition at line 53 of file basicboard.h.
|
protected |
Referenced by bBasicBoard(), bBasicBoard(), bBoard::bBoard(), bBoard::bBoard(), bBoard::bBoard(), operator=(), and operator=().
|
inlineexplicitprotected |
|
explicitprotected |
Definition at line 17 of file basicboard.cpp.
|
inlineexplicit |
|
inlinevirtual |
Definition at line 71 of file basicboard.h.
|
protecteddelete |
|
protecteddelete |
|
inlineconstexpr |
Definition at line 75 of file basicboard.h.
|
inline |
Definition at line 78 of file basicboard.h.
Referenced by bBasicBoard().
|
inline |
Definition at line 80 of file basicboard.h.
Referenced by applyBlackMove(), applyWhiteMove(), bBasicBoard(), bBoard::invertColours(), and makeBoardMove().
|
inline |
Definition at line 82 of file basicboard.h.
Referenced by bBoard::invertColours().
|
inlineconstexpr |
Definition at line 89 of file basicboard.h.
Referenced by calcHash(), clearEp(), bBlackPawn::GenerateMoves(), bWhitePawn::GenerateMoves(), getFEN(), bBlackPawn::hasValidMovePreflightCheck(), bWhitePawn::hasValidMovePreflightCheck(), bBoard::operator std::string(), and setEp().
|
inlineconstexpr |
Definition at line 91 of file basicboard.h.
Referenced by calcHash(), clearEp(), getFEN(), bBoard::operator std::string(), and setEp().
|
inlineconstexpr |
Definition at line 93 of file basicboard.h.
Referenced by bBlackPawn::GenerateMoves(), bWhitePawn::GenerateMoves(), and getEp().
void bBasicBoard::setEp | ( | case_t const | e | ) |
set ep case, it will actually be stored as column only rank will be calculated based on side to move function is never called to clear ep case or when ep is not set
Definition at line 144 of file basicboard.cpp.
Referenced by applyBlackMove(), applyWhiteMove(), and bBasicBoard().
void bBasicBoard::clearEp | ( | ) |
Definition at line 163 of file basicboard.cpp.
Referenced by applyBlackMove(), applyWhiteMove(), and bBasicBoard().
|
inlineconstexpr |
Definition at line 103 of file basicboard.h.
Referenced by bPositionEvaluation::gameEndedResult(), and getFEN().
|
inline |
Definition at line 105 of file basicboard.h.
Referenced by bBasicBoard().
|
inline |
Definition at line 107 of file basicboard.h.
Referenced by applyBlackMove(), and applyWhiteMove().
|
inline |
Definition at line 109 of file basicboard.h.
Referenced by applyBlackMove(), applyWhiteMove(), and capturePieceOn().
|
inlineconstexpr |
Definition at line 113 of file basicboard.h.
Referenced by calcHash(), bBlackKing::GenerateMoves(), bWhiteKing::GenerateMoves(), getFEN(), and bBoard::invertColours().
|
inline |
Definition at line 115 of file basicboard.h.
Referenced by applyWhiteMove().
|
inline |
Definition at line 117 of file basicboard.h.
Referenced by applyBlackMove().
|
inline |
Definition at line 119 of file basicboard.h.
|
inline |
Definition at line 121 of file basicboard.h.
|
inlineconstexpr |
Definition at line 123 of file basicboard.h.
|
inlineconstexpr |
Definition at line 125 of file basicboard.h.
void bBasicBoard::setCastleRights | ( | uint8_t const | f | ) |
there can be (is) a difference in the offsets in the hash table and the castle flags
Definition at line 180 of file basicboard.cpp.
Referenced by bBasicBoard(), bBoard::invertColours(), and setCastleRights().
void bBasicBoard::setCastleRights | ( | uint8_t const | f, |
bool const | c ) |
void bBasicBoard::clearCastleRights | ( | uint8_t const | f | ) |
there can be (is) a difference in the offsets in the hash table and the castle flags
Definition at line 190 of file basicboard.cpp.
Referenced by applyBlackMove(), applyWhiteMove(), capturePieceOn(), and setCastleRights().
|
inlineconstexpr |
Definition at line 132 of file basicboard.h.
Referenced by SearchAlphaBeta::CalcBestMove(), SearchAlphaBetaFH::CalcBestMove(), bBoard::operator std::string(), and SearchAlphaBeta::Quiescence().
|
inline |
Definition at line 134 of file basicboard.h.
Referenced by applyBlackMove(), and applyWhiteMove().
|
inline |
Definition at line 136 of file basicboard.h.
Referenced by applyBlackMove(), and applyWhiteMove().
|
inlineconstexpr |
Definition at line 139 of file basicboard.h.
Referenced by bBoard::operator std::string().
|
inline |
Definition at line 141 of file basicboard.h.
Referenced by capturePieceOn().
|
inline |
Definition at line 143 of file basicboard.h.
|
inlineconstexpr |
Definition at line 146 of file basicboard.h.
Referenced by bBoard::operator std::string(), and unApplyMove().
|
inline |
Definition at line 148 of file basicboard.h.
Referenced by capturePieceOn().
|
inline |
Definition at line 152 of file basicboard.h.
Referenced by applyBlackMove(), and applyWhiteMove().
|
inlineconstexpr |
Definition at line 156 of file basicboard.h.
Referenced by cmd_usermove::execute(), bPositionEvaluation::gameEndedResult(), bBoard::invertColours(), minimizing(), bBoard::operator std::string(), bGame::playGameMove(), and bSearchAlgorithm::SearchBestMove().
|
inlineconstexpr |
Definition at line 158 of file basicboard.h.
Referenced by getEp().
|
inlineconstexpr |
Definition at line 160 of file basicboard.h.
Referenced by getFEN(), and bBoard::operator std::string().
|
inlineconstexpr |
Definition at line 162 of file basicboard.h.
Referenced by applyMove(), bMoveList::atLeastOneMovePossible(), calcHash(), bMoveList::generateMoves(), getFEN(), makeBoardMove(), unApplyMove(), and unMakeBoardMove().
|
inlineconstexpr |
Definition at line 166 of file basicboard.h.
Referenced by SearchAlphaBeta::CalcBestMove(), bGame::EvalForPlayer(), cmd_eval::execute(), SearchAlphaBeta::Quiescence(), bSearchAlgorithm::RetrieveBoardEvaluation(), bSearchAlgorithm::SearchBestMove(), and bSearchAlgorithm::sendInfoSearching().
Definition at line 172 of file basicboard.h.
Referenced by bBlackPawn::addCapturePawnMove(), bWhitePawn::addCapturePawnMove(), bBlackPawn::addCapturePromotionMove(), bWhitePawn::addCapturePromotionMove(), bBlackPiece::addMove(), bWhitePiece::addMove(), bBlackPiece::addMoves(), bWhitePiece::addMoves(), applyBlackMove(), applyWhiteMove(), bMoveList::atLeastOneMovePossible(), calcHash(), bBoard::calcMinorPieces(), bBlackPiece::canMovePreflightCheck(), bBlackPiece::canMovePreflightCheck(), bWhitePiece::canMovePreflightCheck(), bWhitePiece::canMovePreflightCheck(), bBlackPiece::canPawnMovePreflightCheck(), bWhitePiece::canPawnMovePreflightCheck(), bMoveList::generateMoves(), PosEvalStaticBoard::getEndgameEvaluation(), PosEvalPiecesOnly::getEvaluation(), getFEN(), PosEvalStaticBoard::getMatingEvaluation(), PosEvalStaticBoard::getPawnEndingEvaluation(), PosEvalStaticBoard::getRelativeBoardEval(), bBoard::invertColours(), bBlackPiece::isAttacked(), bWhitePiece::isAttacked(), bPieceColour::isAttackedBySlider(), makeBoardMove(), bBoard::operator std::string(), unApplyMove(), and unMakeBoardMove().
Definition at line 182 of file basicboard.h.
Referenced by bMoveList::addBlackPromotionIfValid(), bMoveList::addWhitePromotionIfValid(), makeBoardMove(), and unMakeBoardMove().
|
inline |
Definition at line 184 of file basicboard.h.
|
inline |
Definition at line 186 of file basicboard.h.
Referenced by makeBoardMove().
Definition at line 193 of file basicboard.h.
Referenced by makeBoardMove().
|
inline |
Definition at line 199 of file basicboard.h.
Referenced by applyBlackMove(), applyWhiteMove(), makeBoardMove(), unApplyMove(), and unMakeBoardMove().
|
inlineconstexpr |
Definition at line 201 of file basicboard.h.
Referenced by bBlackPiece::addMove(), bWhitePiece::addMove(), bBlackPiece::addMoves(), bWhitePiece::addMoves(), bBlackPawn::addNonCapturePawnMove(), bWhitePawn::addNonCapturePawnMove(), bBlackPawn::addNonCapturePromotionMove(), bWhitePawn::addNonCapturePromotionMove(), bBlackKing::GenerateMoves(), and bWhiteKing::GenerateMoves().
|
inlineconstexpr |
Definition at line 206 of file basicboard.h.
Referenced by bMoveList::addBlackMoveIfValid(), bMoveList::addBlackPromotionIfValid(), bMoveList::addWhiteMoveIfValid(), bMoveList::addWhitePromotionIfValid(), bMoveList::atLeastOneMovePossible(), bWhitePiece::canMovePreflightCheck(), bWhitePiece::canMovePreflightCheck(), bWhitePiece::canPawnMovePreflightCheck(), bPositionEvaluation::gameEndedResult(), and bBlackPiece::isAttacked().
|
inlineconstexpr |
Definition at line 208 of file basicboard.h.
Referenced by bMoveList::addBlackMoveIfValid(), bMoveList::addBlackPromotionIfValid(), bMoveList::addWhiteMoveIfValid(), bMoveList::addWhitePromotionIfValid(), bMoveList::atLeastOneMovePossible(), bBlackPiece::canMovePreflightCheck(), bBlackPiece::canMovePreflightCheck(), bBlackPiece::canPawnMovePreflightCheck(), bPositionEvaluation::gameEndedResult(), and bWhitePiece::isAttacked().
Definition at line 225 of file basicboard.cpp.
Referenced by applyBlackMove(), applyWhiteMove(), and unApplyMove().
Definition at line 232 of file basicboard.cpp.
Referenced by applyBlackMove(), and applyWhiteMove().
Definition at line 238 of file basicboard.cpp.
Definition at line 244 of file basicboard.cpp.
Referenced by unApplyMove().
Definition at line 250 of file basicboard.cpp.
Referenced by applyWhiteMove().
Definition at line 258 of file basicboard.cpp.
Referenced by applyBlackMove().
bFen bBasicBoard::getFEN | ( | ) | const |
Definition at line 96 of file basicboard.cpp.
Referenced by bel_debug::execute().
|
inlineconstexpr |
Definition at line 221 of file basicboard.h.
Referenced by bBoard::calcGameStage(), calcHash(), and bPositionEvaluation::gameEndedResult().
std::string bBasicBoard::getHashStr | ( | ) | const |
Definition at line 698 of file basicboard.cpp.
|
inlineconstexpr |
Definition at line 225 of file basicboard.h.
|
inline |
Definition at line 227 of file basicboard.h.
|
inline |
Definition at line 231 of file basicboard.h.
|
inline |
Definition at line 233 of file basicboard.h.
|
virtual |
play game move on board
Reimplemented in bBoard.
Definition at line 314 of file basicboard.cpp.
Referenced by bBoard::applyMove().
boardInfo_t bBasicBoard::applyWhiteMove | ( | bMove const & | m | ) |
Definition at line 324 of file basicboard.cpp.
Referenced by bMoveList::addWhiteMoveIfValid(), bMoveList::addWhitePromotionIfValid(), applyMove(), and bWhitePiece::canMovePreflightCheck().
boardInfo_t bBasicBoard::applyBlackMove | ( | bMove const & | m | ) |
Definition at line 407 of file basicboard.cpp.
Referenced by bMoveList::addBlackMoveIfValid(), bMoveList::addBlackPromotionIfValid(), applyMove(), and bBlackPiece::canMovePreflightCheck().
void bBasicBoard::unApplyMove | ( | bMove const & | m, |
boardInfo_t const | oldBoardInfo ) |
exact restoration of basic board using move details
Definition at line 493 of file basicboard.cpp.
Referenced by bBlackPiece::canMovePreflightCheck(), bWhitePiece::canMovePreflightCheck(), and SearchAlphaBeta::Quiescence().
boardInfo_t bBasicBoard::makeBoardMove | ( | column_t const | oldcol, |
rank_t const | oldrank, | ||
column_t const | newcol, | ||
rank_t const | newrank ) |
apply move to check if in check only, board to be discarded as it will be in incomplete state, no hash update no check flag set, etc.
promotion is not executed, pawn is kept at promotion place
oldcol | column from |
oldrank | rank from |
newcol | column to |
newrank | rank to |
Definition at line 568 of file basicboard.cpp.
Referenced by bBlackPiece::canMovePreflightCheck(), bWhitePiece::canMovePreflightCheck(), bBlackPiece::canPawnMovePreflightCheck(), and bWhitePiece::canPawnMovePreflightCheck().
void bBasicBoard::unMakeBoardMove | ( | case_t const & | cf, |
column_t const | newcol, | ||
rank_t const | newrank, | ||
boardInfo_t const | oldBoardInfo ) |
undo makeBoardMove, restoring previous situation
cf | case from |
newcol | column to |
newrank | rank to |
oldBoardInfo | the boardInfo of the old position Note: does not undo promotion properly |
Definition at line 641 of file basicboard.cpp.
Referenced by bBlackPiece::canMovePreflightCheck(), bWhitePiece::canMovePreflightCheck(), bBlackPiece::canPawnMovePreflightCheck(), and bWhitePiece::canPawnMovePreflightCheck().
|
protected |
Set hash based on board position, also calc pieces Byte 0: bits 4-6 capture count (masked) bit 7 player to move We are using 64 bits for hash.
Definition at line 275 of file basicboard.cpp.
Referenced by bBasicBoard(), and bBoard::invertColours().
Clear castle flag if rook captured update piece counter, update hash, clear field.
Definition at line 204 of file basicboard.cpp.
Referenced by applyBlackMove(), and applyWhiteMove().
Definition at line 253 of file basicboard.h.
Referenced by bBasicBoard(), and bBoard::invertColours().
|
inlineprotected |
Definition at line 261 of file basicboard.h.
Referenced by calcHash().
|
inlineprotected |
Definition at line 263 of file basicboard.h.
Referenced by calcHash().
|
inlineprotected |
Definition at line 265 of file basicboard.h.
Referenced by capturePieceOn().