Scid  4.7.0
Classes | Public Member Functions | Static Public Member Functions | List of all members
Game Class Reference

#include <game.h>

Public Member Functions

 Game ()
 
void Clear ()
 
void strip (bool variations, bool comments, bool NAGs)
 
bool HasNonStandardStart (char *outFEN=nullptr) const
 
errorT SetStartFen (const char *fenStr)
 Setup the start position from a FEN string and remove all the moves. More...
 
void SetScidFlags (const char *s, size_t len)
 
void SetScidFlags (const char *s)
 
ushort GetNumHalfMoves ()
 
errorT AddMove (const simpleMoveT *sm)
 
errorT AddVariation ()
 
errorT DeleteVariation ()
 
errorT FirstVariation ()
 
errorT MainVariation ()
 
void Truncate ()
 
void TruncateStart ()
 
errorT MoveForward ()
 
errorT MoveBackup ()
 
errorT MoveIntoVariation (uint varNumber)
 
errorT MoveExitVariation ()
 
errorT MoveForwardInPGN ()
 
errorT MoveToLocationInPGN (unsigned stopLocation)
 
void MoveToStart ()
 
void MoveToPly (int hmNumber)
 
GameSavedPos currentLocation () const
 
void restoreLocation (const GameSavedPos &savedPos)
 
const PositioncurrentPos () const
 
PositionGetCurrentPos ()
 
simpleMoveTGetCurrentMove ()
 
ushort GetCurrentPly () const
 
uint GetNumVariations () const
 
uint GetVarLevel () const
 
uint GetVarNumber () const
 
unsigned GetLocationInPGN () const
 
unsigned GetPgnOffset () const
 
bool AtVarStart () const
 
bool AtVarEnd () const
 
bool AtStart () const
 
bool AtEnd () const
 
errorT AddNag (byte nag)
 
errorT RemoveNag (bool isMoveNag)
 
void ClearNags ()
 
byteGetNags () const
 
byteGetNextNags () const
 
const char * GetPreviousMoveComment () const
 Return the comment on the move previously played by CurrentPos->ToMove If there are no previous moves, return an empty comment. More...
 
const char * GetMoveComment () const
 
std::string & accessMoveComment ()
 
void SetMoveComment (const char *comment)
 
const char * GetNextSAN ()
 
void GetSAN (char *str)
 
void GetPrevSAN (char *str)
 
void GetPrevMoveUCI (char *str) const
 
void GetNextMoveUCI (char *str)
 
void AddPgnTag (const char *tag, const char *value)
 
bool RemoveExtraTag (const char *tag)
 
const char * FindExtraTag (const char *tag) const
 
std::string & accessTagValue (const char *tag, size_t tagLen)
 
decltype(extraTags_) const & GetExtraTags () const
 
void ClearExtraTags ()
 
errorT LoadStandardTags (const IndexEntry *ie, const NameBase *nb)
 
void SetEventStr (const char *str)
 
void SetSiteStr (const char *str)
 
void SetWhiteStr (const char *str)
 
void SetBlackStr (const char *str)
 
void SetRoundStr (const char *str)
 
void SetDate (dateT date)
 
void SetEventDate (dateT date)
 
void SetResult (resultT res)
 
void SetWhiteElo (eloT elo)
 
void SetBlackElo (eloT elo)
 
void SetWhiteRatingType (byte b)
 
void SetBlackRatingType (byte b)
 
int setRating (colorT col, const char *ratingType, size_t ratingTypeLen, std::pair< const char *, const char *> rating)
 
void SetEco (ecoT eco)
 
const char * GetEventStr () const
 
const char * GetSiteStr () const
 
const char * GetWhiteStr () const
 
const char * GetBlackStr () const
 
const char * GetRoundStr () const
 
dateT GetDate () const
 
dateT GetEventDate () const
 
resultT GetResult () const
 
eloT GetWhiteElo () const
 
eloT GetBlackElo () const
 
