#define MAX_MOVES 700 // half moves
#define MAX_LEN 50000

// =======================================
// TRANSCRIPT
// =======================================
struct STranscript
	{
	int nMoves;
	char Moves[MAX_MOVES][8];
	};

struct SGameInfo
{
  char sWhitePlayer[128];
  char sBlackPlayer[128];
  char sEvent[128];
  char sResult[32];
  char sTimeControl[64];
  char sFEN[256];
  int tempTime;
  int nMinutes;
  int nSeconds;

  void Reset ();
};

// functions
void SaveBook();
int LoadOpeningBook(char *sName);
void AddtoBook ( int moves , unsigned char value);
int BookMove (SBoard &Board);
int FindBookMoves (SBoard &Board, int Moves[], int &found);
//
int SaveGame (int LastEval, char buffer[], int bAppend);
int LoadGame ( char buffer[],  int nGame, int bDisplay);
//
void ClearTranscript ( STranscript *pTranscript );
void AddOTranscript (int src, int dst, int index);
void AddTranscript (STranscript *pTranscript, int nMove, const SBoard &Board);

void ReplayGame ( SBoard &Board, int i);
int CopyPosition ( char *Text, SBoard Board );

int SetBoardFromText ( SBoard &InBoard, char *Text, int nLen, int bStart );
void GetMoveXYPGN (char textline[], SBoard &Board, int &sX, int &sY, int &dX, int &dY, unsigned char &piece);

void ReadString ( char *sIn, char *sOut);
int DoMovePGN(char textline[], SBoard &Board, int bAddTran, STranscript *pTranscript);
void GetMovesPGN(char text[], int bDoMove);

void DoTakeBack ( SBoard &Board, STranscript *pTranscript );
void GetLastMoveTranscript ( char **sMove );
int NumTranMoves ( );
void SetTranMoves ( SBoard &Board );
int ReadGame ( char *cliptext, struct _iobuf *fp, SGameInfo &Info);

int PGNtoBook ( char buffer[],  int nGame, int nStart, int nEnd, int nTimes, int nAddResults);