Scid  4.7.0
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Public Member Functions | Static Public Member Functions | List of all members
Position Class Reference

#include <position.h>

Public Member Functions

 Position ()
 
void Clear ()
 
void StdStart ()
 
bool IsStdStart () const
 
errorT AddPiece (pieceT p, squareT sq)
 
byte PieceCount (pieceT p)
 
const byteGetMaterial () const
 
void SetEPTarget (squareT s)
 
squareT GetEPTarget () const
 
void SetToMove (colorT c)
 
colorT GetToMove () const
 
void SetPlyCounter (ushort x)
 
ushort GetPlyCounter () const
 
ushort GetFullMoveCount () const
 
const squareTGetList (colorT c) const
 
squareTGetList (colorT c)
 
uint GetCount (colorT c) const
 
uint TotalMaterial ()
 
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)
 
uint RightDiagCount (pieceT p, rightDiagT diag)
 
uint SquareColorCount (pieceT p, colorT sqColor)
 
uint GetSquares (pieceT p, SquareList *sqlist)
 
const pieceTGetBoard () const
 
pieceT GetPiece (squareT sq) const
 
squareT GetKingSquare (colorT c)
 
squareT GetKingSquare ()
 
squareT GetEnemyKingSquare ()
 
void SetCastling (colorT c, castleDirT dir, bool flag)
 
bool GetCastling (colorT c, castleDirT dir) const
 
bool CastlingPossible ()
 
byte GetCastlingFlags ()
 
void SetCastlingFlags (byte b)
 
uint HashValue (void)
 
uint PawnHashValue (void)
 
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)
 
bool IsLegalMove (simpleMoveT *sm)
 
uint CalcAttacks (colorT toMove, squareT kingSq, SquareList *squares)
 
int TreeCalcAttacks (colorT toMove, squareT target)
 
uint CalcNumChecks ()
 
uint CalcNumChecks (squareT kingSq)
 
uint CalcNumChecks (squareT kingSq, SquareList *checkSquares)
 
uint Mobility (pieceT p, colorT color, squareT from)
 
bool IsKingInCheck ()
 
bool IsKingInCheckDir (directionT dir)
 
bool IsKingInCheck (simpleMoveT *sm)
 
bool IsKingInMate ()
 
bool IsLegal ()
 
bool IsPromoMove (squareT from, squareT to)
 
void DoSimpleMove (simpleMoveT *sm)
 
void UndoSimpleMove (simpleMoveT *sm)
 
errorT RelocatePiece (squareT fromSq, squareT toSq)
 
void MakeSANString (simpleMoveT *sm, char *s, sanFlagT flag)
 
void MakeUCIString (simpleMoveT *sm, char *s)
 
void CalcSANStrings (sanListT *sanList, sanFlagT flag)
 
errorT ReadCoordMove (simpleMoveT *m, const char *s, int slen, bool reverse)
 
errorT ParseMove (simpleMoveT *sm, const char *str)
 
errorT ParseMove (simpleMoveT *sm, const char *begin, const char *end)
 
void MakeLongStr (char *str)
 
errorT ReadFromLongStr (const char *str)
 
errorT ReadFromCompactStr (const byte *str)
 
errorT ReadFromFEN (const char *s)
 
void PrintCompactStr (char *cboard)
 
void PrintCompactStrFlipped (char *cboard)
 
byte CompactStrFirstByte ()
 
void PrintFEN (char *str, uint flags) 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 ()
 

Detailed Description

Definition at line 74 of file position.h.

Constructor & Destructor Documentation

◆ Position()

Position::Position ( )

Definition at line 547 of file position.cpp.

Member Function Documentation

◆ AddPiece()

errorT Position::AddPiece ( pieceT  p,
squareT  sq 
)

Definition at line 670 of file position.cpp.

◆ CalcAttacks()

uint Position::CalcAttacks ( colorT  toMove,
squareT  kingSq,
SquareList squares 
)

Definition at line 1198 of file position.cpp.

◆ CalcNumChecks() [1/3]

uint Position::CalcNumChecks ( )
inline

Definition at line 244 of file position.h.

◆ CalcNumChecks() [2/3]

uint Position::CalcNumChecks ( squareT  kingSq)
inline

Definition at line 247 of file position.h.

◆ CalcNumChecks() [3/3]

uint Position::CalcNumChecks ( squareT  kingSq,
SquareList checkSquares 
)
inline

Definition at line 250 of file position.h.

◆ CalcPins()

void Position::CalcPins ( void  )

Definition at line 711 of file position.cpp.

◆ CalcSANStrings()

void Position::CalcSANStrings ( sanListT sanList,
sanFlagT  flag 
)

Definition at line 2474 of file position.cpp.

◆ CastlingPossible()

bool Position::CastlingPossible ( )
inline

Definition at line 221 of file position.h.

◆ Clear()

void Position::Clear ( void  )

Definition at line 563 of file position.cpp.

◆ CompactStrFirstByte()

byte Position::CompactStrFirstByte ( )
inline

Definition at line 283 of file position.h.

◆ Compare()

sint Position::Compare ( Position p)