eloT GetWhiteEstimateElo () const
 
eloT GetBlackEstimateElo () const
 
byte GetWhiteRatingType () const
 
byte GetBlackRatingType () const
 
ecoT GetEco () const
 
eloT GetAverageElo ()
 
bool CommentEmpty (const char *comment)
 
void WriteComment (TextBuffer *tb, const char *preStr, const char *comment, const char *postStr)
 
errorT WriteMoveList (TextBuffer *tb, moveT *oldCurrentMove, bool printMoveNum, bool inComment)
 
std::pair< const char *, unsigned > WriteToPGN (uint lineWidth=0, bool NewLineAtEnd=false, bool newLineToSpaces=true)
 
void ResetPgnStyle (void)
 
void ResetPgnStyle (uint flag)
 
uint GetPgnStyle ()
 
void SetPgnStyle (uint mask, bool setting)
 
void AddPgnStyle (uint mask)
 
void RemovePgnStyle (uint mask)
 
void SetPgnFormat (gameFormatT gf)
 
bool SetPgnFormatFromString (const char *str)
 
bool IsPlainFormat ()
 
bool IsHtmlFormat ()
 
bool IsLatexFormat ()
 
bool IsColorFormat ()
 
void SetHtmlStyle (uint style)
 
uint GetHtmlStyle ()
 
errorT GetPartialMoveList (DString *str, uint plyCount)
 
bool MaterialMatch (ByteBuffer *buf, byte *min, byte *max, patternT *pattern, int minPly, int maxPly, int matchLength, bool oppBishops, bool sameBishops, int minDiff, int maxDiff)
 
bool ExactMatch (Position *pos, ByteBuffer *buf, simpleMoveT *sm, gameExactMatchT searchType, bool *neverMatch)
 
bool VarExactMatch (Position *searchPos, gameExactMatchT searchType)
 
bool ExactMatch (Position *pos, ByteBuffer *buf, simpleMoveT *sm)
 
bool ExactMatch (Position *pos, ByteBuffer *buf, simpleMoveT *sm, bool *neverMatch)
 
bool ExactMatch (Position *pos, ByteBuffer *buf, simpleMoveT *sm, gameExactMatchT searchType)
 
errorT Encode (ByteBuffer *buf, IndexEntry *ie)
 
errorT DecodeStart (ByteBuffer *buf, bool decodeTags=false)
 
errorT DecodeNextMove (ByteBuffer *buf, simpleMoveT *sm)
 
errorT Decode (ByteBuffer *buf, byte flags)
 
errorT DecodeTags (ByteBuffer *buf, bool storeTags)
 
Gameclone ()
 

Static Public Member Functions

static bool PgnFormatFromString (const char *str, gameFormatT *fmt)
 

Detailed Description

Definition at line 167 of file game.h.

Constructor & Destructor Documentation

◆ Game()

Game::Game ( )
inline

Definition at line 227 of file game.h.

Member Function Documentation

◆ accessMoveComment()

std::string& Game::accessMoveComment ( )
inline

Definition at line 360 of file game.h.

◆ accessTagValue()

std::string & Game::accessTagValue ( const char *  tag,
size_t  tagLen 
)

Definition at line 657 of file game.cpp.

◆ AddMove()

errorT Game::AddMove ( const simpleMoveT sm)

Definition at line 889 of file game.cpp.

◆ AddNag()

errorT Game::AddNag ( byte  nag)

Definition at line 367 of file game.cpp.

◆ AddPgnStyle()

void Game::AddPgnStyle ( uint  mask)
inline

Definition at line 430 of file game.h.

◆ AddPgnTag()

void Game::AddPgnTag ( const char *  tag,
const char *  value 
)

Definition at line 619 of file game.cpp.

◆ AddVariation()

errorT Game::AddVariation ( )

Definition at line 912 of file game.cpp.

◆ AtEnd()

bool Game::AtEnd ( ) const
inline

