Scid  4.6.5
game.h
Go to the documentation of this file.
1 //////////////////////////////////////////////////////////////////////
2 //
3 // FILE: game.h
4 // Game class for Scid.
5 //
6 // Part of: Scid (Shane's Chess Information Database)
7 // Version: 3.5
8 //
9 // Notice: Copyright (c) 2000-2003 Shane Hudson. All rights reserved.
10 //
11 // Author: Shane Hudson (sgh@users.sourceforge.net)
12 //
13 //////////////////////////////////////////////////////////////////////
14 
15 
16 #ifndef SCID_GAME_H
17 #define SCID_GAME_H
18 
19 #include "common.h"
20 #include "date.h"
21 #include "indexentry.h"
22 #include "position.h"
23 #include "namebase.h"
24 #include "matsig.h"
25 #include <vector>
26 #include <string>
27 class ByteBuffer;
28 class TextBuffer;
29 
30 void transPieces(char *s);
31 char transPiecesChar(char c);
32 
33 // Piece letters translation
34 extern int language; // default to english
35 // 0 = en, 1 = fr, 2 = es, 3 = de
36 extern const char * langPieces[];
37 
38 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
39 // Game: Constants
40 
41 // Common NAG Annotation symbol values:
42 const byte
49  NAG_OnlyMove = 8, // new
50  NAG_Equal = 10,
60  NAG_ZugZwang = 22, // new
61  NAG_BlackZugZwang = 23, // new
62  NAG_MoreRoom = 26, // new
64  NAG_WithInitiative = 36, //new
65  NAG_WithAttack = 40, // new
66  NAG_WithBlackAttack = 41, // new
67  NAG_Compensation = 44, // from Whites perspective
68  NAG_SlightCentre = 48, // from Whites perspective
69  NAG_Centre = 50, // new
70  NAG_SlightKingSide = 54, // from Whites perspective
71  NAG_ModerateKingSide = 56, // from Whites perspective
72  NAG_KingSide = 58, // from Whites perspective
73  NAG_SlightQueenSide = 60, // from Whites perspective
74  NAG_ModerateQueenSide = 62, // from Whites perspective
75  NAG_QueenSide = 64, // from Whites perspective
76  NAG_SlightCounterPlay = 130, // new
77  NAG_CounterPlay = 132, // new
80  NAG_BlackCounterPlay = 133, // new
82  NAG_TimeLimit = 136, // new
83  NAG_WithIdea = 140, // new
84  NAG_BetterIs = 142, // new
85  NAG_VariousMoves = 144, // new
86  NAG_Comment = 145, // new
87  NAG_Novelty = 146,
88  NAG_WeakPoint = 147, // new
89  NAG_Ending = 148, // new
90  NAG_File = 149, // new
91  NAG_Diagonal = 150, // new
92  NAG_BishopPair = 151, // new
93  NAG_OppositeBishops = 153, // new
94  NAG_SameBishops = 154, // new
95  NAG_Etc = 190, // new
96  NAG_DoublePawns = 191, // new
97  NAG_SeparatedPawns = 192, // new
98  NAG_UnitedPawns = 193, // new
99  NAG_Diagram = 201, // Scid-specific NAGs start at 201.
100  NAG_See = 210, // new
101  NAG_Mate = 211, // new
102  NAG_PassedPawn = 212, // new
103  NAG_MorePawns = 213, //new
104  NAG_With = 214, // new
105  NAG_Without = 215;
106 
107 // MAX_NAGS: Maximum id of NAG codes
108 const byte MAX_NAGS_ARRAY = 215;
109 
110 // MAX_TAGS: Maximum number of additional non-standard tags.
111 const uint MAX_TAGS = 40;
112 
113 const uint MAX_TAG_LEN = 240;
114 
115 typedef byte markerT;
116 const markerT
120  END_GAME = 3;
121 
122 
123 // patternT structure: a pattern filter for material searches.
124 // It can specify, for example, a white Pawn on the f-fyle, or
125 // a black Bishop on f2 and white King on e1.
126 struct patternT
127 {
128  pieceT pieceMatch; // EMPTY, WK, BK, etc...
129  rankT rankMatch; // RANK_1 .. RANK_8 or NO_RANK
130  fyleT fyleMatch; // A_FYLE .. H_FYLE or NO_FYLE
131  byte flag; // 0 means this pattern must NOT occur.
133 };
134 
135 // MAX_NAGS is the maximum number of NAGs (annotation symbols) a single
136 // move can have:
137 
138 #define MAX_NAGS 8
139 
140 
141 // The moveT structure stores all necessary information for one move:
142 //
143 class moveT
144 {
145  friend class Game;
146  simpleMoveT moveData; // piece moving, target square etc
147  char san[10]; // SAN representation of move
148  std::string comment;
149  moveT * prev;
150  moveT * next;
151  moveT * varChild;
152  moveT * varParent;
153  markerT marker; // can be NO_MARKER, START_MARKER or END_MARKER
154  byte numVariations;
155  byte nagCount;
156  byte nags[MAX_NAGS];
157 
158  bool isNull () const { return moveData.isNullMove(); }
159 };
160 
161 
162 
163 // Since we want allocation and freeing of moves to be FAST, we allocate
164 // in chunks, and keep a linked list of the chunks allocated.
165 // Freed moves can be added to the FreeList, but it is not essential to
166 // do so, since all space for moves is deleted when the game is cleared.
167 #define MOVE_CHUNKSIZE 100 // Allocate space for 100 moves at a time.
168 
169 struct moveChunkT {
173 };
174 
175 struct tagT
176 {
177  char * tag;
178  char * value;
179 };
180 
181 
182 #define GAME_DECODE_NONE 0
183 #define GAME_DECODE_TAGS 1
184 #define GAME_DECODE_COMMENTS 2
185 #define GAME_DECODE_ALL 3
186 
192 };
193 
195  PGN_FORMAT_Plain = 0, // Plain regular PGN output
196  PGN_FORMAT_HTML = 1, // HTML format
197  PGN_FORMAT_LaTeX = 2, // LaTeX (with chess12 package) format
198  PGN_FORMAT_Color = 3 // PGN, with color tags <red> etc
199 };
200 
201 #define PGN_STYLE_TAGS 1
202 #define PGN_STYLE_COMMENTS 2
203 #define PGN_STYLE_VARS 4
204 #define PGN_STYLE_INDENT_COMMENTS 8
205 #define PGN_STYLE_INDENT_VARS 16
206 #define PGN_STYLE_SYMBOLS 32 // e.g. "! +-" instead of "$2 $14"
207 #define PGN_STYLE_SHORT_HEADER 64
208 #define PGN_STYLE_MOVENUM_SPACE 128 // Space after move numbers.
209 #define PGN_STYLE_COLUMN 256 // Column style: one move per line.
210 #define PGN_STYLE_SCIDFLAGS 512
211 #define PGN_STYLE_STRIP_MARKS 1024 // Strip [%mark] and [%arrow] codes.
212 #define PGN_STYLE_NO_NULL_MOVES 2048 // Convert null moves to comments.
213 #define PGN_STYLE_UNICODE 4096 // Use U+2654..U+2659 for figurine
214 
215 
216 void game_printNag (byte nag, char * str, bool asSymbol, gameFormatT format);
217 byte game_parseNag (const char * str);
218 
219 uint strGetRatingType (const char * name);
220 
221 
222 //////////////////////////////////////////////////////////////////////
223 // Game: Class Definition
224 
225 static Position staticPosition;
226 
227 class Game
228 {
229 private:
230  //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
231  // Game: Data structures
232 
233  bool NonStandardStart; // 1 if non-standard start.
234  colorT ToMove; // side to move in starting position
235  ushort NumHalfMoves;
236  ushort CurrentPlyCount;
237  ushort StartPlyCount;
238  bool KeepDecodedMoves;
239 
240  Game * NextGame; // For keeping a linked list of games.
241  bool Altered;
242 
243  matSigT FinalMatSig;
244 
245  bool PromotionsFlag; // True if game has a promotion.
246  bool UnderPromosFlag; // True if game has a promotion to R/B/N.
247  char ScidFlags [20];
248 
249  moveChunkT * MoveChunk;
250  moveT * FreeList;
251 
252  std::string EventStr;
253  std::string SiteStr;
254  std::string WhiteStr;
255  std::string BlackStr;
256  std::string RoundStr;
257  dateT Date;
258  dateT EventDate;
259  resultT Result;
260  ecoT EcoCode;
261  eloT WhiteElo;
262  eloT BlackElo;
263  byte WhiteRatingType;
264  byte BlackRatingType;
265  eloT WhiteEstimateElo;
266  eloT BlackEstimateElo;
267 
268  Position * StartPos;
269  Position * CurrentPos;
270 
271  moveT * FirstMove;
272  moveT * CurrentMove;
273  uint VarDepth; // Current variation depth.
274 
275  // For saving and restoring game state:
276  Position * SavedPos;
277  moveT * SavedMove;
278  ushort SavedPlyCount;
279  uint SavedVarDepth;
280 
281  const NameBase* NBase; // needed for referencing id numbers.
282 
283  tagT TagList [ MAX_TAGS];
284  uint NumTags;
285 
286  uint NumMovesPrinted; // Used in recursive WriteMoveList method.
287  uint StopLocation; // Used in recursive WriteMoveList method.
288 
289  uint PgnStyle; // see PGN_STYLE macros above.
290  gameFormatT PgnFormat; // see PGN_FORMAT macros above.
291  uint HtmlStyle; // HTML diagram style, see
292  // DumpHtmlBoard method in position.cpp.
293  uint PgnLastMovePos;
294 
295  //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
296  // Game: Private Functions
297  Game(const Game&);
298  Game& operator=(const Game&);
299 
300  void AllocateMoreMoves ();
301  inline moveT * NewMove();
302  inline void FreeMove (moveT * move);
303 
304  errorT DecodeVariation (ByteBuffer * buf, byte flags, uint level);
305  bool calcAbsPlyNumber_ (moveT *m, moveT *s);
306 
307  static void encodeMove (ByteBuffer * buf, moveT * m);
308  static errorT encodeVariation (ByteBuffer * buf, moveT * m,
309  uint * subVarCount, uint * nagCount, uint depth);
310  static errorT encodeComments (ByteBuffer * buf, moveT * m, uint * commentCounter);
311  static errorT decodeComments (ByteBuffer * buf, moveT * m);
312 
313 public:
314  Game() { Init(); }
315  ~Game();
316 
317  void Clear();
318  void ClearMoves();
319 
320  void Init();
321 
322  // Set and Get attributes -- one-line (inline) methods
323  void SetNumHalfMoves (ushort x) { NumHalfMoves = x; }
324  ushort GetNumHalfMoves () { return NumHalfMoves; }
325  ushort GetCurrentPly() { return CurrentPlyCount; }
326 
327  void SetNextGame (Game * g) { NextGame = g; }
328  Game * GetNextGame () { return NextGame; }
329  void SetAltered (bool b) { Altered = b; }
330  bool GetAltered (void) { return Altered; }
331 
332  bool HasNonStandardStart () { return NonStandardStart; }
333 // byte GetNagsFlag () { return NagsFlag; }
334 // byte GetVarsFlag () { return VarsFlag; }
335 // byte GetCommentsFlag () { return CommentsFlag; }
336  bool HasPromotions () { return PromotionsFlag; }
337  bool HasUnderPromotions () { return UnderPromosFlag; }
338 
339  void SetStartPos (Position * pos);
340  errorT SetStartFen (const char * fenStr);
341 
342  void SetScidFlags(const char* s) {
343  strncpy(ScidFlags, s, sizeof(ScidFlags) - 1);
344  ScidFlags[sizeof(ScidFlags) - 1] = 0;
345  }
346 
347  Position * GetStartPos () { return StartPos; }
348  Position * GetCurrentPos () { return CurrentPos; }
349 
351  moveT * m = CurrentMove;
352  if (m->marker == START_MARKER || m->marker == END_MARKER) {
353  return NULL;
354  }
355  return &(m->moveData);
356  }
357 
358  inline void InitMove (moveT * m);
359 
360  void SaveState ();
361  errorT RestoreState();
362 
363  void SetMoveData (moveT * m, simpleMoveT * sm);
364  errorT AddMove (simpleMoveT * sm, char * san);
365  errorT AddVariation ();
366  errorT DeleteSubVariation (moveT * m);
367  errorT DeleteVariation (uint varNumber);
368  errorT DeleteVariationAndFree (uint varNumber);
369  errorT FirstVariation (uint varNumber);
370  errorT MainVariation ();
371  uint GetVarNumber();
372 
373  void SetMoveComment (const char * comment);
374  const char* GetMoveComment () { return CurrentMove->prev->comment.c_str(); }
375  /**
376  * Game::GetPreviousMoveComment()
377  * Return the comment on the move previously played by CurrentPos->ToMove
378  * If there are no previous moves, return an empty comment.
379  */
380  const char* GetPreviousMoveComment() {
381  ASSERT(CurrentMove != NULL);
382  moveT* m = CurrentMove->prev;
383  if (m == NULL || m->prev == NULL) return "";
384  moveT* mp = m->prev->varParent;
385  if (mp != NULL && mp->prev != NULL) m = mp;
386  return m->prev->comment.c_str();
387  }
388 
389  inline errorT AddNag (byte nag);
390  inline errorT RemoveNag (bool isMoveNag);
391  byte * GetNags () { return CurrentMove->prev->nags; }
392  byte * GetNextNags () { return CurrentMove->nags; }
393  void ClearNags () {
394  CurrentMove->prev->nagCount = 0;
395  CurrentMove->prev->nags[0] = 0;
396  }
397 
398  void MoveTo (const std::vector<int>& v);
399  void MoveToPly (ushort hmNumber);
400  errorT MoveForward ();
401  errorT MoveBackup ();
402  errorT MoveIntoVariation (uint varNumber);
403  errorT MoveExitVariation ();
404 
405  bool AtStart ()
406  { return (CurrentMove->prev->marker == START_MARKER &&
407  VarDepth == 0); }
408  bool AtEnd ()
409  { return (CurrentMove->marker == END_MARKER &&
410  VarDepth == 0); }
411  bool AtVarStart ()
412  { return (CurrentMove->prev->marker == START_MARKER); }
413  bool AtVarEnd ()
414  { return (CurrentMove->marker == END_MARKER); }
415  uint GetVarLevel () { return VarDepth; }
417  { return (uint) CurrentMove->numVariations; }
418 
419  void Truncate ();
420  void TruncateAndFree ();
421 
422  void TruncateStart ();
423 
424  void SetEventStr (const char * str) { EventStr = str; }
425  void SetSiteStr (const char * str) { SiteStr = str; }
426  void SetWhiteStr (const char * str) { WhiteStr = str; }
427  void SetBlackStr (const char * str) { BlackStr = str; }
428  void SetRoundStr (const char * str) { RoundStr = str; }
429  void SetDate (dateT date) { Date = date; }
430  void SetEventDate (dateT date) { EventDate = date; }
431  void SetResult (resultT res) { Result = res; }
432  void SetWhiteElo (eloT elo) { WhiteElo = elo; }
433  void SetBlackElo (eloT elo) { BlackElo = elo; }
434  void SetWhiteEstimateElo (eloT elo) { WhiteEstimateElo = elo; }
435  void SetBlackEstimateElo (eloT elo) { BlackEstimateElo = elo; }
436  void SetWhiteRatingType (byte b) { WhiteRatingType = b; }
437  void SetBlackRatingType (byte b) { BlackRatingType = b; }
438  void SetEco (ecoT eco) { EcoCode = eco; }
439  const char* GetEventStr () { return EventStr.c_str(); }
440  const char* GetSiteStr () { return SiteStr.c_str(); }
441  const char* GetWhiteStr () { return WhiteStr.c_str(); }
442  const char* GetBlackStr () { return BlackStr.c_str(); }
443  const char* GetRoundStr () { return RoundStr.c_str(); }
444  dateT GetDate () { return Date; }
445  dateT GetEventDate () { return EventDate; }
446  resultT GetResult () { return Result; }
447  eloT GetWhiteElo () { return WhiteElo; }
448  eloT GetBlackElo () { return BlackElo; }
449  eloT GetWhiteEstimateElo() { return WhiteEstimateElo; }
450  eloT GetBlackEstimateElo() { return BlackEstimateElo; }
451  byte GetWhiteRatingType () { return WhiteRatingType; }
452  byte GetBlackRatingType () { return BlackRatingType; }
453  ecoT GetEco () { return EcoCode; }
454  eloT GetAverageElo ();
455 
456  // Adding/Removing Extra tags:
457  void AddPgnTag (const char * tag, const char * value);
458  bool RemoveExtraTag (const char * tag);
459  const char * FindExtraTag (const char * tag);
460  uint GetNumExtraTags () { return NumTags; }
461  tagT * GetExtraTags () { return TagList; }
462  void ClearExtraTags ();
463 
464  void MakeHomePawnList (byte * pbPawnList);
465 
466  // Searching
467  compareT CompareCurrentPos (Position * p);
468 
469  void CopyStandardTags (Game * fromGame);
470  errorT LoadStandardTags (const IndexEntry* ie, const NameBase* nb);
471  void ClearStandardTags ();
472 
473  // PGN conversion
474  void GetSAN (char * str);
475  void GetPrevSAN (char * str);
476  void GetPrevMoveUCI (char * str);
477  void GetNextMoveUCI (char * str);
478 
479  bool CommentEmpty ( const char * comment);
480  void WriteComment (TextBuffer * tb, const char * preStr,
481  const char * comment, const char * postStr);
482  errorT WriteMoveList (TextBuffer * tb, uint plyCount,
483  moveT * oldCurrentMove,
484  bool printMoveNum, bool inComment);
485  errorT WritePGN (TextBuffer * tb, uint stopLocation);
486  std::pair<const char*, unsigned> WriteToPGN (uint lineWidth = 0,
487  bool NewLineAtEnd = false,
488  bool newLineToSpaces = true);
489  errorT MoveToLocationInPGN (uint stopLocation);
490  errorT WriteExtraTags (FILE * fp);
491 
493  PgnLastMovePos = 0;
494  moveT* lastMove = CurrentMove->prev;
495  if (AtVarStart()) {
496  lastMove = lastMove->varParent;
497  if (lastMove != 0) lastMove = lastMove->prev;
498  }
499  if (!calcAbsPlyNumber_(FirstMove, lastMove)) return 1;
500  return PgnLastMovePos;
501  }
502 
503  void ResetPgnStyle (void) { PgnStyle = 0; }
504  void ResetPgnStyle (uint flag) { PgnStyle = flag; }
505 
506  uint GetPgnStyle () { return PgnStyle; }
507  void SetPgnStyle (uint mask, bool setting) {
508  if (setting) { AddPgnStyle (mask); } else { RemovePgnStyle (mask); }
509  }
510  void AddPgnStyle (uint mask) { PgnStyle |= mask; }
511  void RemovePgnStyle (uint mask) { PgnStyle &= ~mask; }
512 
513  void SetPgnFormat (gameFormatT gf) { PgnFormat = gf; }
514  bool SetPgnFormatFromString (const char * str);
515  static bool PgnFormatFromString (const char * str, gameFormatT * fmt);
516  bool IsPlainFormat () { return (PgnFormat == PGN_FORMAT_Plain); }
517  bool IsHtmlFormat () { return (PgnFormat == PGN_FORMAT_HTML); }
518  bool IsLatexFormat () { return (PgnFormat == PGN_FORMAT_LaTeX); }
519  bool IsColorFormat () { return (PgnFormat == PGN_FORMAT_Color); }
520 
521  void SetHtmlStyle (uint style) { HtmlStyle = style; }
522  uint GetHtmlStyle () { return HtmlStyle; }
523 
524  errorT GetPartialMoveList (DString * str, uint plyCount);
525  bool MoveMatch (int m_argc, char ** m_argv, uint plyCount, bool wToMove, bool bToMove, int checkTest);
526 
527  errorT Encode (ByteBuffer * buf, IndexEntry * ie);
528  void EncodeTags (ByteBuffer * buf);
529 
530  bool MaterialMatch (ByteBuffer * buf, byte * min, byte * max,
531  patternT * pattern, int minPly, int maxPly,
532  int matchLength,
533  bool oppBishops, bool sameBishops,
534  int minDiff, int maxDiff);
535  bool ExactMatch (Position * pos, ByteBuffer * buf, simpleMoveT * sm,
536  gameExactMatchT searchType, bool * neverMatch);
537  bool VarExactMatch (Position * searchPos, gameExactMatchT searchType);
538  inline bool ExactMatch (Position * pos, ByteBuffer * buf, simpleMoveT * sm)
539  { return ExactMatch (pos, buf, sm, GAME_EXACT_MATCH_Exact, NULL); }
540  inline bool ExactMatch (Position * pos, ByteBuffer * buf, simpleMoveT * sm,
541  bool * neverMatch)
542  { return ExactMatch (pos, buf, sm, GAME_EXACT_MATCH_Exact, neverMatch); }
543  inline bool ExactMatch (Position * pos, ByteBuffer * buf, simpleMoveT * sm,
544  gameExactMatchT searchType)
545  { return ExactMatch (pos, buf, sm, searchType, NULL); }
546 
547  errorT DecodeStart (ByteBuffer * buf);
548  errorT DecodeNextMove (ByteBuffer * buf, simpleMoveT * sm);
549  errorT Decode (ByteBuffer * buf, byte flags);
550  errorT DecodeTags (ByteBuffer * buf, bool storeTags);
551 
552  std::vector<int> GetCurrentLocation();
553  Game* clone();
554 };
555 
556 
557 inline void
559 {
560  ASSERT(m != NULL);
561  m->prev = m->next = m->varParent = m->varChild = NULL;
562  m->numVariations = 0;
563  //m->varLevel = 0;
564  m->comment.clear();
565  m->nagCount = 0;
566  m->nags[0] = 0;
567  m->marker = NO_MARKER;
568  m->san[0] = 0;
569 }
570 
571 inline errorT
573 {
574  moveT * m = CurrentMove->prev;
575  if (m->nagCount + 1 >= MAX_NAGS) { return ERROR_GameFull; }
576  if (nag == 0) { /* Nags cannot be zero! */ return OK; }
577  // If it is a move nag replace an existing
578  if( nag >= 1 && nag <= 6)
579  for( int i=0; i<m->nagCount; i++)
580  if( m->nags[i] >= 1 && m->nags[i] <= 6)
581  {
582  m->nags[i] = nag;
583  return OK;
584  }
585  // If it is a position nag replace an existing
586  if( nag >= 10 && nag <= 21)
587  for( int i=0; i<m->nagCount; i++)
588  if( m->nags[i] >= 10 && m->nags[i] <= 21)
589  {
590  m->nags[i] = nag;
591  return OK;
592  }
593  if( nag >= 1 && nag <= 6)
594  {
595  // Put Move Nags at the beginning
596  for( int i=m->nagCount; i>0; i--) m->nags[i] = m->nags[i-1];
597  m->nags[0] = nag;
598  }
599  else
600  m->nags[m->nagCount] = nag;
601  m->nagCount += 1;
602  m->nags[m->nagCount] = 0;
603  return OK;
604 }
605 
606 inline errorT
607 Game::RemoveNag (bool isMoveNag)
608 {
609  moveT * m = CurrentMove->prev;
610  if( isMoveNag)
611  {
612  for( int i=0; i<m->nagCount; i++)
613  if( m->nags[i] >= 1 && m->nags[i] <= 6)
614  {
615  m->nagCount -= 1;
616  for( int j=i; j<m->nagCount; j++) m->nags[j] = m->nags[j+1];
617  m->nags[m->nagCount] = 0;
618  return OK;
619  }
620  }
621  else
622  {
623  for( int i=0; i<m->nagCount; i++)
624  if( m->nags[i] >= 10 && m->nags[i] <= 21)
625  {
626  m->nagCount -= 1;
627  for( int j=i; j<m->nagCount; j++) m->nags[j] = m->nags[j+1];
628  m->nags[m->nagCount] = 0;
629  return OK;
630  }
631  }
632  return OK;
633 }
634 
635 #endif // #ifndef SCID_GAME_H
636 
637 //////////////////////////////////////////////////////////////////////
638 // EOF: game.h
639 //////////////////////////////////////////////////////////////////////
const byte NAG_Diagram
Definition: game.h:99
const byte NAG_Novelty
Definition: game.h:87
bool ExactMatch(Position *pos, ByteBuffer *buf, simpleMoveT *sm, bool *neverMatch)
Definition: game.h:540
unsigned char byte
Definition: common.h:97
void SetNumHalfMoves(ushort x)
Definition: game.h:323
void transPieces(char *s)
Definition: game.cpp:42
const byte NAG_Without
Definition: game.h:105
byte resultT
Definition: common.h:183
const byte NAG_MoreRoom
Definition: game.h:62
const char * GetRoundStr()
Definition: game.h:443
const byte NAG_Ending
Definition: game.h:89
uint numFree
Definition: game.h:171
void SetEventStr(const char *str)
Definition: game.h:424
const byte NAG_ZugZwang
Definition: game.h:60
const byte NAG_OnlyMove
Definition: game.h:49
const byte NAG_Unclear
Definition: game.h:51
ushort GetCurrentPly()
Definition: game.h:325
const byte NAG_WithBlackAttack
Definition: game.h:66
const byte NAG_BlackCounterPlay
Definition: game.h:80
const markerT NO_MARKER
Definition: game.h:117
const byte NAG_PoorMove
Definition: game.h:44
const byte NAG_OppositeBishops
Definition: game.h:93
byte GetBlackRatingType()
Definition: game.h:452
moveChunkT * next
Definition: game.h:172
byte * GetNags()
Definition: game.h:391
bool IsHtmlFormat()
Definition: game.h:517
bool AtVarStart()
Definition: game.h:411
const char * GetBlackStr()
Definition: game.h:442
const byte NAG_SlightCounterPlay
Definition: game.h:76
const errorT OK
Definition: error.h:23
const char * GetPreviousMoveComment()
Game::GetPreviousMoveComment() Return the comment on the move previously played by CurrentPos->ToMove...
Definition: game.h:380
const byte NAG_BetterIs
Definition: game.h:84
const char * langPieces[]
Definition: game.cpp:34
void SetBlackRatingType(byte b)
Definition: game.h:437
byte rankT
Definition: common.h:115
uint max(int a, int b)
Definition: crosstab.cpp:237
WritePGNpath name rating xml
bool ExactMatch(Position *pos, ByteBuffer *buf, simpleMoveT *sm)
Definition: game.h:538
bool GetAltered(void)
Definition: game.h:330
uint dateT
Definition: common.h:155
#define ASSERT(f)
Definition: common.h:67
const byte NAG_QueenSide
Definition: game.h:75
const byte NAG_Compensation
Definition: game.h:67
const byte NAG_ExcellentMove
Definition: game.h:45
void SetWhiteElo(eloT elo)
Definition: game.h:432
uint GetHtmlStyle()
Definition: game.h:522
bool AtStart()
Definition: game.h:405
uint GetVarLevel()
Definition: game.h:415
uint32_t matSigT
Definition: matsig.h:25
const byte NAG_SeparatedPawns
Definition: game.h:97
const byte NAG_BishopPair
Definition: game.h:92
names
Definition: tablebase.tcl:260
void SetEventDate(dateT date)
Definition: game.h:430
const byte MAX_NAGS_ARRAY
Definition: game.h:108
const byte NAG_Diagonal
Definition: game.h:91
byte fyleT
Definition: common.h:116
rankT rankMatch
Definition: game.h:129
const byte NAG_WhiteSlight
Definition: game.h:52
const byte NAG_KingSide
Definition: game.h:72
Game()
Definition: game.h:314
const byte NAG_WithIdea
Definition: game.h:83
void SetResult(resultT res)
Definition: game.h:431
const char * GetSiteStr()
Definition: game.h:440
const byte NAG_ModerateKingSide
Definition: game.h:71
byte * GetNextNags()
Definition: game.h:392
const byte NAG_GoodMove
Definition: game.h:43
const byte NAG_VariousMoves
Definition: game.h:85
void SetWhiteStr(const char *str)
Definition: game.h:426
const byte NAG_UnitedPawns
Definition: game.h:98
patternT * next
Definition: game.h:132
const byte NAG_BlackClear
Definition: game.h:55
const char * GetEventStr()
Definition: game.h:439
Definition: game.h:126
void SetAltered(bool b)
Definition: game.h:329
eloT GetBlackElo()
Definition: game.h:448
const byte NAG_InterestingMove
Definition: game.h:47
const byte NAG_SameBishops
Definition: game.h:94
const byte NAG_BlackDecisive
Definition: game.h:57
uint strGetRatingType(const char *name)
Definition: game.cpp:125
gameFormatT
Definition: game.h:194
errorT RemoveNag(bool isMoveNag)
Definition: game.h:607
void SetSiteStr(const char *str)
Definition: game.h:425
uint GetPgnStyle()
Definition: game.h:506
bool HasUnderPromotions()
Definition: game.h:337
void SetBlackEstimateElo(eloT elo)
Definition: game.h:435
const byte NAG_DubiousMove
Definition: game.h:48
byte game_parseNag(const char *str)
Definition: game.cpp:186
void SetRoundStr(const char *str)
Definition: game.h:428
uint32_t uint
Definition: common.h:99
const byte NAG_TimeLimit
Definition: game.h:82
const byte NAG_BlackSlightCounterPlay
Definition: game.h:79
void SetBlackStr(const char *str)
Definition: game.h:427
const uint MAX_TAGS
Definition: game.h:111
void SetDate(dateT date)
Definition: game.h:429
UI_res_t Result(UI_handle_t ti, errorT res)
Definition: ui_tcltk.h:210
Definition: move.tcl:20
const byte NAG_WhiteDecisive
Definition: game.h:56
void SetWhiteEstimateElo(eloT elo)
Definition: game.h:434
tagT * GetExtraTags()
Definition: game.h:461
byte GetWhiteRatingType()
Definition: game.h:451
Definition: game.h:175
const byte NAG_Mate
Definition: game.h:101
void ResetPgnStyle(uint flag)
Definition: game.h:504
ushort eloT
Definition: common.h:160
dateT GetEventDate()
Definition: game.h:445
Position * GetCurrentPos()
Definition: game.h:348
void InitMove(moveT *m)
Definition: game.h:558
const errorT ERROR_GameFull
Definition: error.h:72
simpleMoveT * GetCurrentMove()
Definition: game.h:350
const byte NAG_WithInitiative
Definition: game.h:64
void AddPgnStyle(uint mask)
Definition: game.h:510
void SetPgnFormat(gameFormatT gf)
Definition: game.h:513
ushort ecoT
Definition: common.h:161
const byte NAG_BlackSlight
Definition: game.h:53
const byte NAG_SlightKingSide
Definition: game.h:70
pieceT pieceMatch
Definition: game.h:128
Clear
Definition: game.tcl:8
const uint MAX_TAG_LEN
Definition: game.h:113
unsigned short errorT
Definition: error.h:20
eloT GetWhiteElo()
Definition: game.h:447
signed int compareT
Definition: common.h:105
bool AtVarEnd()
Definition: game.h:413
Truncate
Definition: game.tcl:46
const byte NAG_WhiteClear
Definition: game.h:54
const byte NAG_Comment
Definition: game.h:86
int language
Definition: game.cpp:29
#define MOVE_CHUNKSIZE
Definition: game.h:167
#define MAX_NAGS
Definition: game.h:138
ecoT GetEco()
Definition: game.h:453
void SetHtmlStyle(uint style)
Definition: game.h:521
uint16_t ushort
Definition: common.h:98
Definition: game.h:227
bool HasNonStandardStart()
Definition: game.h:332
bool AtEnd()
Definition: game.h:408
const byte NAG_File
Definition: game.h:90
bool IsPlainFormat()
Definition: game.h:516
const markerT END_MARKER
Definition: game.h:119
uint GetPgnOffset()
Definition: game.h:492
void SetWhiteRatingType(byte b)
Definition: game.h:436
const byte NAG_BlackDecisiveCounterPlay
Definition: game.h:81
const byte NAG_Etc
Definition: game.h:95
const byte NAG_DoublePawns
Definition: game.h:96
const byte NAG_MorePawns
Definition: game.h:103
resultT GetResult()
Definition: game.h:446
Definition: tablebase.tcl:15
Datename el op
Definition: validate.tcl:64
void ClearNags()
Definition: game.h:393
fyleT fyleMatch
Definition: game.h:130
Definition: game.h:143
const byte NAG_Centre
Definition: game.h:69
bool HasPromotions()
Definition: game.h:336
const byte NAG_WithAttack
Definition: game.h:65
errorT AddNag(byte nag)
Definition: game.h:572
Game * GetNextGame()
Definition: game.h:328
sansqno
Definition: board.tcl:307
const byte NAG_Equal
Definition: game.h:50
const byte NAG_SlightQueenSide
Definition: game.h:73
byte colorT
Definition: common.h:112
const byte NAG_WeakPoint
Definition: game.h:88
const byte NAG_With
Definition: game.h:104
void SetScidFlags(const char *s)
Definition: game.h:342
const byte NAG_SlightCentre
Definition: game.h:68
const char * GetWhiteStr()
Definition: game.h:441
void RemovePgnStyle(uint mask)
Definition: game.h:511
char * tag
Definition: game.h:177
bool ExactMatch(Position *pos, ByteBuffer *buf, simpleMoveT *sm, gameExactMatchT searchType)
Definition: game.h:543
dateT GetDate()
Definition: game.h:444
const byte NAG_CounterPlay
Definition: game.h:77
const byte NAG_WhiteCrushing
Definition: game.h:58
const char * GetMoveComment()
Definition: game.h:374
uint GetNumVariations()
Definition: game.h:416
byte flag
Definition: game.h:131
const byte NAG_DevelopmentAdvantage
Definition: game.h:63
void game_printNag(byte nag, char *str, bool asSymbol, gameFormatT format)
Definition: game.cpp:143
const byte NAG_See
Definition: game.h:100
void SetEco(ecoT eco)
Definition: game.h:438
eloT GetWhiteEstimateElo()
Definition: game.h:449
ushort GetNumHalfMoves()
Definition: game.h:324
const byte NAG_BlackZugZwang
Definition: game.h:61
void SetBlackElo(eloT elo)
Definition: game.h:433
const byte NAG_ModerateQueenSide
Definition: game.h:74
const byte NAG_DecisiveCounterPlay
Definition: game.h:78
void SetNextGame(Game *g)
Definition: game.h:327
const byte NAG_PassedPawn
Definition: game.h:102
bool IsColorFormat()
Definition: game.h:519
bool IsLatexFormat()
Definition: game.h:518
const byte NAG_Blunder
Definition: game.h:46
const markerT END_GAME
Definition: game.h:120
char * value
Definition: game.h:178
const markerT START_MARKER
Definition: game.h:118
const byte NAG_BlackCrushing
Definition: game.h:59
gameExactMatchT
Definition: game.h:187
void SetPgnStyle(uint mask, bool setting)
Definition: game.h:507
Definition: indexentry.h:54
Position * GetStartPos()
Definition: game.h:347
char transPiecesChar(char c)
Definition: game.cpp:60
byte pieceT
Definition: common.h:111
bool isNullMove() const
Definition: movelist.h:51
eloT GetBlackEstimateElo()
Definition: game.h:450
uint GetNumExtraTags()
Definition: game.h:460
void ResetPgnStyle(void)
Definition: game.h:503
byte markerT
Definition: game.h:115