libscid snapshot+1833ab5ad39d
Chess applications made easy.
Source on GitHub License GPL v2
Loading...
Searching...
No Matches
notation.h File Reference

Notation helpers for positions and moves at movetext locations. More...

#include "scid/core/move.h"
#include "scid/core/primitives.h"
#include <cstddef>
#include <optional>
#include <string>
+ Include dependency graph for notation.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  scid
 Public namespace for libscid.
 
namespace  scid::core
 Chess games, positions, movetext and notation.
 

Typedefs

using scid::core::sanStringT = char[SAN_STRING_SIZE]
 Legacy fixed-size SAN buffer type.
 
using scid::core::sanFlagT = byte
 Controls whether generated SAN includes check and mate suffix testing.
 

Functions

std::string scid::core::notation::currentPositionUci (const Game &game, MovetextLocation location)
 Builds a UCI "position" command for the position at a game location.
 
std::string scid::core::notation::previousMoveUci (const Game &game, MovetextLocation location)
 Returns the previous move at a location in UCI long algebraic notation.
 
std::string scid::core::notation::nextMoveUci (const Game &game, MovetextLocation location)
 Returns the next move at a location in UCI long algebraic notation.
 
std::string scid::core::notation::previousSan (const Game &game, MovetextLocation location)
 Returns the SAN text of the previous move at a location.
 
std::string scid::core::notation::nextSan (const Game &game, MovetextLocation location)
 Returns the SAN text of the next move at a location.
 
std::string scid::core::notation::partialMoveList (const Game &game, std::size_t plyCount)
 Formats the first plyCount mainline half-moves as compact SAN text.
 

Variables

constexpr std::size_t scid::core::SAN_STRING_SIZE = 10
 Maximum storage size for legacy fixed-size SAN buffers.
 
constexpr sanFlagT scid::core::SAN_NO_CHECKTEST = 0
 Generate SAN without checking for check or mate suffixes.
 
constexpr sanFlagT scid::core::SAN_CHECKTEST = 1
 Generate SAN with check suffix testing.
 
constexpr sanFlagT scid::core::SAN_MATETEST = 2
 Generate SAN with mate suffix testing.
 
constexpr std::size_t scid::core::UCI_MOVE_STRING_SIZE = 6
 Maximum storage size for legacy fixed-size UCI move buffers.
 

Detailed Description

Notation helpers for positions and moves at movetext locations.

Function Documentation

◆ currentPositionUci()

std::string scid::core::notation::currentPositionUci ( const Game game,
MovetextLocation  location 
)

Builds a UCI "position" command for the position at a game location.

Standard-start games are emitted as position startpos followed by the moves from the current effective start. Non-standard starts and positions after null moves are emitted from an explicit FEN.

◆ nextMoveUci()

std::string scid::core::notation::nextMoveUci ( const Game game,
MovetextLocation  location 
)

Returns the next move at a location in UCI long algebraic notation.

Returns
an empty string when there is no next move.

◆ nextSan()

std::string scid::core::notation::nextSan ( const Game game,
MovetextLocation  location 
)

Returns the SAN text of the next move at a location.

Stored SAN is preferred when available; otherwise it is generated from the current position.

Returns
an empty string when there is no next move or the stored move cannot be replayed legally.

◆ previousMoveUci()

std::string scid::core::notation::previousMoveUci ( const Game game,
MovetextLocation  location 
)

Returns the previous move at a location in UCI long algebraic notation.

Returns
an empty string when there is no previous move.

◆ previousSan()

std::string scid::core::notation::previousSan ( const Game game,
MovetextLocation  location 
)

Returns the SAN text of the previous move at a location.

Stored SAN is preferred when available; otherwise it is generated from the preceding position.

Returns
an empty string when there is no previous move or the stored move cannot be replayed legally.