Definition at line 330 of file game.h.

◆ AtStart()

bool Game::AtStart ( ) const
inline

Definition at line 329 of file game.h.

◆ AtVarEnd()

bool Game::AtVarEnd ( ) const
inline

Definition at line 328 of file game.h.

◆ AtVarStart()

bool Game::AtVarStart ( ) const
inline

Definition at line 327 of file game.h.

◆ Clear()

void Game::Clear ( )

Definition at line 541 of file game.cpp.

◆ ClearExtraTags()

void Game::ClearExtraTags ( )
inline

Definition at line 377 of file game.h.

◆ ClearNags()

void Game::ClearNags ( )
inline

Definition at line 339 of file game.h.

◆ clone()

Game * Game::clone ( )

Definition at line 489 of file game.cpp.

◆ CommentEmpty()

bool Game::CommentEmpty ( const char *  comment)

Definition at line 1755 of file game.cpp.

◆ currentLocation()

GameSavedPos Game::currentLocation ( ) const
inline

Definition at line 279 of file game.h.

◆ currentPos()

const Position* Game::currentPos ( ) const
inline

Definition at line 291 of file game.h.

◆ Decode()

errorT Game::Decode ( ByteBuffer buf,
byte  flags 
)

Definition at line 3549 of file game.cpp.

◆ DecodeNextMove()

errorT Game::DecodeNextMove ( ByteBuffer buf,
simpleMoveT sm 
)

Definition at line 3442 of file game.cpp.

◆ DecodeStart()

errorT Game::DecodeStart ( ByteBuffer buf,
bool  decodeTags = false 
)

Definition at line 3508 of file game.cpp.

◆ DecodeTags()

errorT Game::DecodeTags ( ByteBuffer buf,
bool  storeTags 
)

Definition at line 3192 of file game.cpp.

◆ DeleteVariation()

errorT Game::DeleteVariation ( )

Definition at line 986 of file game.cpp.

◆ Encode()

errorT Game::Encode ( ByteBuffer buf,
IndexEntry ie 
)

Definition at line 3327 of file game.cpp.

◆ ExactMatch() [1/4]

bool Game::ExactMatch ( Position pos,
ByteBuffer buf,
simpleMoveT sm,
gameExactMatchT  searchType,
bool *  neverMatch 
)

Definition at line 1317 of file game.cpp.

◆ ExactMatch() [2/4]

bool Game::ExactMatch ( Position pos,
ByteBuffer buf,
simpleMoveT sm 
)
inline

Definition at line 454 of file game.h.

◆ ExactMatch() [3/4]

bool Game::ExactMatch ( Position pos,
ByteBuffer buf,
simpleMoveT sm,
bool *  neverMatch 
)
inline

Definition at line 456 of file game.h.

◆ ExactMatch() [4/4]

bool Game::ExactMatch ( Position pos,
ByteBuffer buf,
simpleMoveT sm,
gameExactMatchT  searchType 
)
inline

Definition at line 459 of file game.h.

◆ FindExtraTag()

const char * Game::FindExtraTag ( const char *  tag) const

Definition at line 634 of file game.cpp.

◆ FirstVariation()

errorT Game::FirstVariation ( )

Definition at line 934 of file game.cpp.

◆ GetAverageElo()

eloT Game::GetAverageElo ( )

Definition at line 2607 of file game.cpp.

◆ GetBlackElo()

eloT Game::GetBlackElo ( ) const
inline

Definition at line 405 of file game.h.

◆ GetBlackEstimateElo()

eloT Game::GetBlackEstimateElo ( ) const
inline

Definition at line 407 of file game.h.

◆ GetBlackRatingType()

byte Game::GetBlackRatingType ( ) const
inline

Definition at line 409 of file game.h.

◆ GetBlackStr()

const char* Game::GetBlackStr ( ) const
inline

Definition at line 399 of file game.h.

◆ GetCurrentMove()

simpleMoveT* Game::GetCurrentMove ( )
inline