Definition at line 2982 of file position.cpp.

◆ CopyFrom()

void Position::CopyFrom ( Position src)
inline

Definition at line 299 of file position.h.

◆ DoSimpleMove()

void Position::DoSimpleMove ( simpleMoveT sm)

Definition at line 1578 of file position.cpp.

◆ DumpHtmlBoard() [1/2]

void Position::DumpHtmlBoard ( DString dstr,
uint  style,
const char *  dir,
bool  flip 
)

Definition at line 2879 of file position.cpp.

◆ DumpHtmlBoard() [2/2]

void Position::DumpHtmlBoard ( DString dstr,
uint  style,
const char *  dir 
)
inline

Definition at line 293 of file position.h.

◆ DumpLatexBoard() [1/2]

void Position::DumpLatexBoard ( DString dstr,
bool  flip 
)

Definition at line 2955 of file position.cpp.

◆ DumpLatexBoard() [2/2]

void Position::DumpLatexBoard ( DString dstr)
inline

Definition at line 288 of file position.h.

◆ FyleCount()

uint Position::FyleCount ( pieceT  p,
fyleT  f 
) const
inline

Definition at line 180 of file position.h.

◆ GenerateCaptures()

void Position::GenerateCaptures ( MoveList mlist)
inline

Definition at line 239 of file position.h.

◆ GenerateMoves() [1/3]

void Position::GenerateMoves ( MoveList mlist,
pieceT  mask,
genMovesT  genType,
bool  maybeInCheck 
)

Definition at line 784 of file position.cpp.

◆ GenerateMoves() [2/3]

void Position::GenerateMoves ( MoveList mlist)
inline

Definition at line 237 of file position.h.

◆ GenerateMoves() [3/3]

void Position::GenerateMoves ( MoveList mlist,
genMovesT  genType 
)
inline

Definition at line 238 of file position.h.

◆ GenPieceMoves()

void Position::GenPieceMoves ( MoveList mlist,
squareT  sq,
SquareSet sqset,
bool  capturesOnly 
)

Definition at line 752 of file position.cpp.

◆ GetBoard()

const pieceT* Position::GetBoard ( ) const
inline

Definition at line 197 of file position.h.

◆ GetCastling()

bool Position::GetCastling ( colorT  c,
castleDirT  dir 
) const
inline

Definition at line 214 of file position.h.

◆ GetCastlingFlags()

byte Position::GetCastlingFlags ( )
inline

Definition at line 222 of file position.h.

◆ GetCount()

uint Position::GetCount ( colorT  c) const
inline

Definition at line 171 of file position.h.

◆ GetEnemyKingSquare()

squareT Position::GetEnemyKingSquare ( )
inline

Definition at line 210 of file position.h.

◆ GetEPTarget()

squareT Position::GetEPTarget ( ) const
inline

Definition at line 160 of file position.h.

◆ GetFullMoveCount()

ushort Position::GetFullMoveCount ( ) const
inline

Definition at line 165 of file position.h.

◆ GetHPSig()

uint Position::GetHPSig ( void  )

Definition at line 523 of file position.cpp.

◆ GetKingSquare() [1/2]

squareT Position::GetKingSquare ( colorT  c)
inline

Definition at line 208 of file position.h.

◆ GetKingSquare() [2/2]

squareT Position::GetKingSquare ( )
inline

Definition at line 209 of file position.h.

◆ GetList() [1/2]

const squareT* Position::GetList ( colorT  c) const
inline

Definition at line 169 of file position.h.

◆ GetList() [2/2]

squareT* Position::GetList ( colorT  c)
inline

Definition at line 170 of file position.h.

◆ GetMaterial()

const byte* Position::GetMaterial ( ) const
inline

Definition at line 158 of file position.h.

◆ GetPiece()

pieceT Position::GetPiece ( squareT  sq) const
inline

Definition at line 202 of file position.h.

◆ GetPlyCounter()

ushort Position::GetPlyCounter ( ) const
inline

Definition at line 164 of file position.h.

◆ GetSquares()

uint Position::GetSquares ( pieceT  p,
SquareList sqlist 
)

Definition at line 3001 of file position.cpp.

◆ getStdStart()

const Position & Position::getStdStart ( )
static

Definition at line 594 of file position.cpp.

◆ GetToMove()

colorT Position::GetToMove ( ) const
inline

Definition at line 162 of file position.h.

◆ HashValue()

uint Position::HashValue ( void  )
inline

Definition at line 226 of file position.h.

◆ InPawnEnding()

bool Position::InPawnEnding ( )
inline

Definition at line 176 of file position.h.

◆ IsKingInCheck() [1/2]

bool Position::IsKingInCheck ( )
inline

Definition at line 255 of file position.h.

◆ IsKingInCheck() [2/2]

bool Position::IsKingInCheck ( simpleMoveT sm)

Definition at line 1416 of file position.cpp.

◆ IsKingInCheckDir()

bool Position::IsKingInCheckDir ( directionT  dir)

Definition at line 1345 of file position.cpp.

◆ IsKingInMate()

bool Position::IsKingInMate ( void  )

Definition at line 1513 of file position.cpp.

