Belofte version 2.1.8
A promising chess program using the UCI or Winboard interface
|
board More...
#include <board.h>
Public Member Functions | |
bBoard (bBoard &&b) noexcept | |
Used when Push board on gamestack (playGameMove) | |
bBoard (bBoard const &b) | |
Used by bPgnMove ctor, popuplateMoveList, atLeastOneMovePossible movesinpgnformat. | |
bBoard (bBoard const &b, movenum_t const moveid) | |
Create copy of board with move applied on it, clear fields that reflect state before move is played used by CalcBestMove. | |
bBoard (bBoard const &b, bMove const &m) | |
Create copy of board with move applied on it, clear fields that reflect state before move is played, used for SearchPerft::CalcBestMove, add..MoveIfValid. | |
bBoard (bBoard const &b, bMove &m) | |
Create copy of board with move applied on it, clear fields that reflect state before move is played, used for playGameMove and applyMove Signature difference in const only!! | |
bBoard (bFen const &fen) | |
used by setFENInitialPos | |
~bBoard () override | |
bBoard & | operator= (bBoard const &)=delete |
bBoard & | operator= (bBoard &&)=delete |
operator std::string () const | |
bool | atLeastOneMovePossible () const |
see if at least one move can be played e.g. | |
bMoveList & | getMoveListRef () |
return reference to movelist | |
bMove const & | getMove (movenum_t const moveid) const |
void | calcPieces () |
void | calcGameStage () |
calculate pieces | |
bool | isNonSilent () const |
calculate gamestage | |
void | setNonSilent () |
bool | isCapture () const |
void | setCapture (piece_t const p, case_t const c) override |
set non-silent flag, store captured piece and case (for undo) | |
void | setInCheck () final |
void | invertColours () |
invert colours update kingpos, update colour to move, castle rights, ... | |
bGameStage | getStage () const |
bScore | getBoardEvaluation () const |
void | setBoardEvaluation (bScore const s) |
bScore | minimizing () const |
bool | castleDoneWhite () const |
-1 black to move, 1 white to move | |
bool | castleDoneBlack () const |
void | setCastleDoneWhite (bool const c) |
void | setCastleDoneBlack (bool const c) |
movesequence_t const & | getPreviousMoves () const |
void | setPreviousMoves (movesequence_t const &v) |
basicmove_t const & | getMovePlayed () const |
movesequence_t const & | getVariation () const |
void | clearVariation () |
void | setVariation (bBoard const &chldbrd) |
![]() | |
plynum_t | getPly () const |
void | setPly (plynum_t const p) |
void | incPly () |
void | decPly () |
case_t | getEp () const |
void | setEp (case_t const e) |
void | clearEp () |
movenum50_t | getPly50Moves () const |
void | setPly50Moves (movenum50_t const p) |
movenum50_t | incPly50Moves () |
void | clearPly50Moves () |
bool | canCastle () const |
bool | canCastle (uint8_t const f) const |
void | setCastle (uint8_t const f) |
void | setCastle (uint8_t const f, bool const c) |
void | clearCastle (uint8_t const f) |
bool | isInCheck () const |
void | clearInCheck () |
bool | whiteToMove () const |
int16_t | getMoveNumber () const |
side_t | getColourToMove () const |
piece_t | getPiece (case_t const bc) const |
1 for white, 2 for black | |
piece_t | getPiece (column_t const iColumn, rank_t const iRank) const |
piece_t | getPieceCtl (column_t const iColumn, rank_t const iRank) const |
retrieve piece with bounds checking, return field empty in case of out of bounds | |
void | setPiece (case_t const bc, piece_t const piece) |
used for promotion move generation | |
void | setPiece (case_t const bc, uint8_t const piece) |
used for unMakeBoardMove | |
piece_t | setGetPiece (column_t const newcol, rank_t const newrank, piece_t const piece) |
used for makeBoardMove | |
piece_t | removePiece (column_t const newcol, rank_t const newrank) |
used for makeBoardMove | |
void | movePiece (case_t const f, case_t const t, piece_t const p) |
void | swapPiece (case_t const t, piece_t const op, piece_t const np) |
void | clearPiece (case_t const bc) |
void | moveWhiteKing (case_t const f, case_t const t) |
void | moveBlackKing (case_t const f, case_t const t) |
bool | isFieldEmpty (case_t const bc) const |
bool | isFieldEmpty (column_t const iColumn, rank_t const iRank) const |
case_t | getWhiteKingPos () const |
case_t | getBlackKingPos () const |
bFen | getFEN () const |
std::string | getHashStr () const |
hashkey_t | getHash () const |
void | setHash (hashkey_t const newHash) |
u_positionFlags_t | makeBoardMove (column_t const oldcol, rank_t const oldrank, column_t const newcol, rank_t const newrank, piece_t const promotion) |
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, u_positionFlags_t const oldFlags, piece_t const promotion) |
undo makeBoardMove, restoring previous situation | |
Friends | |
class | bPositionEvaluation |
class | PosEvalPositionalBoard |
class | bWhitePiece |
class | bBlackPiece |
std::ostream & | operator<< (std::ostream &os, bBoard const &dt) |
print board | |
Additional Inherited Members | ||
![]() | ||
bBasicBoard () | ||
bBasicBoard (bBasicBoard const &bb) | ||
bBasicBoard (bBasicBoard &&bb) | ||
bBasicBoard (bFen const &fen) | ||
virtual | ~bBasicBoard () | |
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 | setPieceKU (case_t const bc, piece_t const piece) | |
calculate and set hash | ||
![]() | ||
union { | ||
uint64_t u_positionFlags = 0ULL | ||
struct { | ||
case_t m_whiteKing | ||
case_t m_blackKing | ||
plynum_t m_ply | ||
case_t m_ep | ||
movenum50_t m_ply50moves | ||
uint8_t m_castling | ||
piece_t m_capturedpiece | ||
4 castling bits as uints as copy ctor stumbles on bool array More... | ||
} | ||
}; | ||
hashkey_t | m_hash | |
|
explicitnoexcept |
|
explicit |
Create copy of board with move applied on it, clear fields that reflect state before move is played, used for SearchPerft::CalcBestMove, add..MoveIfValid.
b | existing board |
m | move to be applied |
Create copy of board with move applied on it, clear fields that reflect state before move is played, used for playGameMove and applyMove Signature difference in const only!!
b | existing board |
m | move to be applied |
Definition at line 621 of file board.cpp.
|
explicit |
bBoard::operator std::string | ( | ) | const |
bool bBoard::atLeastOneMovePossible | ( | ) | const |
see if at least one move can be played e.g.
(stale-)mate eval
Definition at line 962 of file board.cpp.
Referenced by bPositionEvaluation::isGameEnded().
bMoveList & bBoard::getMoveListRef | ( | ) |
return reference to movelist
Definition at line 954 of file board.cpp.
Referenced by bBoard(), bPgnMoveList::bPgnMoveList(), SearchEvalPosOnly::CalcBestMove(), SearchRandom::CalcBestMove(), SearchAlphaBeta::CalcBestMove(), SearchAlphaBetaFH::CalcBestMove(), bel_debug::execute(), SearchAlphaBeta::Quiescence(), bGame::revertGameMove(), and bSearchAlgorithm::SearchBestMove().
Definition at line 967 of file board.cpp.
Referenced by bBoard(), bGame::evalEpdPosition(), bSearchAlgorithm::sendInfoCurrMove(), and bGame::WaitForSearchEnd().
void bBoard::calcPieces | ( | ) |
void bBoard::calcGameStage | ( | ) |
|
inline |
set non-silent flag, store captured piece and case (for undo)
Reimplemented from bBasicBoard.
Definition at line 795 of file board.cpp.
|
finalvirtual |
Reimplemented from bBasicBoard.
Definition at line 803 of file board.cpp.
void bBoard::invertColours | ( | ) |
invert colours update kingpos, update colour to move, castle rights, ...
castledone, capturedcase, capturedpiece, moveplayed, eval
epcase
force recalculation of pieces
Definition at line 764 of file board.cpp.
Referenced by bel_debug::execute(), and cmd_eval::execute().
|
inline |
Definition at line 177 of file board.h.
Referenced by cmd_eval::execute(), PosEvalStaticBoard::getEvaluation(), and PosEvalPositionalBoard::getEvaluation().
|
inline |
Definition at line 178 of file board.h.
Referenced by bSearchAlgorithm::RetrieveBoardEvaluation().
|
inline |
Definition at line 179 of file board.h.
Referenced by bSearchAlgorithm::RetrieveBoardEvaluation().
|
inline |
Definition at line 180 of file board.h.
Referenced by bGame::EvalForPlayer(), cmd_eval::execute(), bSearchAlgorithm::SearchBestMove(), bSearchAlgorithm::sendInfoScore(), and bSearchAlgorithm::sendInfoSearching().
|
inline |
|
inline |
Definition at line 186 of file board.h.
Referenced by bBoard(), UCIMode::sendInfoCurrMove(), UCIMode::sendInfoScore(), UCIMode::sendInfoSearching(), XboardMode::sendInfoSearching(), and setVariation().
|
inline |
Definition at line 187 of file board.h.
Referenced by bSearchAlgorithm::SearchBestMove().
|
inline |
|
inline |
Definition at line 189 of file board.h.
Referenced by UCIMode::sendInfoCurrMove(), UCIMode::sendInfoScore(), UCIMode::sendInfoSearching(), XboardMode::sendInfoSearching(), and setVariation().
void bBoard::clearVariation | ( | ) |
Definition at line 974 of file board.cpp.
Referenced by bSearchAlgorithm::SearchBestMove().
void bBoard::setVariation | ( | bBoard const & | chldbrd | ) |
Definition at line 979 of file board.cpp.
Referenced by SearchAlphaBeta::CalcBestMove(), SearchAlphaBetaFH::CalcBestMove(), and SearchAlphaBeta::Quiescence().
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
basicmove_t bBoard::m_moveplayed |
Definition at line 210 of file board.h.
Referenced by getMovePlayed().
uint8_t bBoard::m_bNonSilent |
Definition at line 211 of file board.h.
Referenced by isNonSilent(), setCapture(), setInCheck(), and setNonSilent().
uint8_t bBoard::m_piecesonboard |
Definition at line 212 of file board.h.
Referenced by calcGameStage(), calcPieces(), and invertColours().
uint8_t bBoard::m_whiteminor |
Definition at line 213 of file board.h.
Referenced by calcGameStage(), and calcPieces().
uint8_t bBoard::m_blackminor |
Definition at line 214 of file board.h.
Referenced by calcGameStage(), and calcPieces().
bGameStage bBoard::m_gamestage |
Definition at line 215 of file board.h.
Referenced by calcGameStage(), and getStage().
case_t bBoard::m_capturedcase |
Definition at line 216 of file board.h.
Referenced by setCapture().
uint8_t bBoard::m_castledoneWhite |
Definition at line 223 of file board.h.
Referenced by castleDoneWhite(), and setCastleDoneWhite().
uint8_t bBoard::m_castledoneBlack |
Definition at line 224 of file board.h.
Referenced by castleDoneBlack(), and setCastleDoneBlack().
bScore bBoard::m_boardeval = SCORE_UNDEFINED |
Definition at line 225 of file board.h.
Referenced by bBoard(), getBoardEvaluation(), and setBoardEvaluation().