Definition at line 295 of file game.h.

◆ GetCurrentPly()

ushort Game::GetCurrentPly ( ) const
inline

Definition at line 298 of file game.h.

◆ GetCurrentPos()

Position* Game::GetCurrentPos ( )
inline

Definition at line 292 of file game.h.

◆ GetDate()

dateT Game::GetDate ( ) const
inline

Definition at line 401 of file game.h.

◆ GetEco()

ecoT Game::GetEco ( ) const
inline

Definition at line 410 of file game.h.

◆ GetEventDate()

dateT Game::GetEventDate ( ) const
inline

Definition at line 402 of file game.h.

◆ GetEventStr()

const char* Game::GetEventStr ( ) const
inline

Definition at line 396 of file game.h.

◆ GetExtraTags()

decltype(extraTags_) const& Game::GetExtraTags ( ) const
inline

Definition at line 376 of file game.h.

◆ GetHtmlStyle()

uint Game::GetHtmlStyle ( )
inline

Definition at line 442 of file game.h.

◆ GetLocationInPGN()

unsigned Game::GetLocationInPGN ( ) const

Definition at line 857 of file game.cpp.

◆ GetMoveComment()

const char* Game::GetMoveComment ( ) const
inline

Definition at line 357 of file game.h.

◆ GetNags()

byte* Game::GetNags ( ) const
inline

Definition at line 343 of file game.h.

◆ GetNextMoveUCI()

void Game::GetNextMoveUCI ( char *  str)

Definition at line 1738 of file game.cpp.

◆ GetNextNags()

byte* Game::GetNextNags ( ) const
inline

Definition at line 344 of file game.h.

◆ GetNextSAN()

const char * Game::GetNextSAN ( )

Definition at line 1676 of file game.cpp.

◆ GetNumHalfMoves()

ushort Game::GetNumHalfMoves ( )
inline

Definition at line 250 of file game.h.

◆ GetNumVariations()

uint Game::GetNumVariations ( ) const
inline

Definition at line 302 of file game.h.

◆ GetPartialMoveList()

errorT Game::GetPartialMoveList ( DString str,
uint  plyCount 
)

Definition at line 1639 of file game.cpp.

◆ GetPgnOffset()

unsigned Game::GetPgnOffset ( ) const

Definition at line 868 of file game.cpp.

◆ GetPgnStyle()

uint Game::GetPgnStyle ( )
inline

Definition at line 426 of file game.h.

◆ GetPreviousMoveComment()

const char* Game::GetPreviousMoveComment ( ) const
inline

Return the comment on the move previously played by CurrentPos->ToMove If there are no previous moves, return an empty comment.

Definition at line 350 of file game.h.

◆ GetPrevMoveUCI()

void Game::GetPrevMoveUCI ( char *  str) const

Definition at line 1721 of file game.cpp.

◆ GetPrevSAN()

void Game::GetPrevSAN ( char *  str)

Definition at line 1701 of file game.cpp.

◆ GetResult()

resultT Game::GetResult ( ) const
inline

Definition at line 403 of file game.h.

◆ GetRoundStr()

const char* Game::GetRoundStr ( ) const
inline

Definition at line 400 of file game.h.

◆ GetSAN()

void Game::GetSAN ( char *  str)

Definition at line 1691 of file game.cpp.

◆ GetSiteStr()

const char* Game::GetSiteStr ( ) const
inline

Definition at line 397 of file game.h.

◆ GetVarLevel()

uint Game::GetVarLevel ( ) const
inline

Definition at line 310 of file game.h.

◆ GetVarNumber()

uint Game::GetVarNumber ( ) const
inline

Definition at line 311 of file game.h.

◆ GetWhiteElo()

eloT Game::GetWhiteElo ( ) const
inline

Definition at line 404 of file game.h.

◆ GetWhiteEstimateElo()

eloT Game::GetWhiteEstimateElo ( ) const
inline