◆ IsLegal()

bool Position::IsLegal ( void  )

Definition at line 1533 of file position.cpp.

◆ IsLegalMove()

bool Position::IsLegalMove ( simpleMoveT sm)

Definition at line 874 of file position.cpp.

◆ IsPromoMove()

bool Position::IsPromoMove ( squareT  from,
squareT  to 
)

Definition at line 1555 of file position.cpp.

◆ IsStdStart()

bool Position::IsStdStart ( ) const

Definition at line 650 of file position.cpp.

◆ LeftDiagCount()

uint Position::LeftDiagCount ( pieceT  p,
leftDiagT  diag 
)
inline

Definition at line 186 of file position.h.

◆ MakeLongStr()

void Position::MakeLongStr ( char *  str)

Definition at line 2526 of file position.cpp.

◆ MakeSANString()

void Position::MakeSANString ( simpleMoveT sm,
char *  s,
sanFlagT  flag 
)

Definition at line 1888 of file position.cpp.

◆ MakeUCIString()

void Position::MakeUCIString ( simpleMoveT sm,
char *  s 
)

Definition at line 2038 of file position.cpp.

◆ MaterialValue()

uint Position::MaterialValue ( colorT  c)

Definition at line 1860 of file position.cpp.

◆ Mobility()

uint Position::Mobility ( pieceT  p,
colorT  color,
squareT  from 
)

Definition at line 1477 of file position.cpp.

◆ NumNonPawns()

uint Position::NumNonPawns ( colorT  c)
inline

Definition at line 173 of file position.h.

◆ ParseMove() [1/2]

errorT Position::ParseMove ( simpleMoveT sm,
const char *  str 
)

Definition at line 2373 of file position.cpp.

◆ ParseMove() [2/2]

errorT Position::ParseMove ( simpleMoveT sm,
const char *  begin,
const char *  end 
)

Definition at line 2388 of file position.cpp.

◆ PawnHashValue()

uint Position::PawnHashValue ( void  )
inline

Definition at line 227 of file position.h.

◆ PieceCount()

byte Position::PieceCount ( pieceT  p)
inline

Definition at line 157 of file position.h.

◆ PrintCompactStr()

void Position::PrintCompactStr ( char *  cboard)

Definition at line 2578 of file position.cpp.

◆ PrintCompactStrFlipped()

void Position::PrintCompactStrFlipped ( char *  cboard)

Definition at line 2607 of file position.cpp.

◆ PrintFEN()

void Position::PrintFEN ( char *  str,
uint  flags 
) const

Definition at line 2804 of file position.cpp.

◆ Random()

errorT Position::Random ( const char *  material)

Definition at line 3025 of file position.cpp.

◆ RankCount()

uint Position::RankCount ( pieceT  p,
rankT  r 
) const
inline

Definition at line 183 of file position.h.

◆ ReadCoordMove()

errorT Position::ReadCoordMove ( simpleMoveT m,
const char *  s,
int  slen,
bool  reverse 
)

Definition at line 2081 of file position.cpp.

◆ ReadFromCompactStr()

errorT Position::ReadFromCompactStr ( const byte str)

Definition at line 2550 of file position.cpp.

◆ ReadFromFEN()

errorT Position::ReadFromFEN ( const char *  s)

Definition at line 2638 of file position.cpp.

◆ ReadFromLongStr()

errorT Position::ReadFromLongStr ( const char *  str)

Definition at line 2486 of file position.cpp.

◆ RelocatePiece()

errorT Position::RelocatePiece ( squareT  fromSq,
squareT  toSq 
)

Definition at line 1805 of file position.cpp.

◆ RightDiagCount()

uint Position::RightDiagCount ( pieceT  p,
rightDiagT  diag 
)
inline

Definition at line 189 of file position.h.

◆ SetCastling()

void Position::SetCastling ( colorT  c,
castleDirT  dir,
bool  flag 
)
inline

Definition at line 316 of file position.h.

◆ SetCastlingFlags()

void Position::SetCastlingFlags ( byte  b)
inline

Definition at line 223 of file position.h.

◆ SetEPTarget()

void Position::SetEPTarget ( squareT  s)
inline

Definition at line 159 of file position.h.

◆ SetPlyCounter()

void Position::SetPlyCounter ( ushort  x)
inline

Definition at line 163 of file position.h.

◆ SetToMove()

void Position::SetToMove ( colorT  c)
inline

Definition at line 161 of file position.h.

◆ SquareColorCount()

uint Position::SquareColorCount ( pieceT  p,
colorT  sqColor 
)
inline

Definition at line 192 of file position.h.

◆ StdStart()

void Position::StdStart ( )
inline

Definition at line 152 of file position.h.

◆ TotalMaterial()

uint Position::TotalMaterial ( )
inline

Definition at line 172 of file position.h.

◆ TreeCalcAttacks()

int Position::TreeCalcAttacks ( colorT  toMove,
squareT  target 
)

Definition at line 1161 of file position.cpp.

◆ UndoSimpleMove()

void Position::UndoSimpleMove ( simpleMoveT sm)

Definition at line 1721 of file position.cpp.


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