
void ClearBoard (SBoard &Board );
int RemovePiece ( SBoard &Board, int x,  int y );
void AddPiece (SBoard &Board, int x, int y, char piece);
void Setup_StartBoard (SBoard &Board, int reset);
// Movelist

void Clear_Movelist(Movestruct &Movelist);
void inline AddCastleMove ( Movestruct &Movelist, unsigned char src, unsigned char dst, unsigned char type, unsigned char piece);

// Finding Moves

void FindMovesWhitePromotedPawn ( Movestruct *WMoves, SBoard &Board, unsigned char *Boardptr, int data);
void FindMovesBlackPromotedPawn ( Movestruct *WMoves, SBoard &Board, unsigned char *Boardptr, int data);
void FindAMovesWhitePromotedPawn ( Movestruct *WMoves, SBoard &Board, unsigned char *Boardptr, int data);
void FindAMovesBlackPromotedPawn ( Movestruct *WMoves, SBoard &Board, unsigned char *Boardptr, int data);

void FindMovesWhite(SBoard &Board, Movestruct &WMoves);
void FindMovesBlack(SBoard &Board, Movestruct &BMoves);

void FindHeavyMovesWhite(SBoard &Board, Movestruct &WMoves);
void FindHeavyMovesBlack(SBoard &Board, Movestruct &BMoves);

void FindAttackMovesWhite(SBoard &Board, Movestruct &WMoves);
void FindAttackMovesBlack(SBoard &Board, Movestruct &BMoves);

//
int IsAttacked (SBoard &Board, int square, int color);
int IsCheck ( unsigned char color, SBoard &Board);

void InitSquareArray ( void );

void FindMovesWhiteCh(SBoard &Board, Movestruct &Moves);
void FindMovesBlackCh(SBoard &Board, Movestruct &Moves);

int DiscoveredCheck ( int color, SBoard &TempBoard, int Move );
int CheckingMove( const int color, SBoard &TempBoard, const int Move);

// Doing Moves
struct STranscript;
int Do_Move (SBoard &Board, const int Move, int &u1, int &u2, const int ucUpgrade);
int DoMoveXY (SBoard &Board, int x, int y, int x2, int y2, unsigned char color, unsigned char nPiece, int bAdd, STranscript *pTranscript, int &src, int &dst);

extern unsigned int TouchChecks [256];

void SetIsCheck (Movestruct &Moves, SBoard &Board );
void InCheckMoveGenW (  SBoard &Board, Movestruct &Moves );
void InCheckMoveGenB (  SBoard &Board, Movestruct &Moves );

int TouchMatesB ( SBoard &Board, int depth );
int TouchMatesW ( SBoard &Board, int depth );