Definition at line 406 of file game.h.

◆ GetWhiteRatingType()

byte Game::GetWhiteRatingType ( ) const
inline

Definition at line 408 of file game.h.

◆ GetWhiteStr()

const char* Game::GetWhiteStr ( ) const
inline

Definition at line 398 of file game.h.

◆ HasNonStandardStart()

bool Game::HasNonStandardStart ( char *  outFEN = nullptr) const
inline

Definition at line 231 of file game.h.

◆ IsColorFormat()

bool Game::IsColorFormat ( )
inline

Definition at line 439 of file game.h.

◆ IsHtmlFormat()

bool Game::IsHtmlFormat ( )
inline

Definition at line 437 of file game.h.

◆ IsLatexFormat()

bool Game::IsLatexFormat ( )
inline

Definition at line 438 of file game.h.

◆ IsPlainFormat()

bool Game::IsPlainFormat ( )
inline

Definition at line 436 of file game.h.

◆ LoadStandardTags()

errorT Game::LoadStandardTags ( const IndexEntry ie,
const NameBase nb 
)

Definition at line 2584 of file game.cpp.

◆ MainVariation()

errorT Game::MainVariation ( )

Definition at line 949 of file game.cpp.

◆ MaterialMatch()

bool Game::MaterialMatch ( ByteBuffer buf,
byte min,
byte max,
patternT pattern,
int  minPly,
int  maxPly,
int  matchLength,
bool  oppBishops,
bool  sameBishops,
int  minDiff,
int  maxDiff 
)

Definition at line 1176 of file game.cpp.

◆ MoveBackup()

errorT Game::MoveBackup ( void  )

Definition at line 759 of file game.cpp.

◆ MoveExitVariation()

errorT Game::MoveExitVariation ( void  )

Definition at line 795 of file game.cpp.

◆ MoveForward()

errorT Game::MoveForward ( void  )

Definition at line 742 of file game.cpp.

◆ MoveForwardInPGN()

errorT Game::MoveForwardInPGN ( )

Definition at line 829 of file game.cpp.

◆ MoveIntoVariation()

errorT Game::MoveIntoVariation ( uint  varNumber)

Definition at line 775 of file game.cpp.

◆ MoveToLocationInPGN()

errorT Game::MoveToLocationInPGN ( unsigned  stopLocation)

Definition at line 847 of file game.cpp.

◆ MoveToPly()

void Game::MoveToPly ( int  hmNumber)
inline

Definition at line 274 of file game.h.

◆ MoveToStart()

void Game::MoveToStart ( )

Definition at line 815 of file game.cpp.

◆ PgnFormatFromString()

bool Game::PgnFormatFromString ( const char *  str,
gameFormatT fmt 
)
static

Definition at line 574 of file game.cpp.

◆ RemoveExtraTag()

bool Game::RemoveExtraTag ( const char *  tag)

Definition at line 645 of file game.cpp.

◆ RemoveNag()

errorT Game::RemoveNag ( bool  isMoveNag)

Definition at line 400 of file game.cpp.

◆ RemovePgnStyle()

void Game::RemovePgnStyle ( uint  mask)
inline

Definition at line 431 of file game.h.

◆ ResetPgnStyle() [1/2]

void Game::ResetPgnStyle ( void  )
inline

Definition at line 423 of file game.h.

◆ ResetPgnStyle() [2/2]

void Game::ResetPgnStyle ( uint  flag)
inline

Definition at line 424 of file game.h.

◆ restoreLocation()

void Game::restoreLocation ( const GameSavedPos &  savedPos)
inline

Definition at line 282 of file game.h.

◆ SetBlackElo()

void Game::SetBlackElo ( eloT  elo)
inline

Definition at line 390 of file game.h.

◆ SetBlackRatingType()

void Game::SetBlackRatingType ( byte  b)
inline

Definition at line 392 of file game.h.

◆ SetBlackStr()

void Game::SetBlackStr ( const char *  str)
inline

