libscid 0.1.0
Chess applications made easy.
Loading...
Searching...
No Matches
scid::core::Position Class Reference

Public Member Functions

void Clear ()
 
void StdStart ()
 
bool IsStdStart () const
 
errorT AddPiece (pieceT p, squareT sq)
 
bool isChess960 () const
 
byte PieceCount (pieceT p)
 
const byte * GetMaterial () const
 
void SetEPTarget (squareT s)
 
squareT GetEPTarget () const
 
void SetToMove (colorT c)
 
colorT GetToMove () const
 
bool WhiteToMove () const
 
void SetPlyCounter (ushort x)
 
ushort GetPlyCounter () const
 
ushort GetFullMoveCount () const
 
const squareT * GetList (colorT c) const
 
uint GetCount (colorT c) const
 
uint TotalMaterial () const
 
uint NumNonPawns (colorT c)
 
bool InPawnEnding ()
 
uint MaterialValue (colorT c)
 
uint FyleCount (pieceT p, fyleT f) const
 
uint RankCount (pieceT p, rankT r) const
 
uint LeftDiagCount (pieceT p, leftDiagT diag) const
 
uint RightDiagCount (pieceT p, rightDiagT diag) const
 
uint SquareColorCount (pieceT p, colorT sqColor) const
 
const pieceT * GetBoard () const
 
pieceT GetPiece (squareT sq) const
 
squareT GetKingSquare (colorT c) const
 
squareT GetKingSquare () const
 
squareT GetEnemyKingSquare () const
 
bool GetCastling (colorT c, castleDirT dir) const
 
byte GetCastlingFlags () const
 
bool validCastlingFlag (colorT color, bool king_side) const
 
uint HashValue (void) const
 
uint PawnHashValue (void) const
 
uint GetHPSig ()
 
void CalcPins ()
 
void GenPieceMoves (MoveList *mlist, squareT sq, SquareSet *sqset, bool capturesOnly)
 
void GenerateMoves (MoveList *mlist, pieceT mask, genMovesT genType, bool maybeInCheck)
 
void GenerateMoves (MoveList *mlist)
 
void GenerateMoves (MoveList *mlist, genMovesT genType)
 
void GenerateCaptures (MoveList *mlist)
 
int IsLegalMove (squareT from, squareT to, pieceT promo) const
 
template<bool check_legal = true>
bool canCastle (bool king_side) const
 Check that the minimum requirements for castling are satisfied:
 
uint CalcAttacks (colorT toMove, squareT kingSq, SquareList *squares) const
 
int TreeCalcAttacks (squareT target)
 
uint CalcNumChecks () const
 
uint CalcNumChecks (squareT kingSq) const
 
uint CalcNumChecks (squareT kingSq, SquareList *checkSquares) const
 
uint Mobility (pieceT p, colorT color, squareT from)
 
bool IsKingInCheck ()
 
bool IsKingInCheck (MoveAction const &sm)
 
bool IsKingInMate ()
 
bool IsLegal ()
 
bool IsPromoMove (squareT from, squareT to)
 
errorT parseMoveSpec (MoveSpec &spec, std::string_view notation)
 
errorT readCoordinateMoveSpec (MoveSpec &spec, std::string_view notation, bool reverse)
 
std::string makeSan (MoveSpec const &spec, sanFlagT flag)
 
errorT applyMove (MoveSpec const &spec)
 
errorT resolveMove (MoveSpec const &spec, MoveAction &action) const
 
void apply (MoveAction const &action)
 
void undo (MoveAction const &action)
 
void writeSan (MoveAction const &action, char *s, sanFlagT flag)
 
errorT applyCoordinateMoves (const char *moves, size_t movesLen, std::string *toSAN=nullptr)
 
void MakeLongStr (char *str) const
 
errorT ReadFromLongStr (const char *str)
 
errorT ReadFromFEN (const char *s)
 
errorT ReadFromFENorUCI (std::string_view str)
 
void PrintCompactStr (char *cboard) const
 
void PrintFEN (char *str, size_t len) const
 
void DumpLatexBoard (DString *dstr, bool flip)
 
void DumpLatexBoard (DString *dstr)
 
void DumpHtmlBoard (DString *dstr, uint style, const char *dir, bool flip)
 
void DumpHtmlBoard (DString *dstr, uint style, const char *dir)
 
int Compare (Position *p)
 
void CopyFrom (Position *src)
 
errorT Random (const char *material)
 

Static Public Member Functions

static const PositiongetStdStart ()
 

Member Function Documentation

◆ canCastle()

template<bool check_legal = true>
bool scid::core::Position::canCastle ( bool  king_side) const

Check that the minimum requirements for castling are satisfied:

  • both the king and the rook exists in the position
  • the final squares of the king and the rook are empty
    Parameters
    check_legalalso test for checks or blocking pieces. Ignore the castling flags and if the king is already in check.

The documentation for this class was generated from the following file: