16 #ifndef SCID_POSITION_H 17 #define SCID_POSITION_H 89 byte NumOnRank[16][8];
90 byte NumOnFyle[16][8];
91 byte NumOnLeftDiag[16][16];
92 byte NumOnRightDiag[16][16];
93 byte NumOnSquareColor[16][2];
127 void GenCastling (
MoveList * mlist);
149 static const Position& getStdStart();
153 bool IsStdStart()
const;
177 return (NumNonPawns(
WHITE) == 1 && NumNonPawns(
BLACK) == 1);
181 return NumOnFyle[p][f];
184 return NumOnRank[p][r];
187 return NumOnLeftDiag[p][diag];
190 return NumOnRightDiag[p][diag];
193 return NumOnSquareColor[p][sqColor];
215 int b = (c ==
WHITE) ? 1 : 4;
245 return CalcAttacks (1-ToMove, GetKingSquare(), NULL);
248 return CalcAttacks (1-ToMove, kingSq, NULL);
251 return CalcAttacks (1-ToMove, kingSq, checkSquares);
258 bool IsKingInMate ();
277 void MakeLongStr (
char * str);
278 errorT ReadFromLongStr (
const char * str);
280 errorT ReadFromFEN (
const char * s);
281 void PrintCompactStr (
char * cboard);
282 void PrintCompactStrFlipped (
char * cboard);
284 return (Board[0] << 4) | Board[1];
286 void PrintFEN(
char* str,
uint flags)
const;
289 DumpLatexBoard (dstr,
false);
291 void DumpHtmlBoard (
DString * dstr,
uint style,
const char * dir,
294 DumpHtmlBoard (dstr, style, dir,
false);
319 if (dir ==
KSIDE) b += b;
321 if (flag) { Castling |= b; }
else { Castling &= (255-b); }
325 #endif // SCID_POSITION_H void GenerateCaptures(MoveList *mlist)
void SetCastlingFlags(byte b)
uint FyleCount(pieceT p, fyleT f) const
void GenerateMoves(MoveList *mlist)
squareT GetEPTarget() const
uint RightDiagCount(pieceT p, rightDiagT diag)
squareT GetKingSquare(colorT c)
const uint MAX_LEGAL_MOVES
const squareT * GetList(colorT c) const
pieceT GetPiece(squareT sq) const
uint CalcNumChecks(squareT kingSq, SquareList *checkSquares)
void CopyFrom(Position *src)
uint NumNonPawns(colorT c)
byte PieceCount(pieceT p)
const pieceT * GetBoard() const
void SetCastling(colorT c, castleDirT dir, bool flag)
ushort GetFullMoveCount() const
void DumpHtmlBoard(DString *dstr, uint style, const char *dir)
uint LeftDiagCount(pieceT p, leftDiagT diag)
squareT * GetList(colorT c)
ushort GetPlyCounter() const
byte CompactStrFirstByte()
void SetEPTarget(squareT s)
const sanFlagT SAN_NO_CHECKTEST
const sanFlagT SAN_CHECKTEST
void SetPlyCounter(ushort x)
const genMovesT GEN_CAPTURES
const genMovesT GEN_ALL_MOVES
uint RankCount(pieceT p, rankT r) const
uint SquareColorCount(pieceT p, colorT sqColor)
const byte * GetMaterial() const
const genMovesT GEN_NON_CAPS
void GenerateMoves(MoveList *mlist, genMovesT genType)
squareT GetEnemyKingSquare()
const squareT COLOR_SQUARE
uint CalcNumChecks(squareT kingSq)
void DumpLatexBoard(DString *dstr)
pieceT piece_Make(colorT c, pieceT p)
sanStringT list[MAX_LEGAL_MOVES]
uint GetCount(colorT c) const
const uint FEN_CASTLING_EP
bool GetCastling(colorT c, castleDirT dir) const
const sanFlagT SAN_MATETEST
const uint FEN_ALL_FIELDS