Definition at line 384 of file game.h.

◆ SetDate()

void Game::SetDate ( dateT  date)
inline

Definition at line 386 of file game.h.

◆ SetEco()

void Game::SetEco ( ecoT  eco)
inline

Definition at line 395 of file game.h.

◆ SetEventDate()

void Game::SetEventDate ( dateT  date)
inline

Definition at line 387 of file game.h.

◆ SetEventStr()

void Game::SetEventStr ( const char *  str)
inline

Definition at line 381 of file game.h.

◆ SetHtmlStyle()

void Game::SetHtmlStyle ( uint  style)
inline

Definition at line 441 of file game.h.

◆ SetMoveComment()

void Game::SetMoveComment ( const char *  comment)

Definition at line 687 of file game.cpp.

◆ SetPgnFormat()

void Game::SetPgnFormat ( gameFormatT  gf)
inline

Definition at line 433 of file game.h.

◆ SetPgnFormatFromString()

bool Game::SetPgnFormatFromString ( const char *  str)

Definition at line 597 of file game.cpp.

◆ SetPgnStyle()

void Game::SetPgnStyle ( uint  mask,
bool  setting 
)
inline

Definition at line 427 of file game.h.

◆ setRating()

int Game::setRating ( colorT  col,
const char *  ratingType,
size_t  ratingTypeLen,
std::pair< const char *, const char *>  rating 
)

Definition at line 699 of file game.cpp.

◆ SetResult()

void Game::SetResult ( resultT  res)
inline

Definition at line 388 of file game.h.

◆ SetRoundStr()

void Game::SetRoundStr ( const char *  str)
inline

Definition at line 385 of file game.h.

◆ SetScidFlags() [1/2]

void Game::SetScidFlags ( const char *  s,
size_t  len 
)
inline

Definition at line 243 of file game.h.

◆ SetScidFlags() [2/2]

void Game::SetScidFlags ( const char *  s)
inline

Definition at line 248 of file game.h.

◆ SetSiteStr()

void Game::SetSiteStr ( const char *  str)
inline

Definition at line 382 of file game.h.

◆ SetStartFen()

errorT Game::SetStartFen ( const char *  fenStr)

Setup the start position from a FEN string and remove all the moves.

If the FEN is invalid the game is not changed.

Definition at line 603 of file game.cpp.

◆ SetWhiteElo()

void Game::SetWhiteElo ( eloT  elo)
inline

Definition at line 389 of file game.h.

◆ SetWhiteRatingType()

void Game::SetWhiteRatingType ( byte  b)
inline

Definition at line 391 of file game.h.

◆ SetWhiteStr()

void Game::SetWhiteStr ( const char *  str)
inline

Definition at line 383 of file game.h.

◆ strip()

void Game::strip ( bool  variations,
bool  comments,
bool  NAGs 
)

Definition at line 491 of file game.cpp.

◆ Truncate()

void Game::Truncate ( )

Definition at line 1002 of file game.cpp.

◆ TruncateStart()

void Game::TruncateStart ( )

Definition at line 1021 of file game.cpp.

◆ VarExactMatch()

bool Game::VarExactMatch ( Position searchPos,
gameExactMatchT  searchType 
)

Definition at line 1546 of file game.cpp.

◆ WriteComment()

void Game::WriteComment ( TextBuffer tb,
const char *  preStr,
const char *  comment,
const char *  postStr 
)

Definition at line 1789 of file game.cpp.

◆ WriteMoveList()

errorT Game::WriteMoveList ( TextBuffer tb,
moveT oldCurrentMove,
bool  printMoveNum,
bool  inComment 
)

Definition at line 1838 of file game.cpp.

◆ WriteToPGN()

std::pair< const char *, unsigned > Game::WriteToPGN ( uint  lineWidth = 0,
bool  NewLineAtEnd = false,
bool  newLineToSpaces = true 
)

Definition at line 2563 of file game.cpp.


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