BenBot 1.7.5
A chess engine
Loading...
Searching...
No Matches
chess::notation::GameRecord Struct Referencefinal

#include <libchess/notation/PGN.hpp>

Collaboration diagram for chess::notation::GameRecord:

Classes

struct  Move
struct  PositionPointer
struct  Variation

Public Member Functions

auto get_final_position () const -> Position
auto get_move_at_pos (const PositionPointer &pos) const -> const Move *
auto get_starting_position () const -> Position

Static Public Member Functions

static auto from_starting_position (const Position &pos) -> GameRecord

Public Attributes

std::unordered_map< string, string > metadata
Variation moves
std::optional< game::Result > result

(Note that these are not member symbols.)

auto from_pgn (std::string_view pgnText) -> std::expected< GameRecord, std::string >
auto parse_all_pgns (std::string_view fileContent) -> std::vector< GameRecord >
auto to_pgn (const GameRecord &game, bool useBlockComments=true) -> string

Detailed Description

A record of a complete game, including some metadata. This structure is returned by the from_pgn() method.

Todo

Pointer class for keeping track of a specific move within a specific variation

get_all_moves_for(Pointer) function

Definition at line 82 of file PGN.hpp.

Member Function Documentation

◆ from_starting_position()

auto chess::notation::GameRecord::from_starting_position ( const Position & pos) -> GameRecord
inlinestaticnodiscard

Returns an empty game with the given starting position.

Definition at line 149 of file PGN.hpp.

◆ get_final_position()

auto chess::notation::GameRecord::get_final_position ( ) const -> Position
nodiscard

Returns the final position of this game.

◆ get_move_at_pos()

auto chess::notation::GameRecord::get_move_at_pos ( const PositionPointer & pos) const -> const Move *
nodiscard

◆ get_starting_position()

auto chess::notation::GameRecord::get_starting_position ( ) const -> Position
inlinenodiscard

Returns the starting position of this game.

Definition at line 143 of file PGN.hpp.

Member Data Documentation

◆ metadata

std::unordered_map<string, string> chess::notation::GameRecord::metadata

This game's metadata. The keys will be things like "Event", "Site", "Date", etc. The values will not include surrounding quotes.

Definition at line 87 of file PGN.hpp.

◆ moves

Variation chess::notation::GameRecord::moves

This game's moves.

Definition at line 140 of file PGN.hpp.

◆ result

std::optional<game::Result> chess::notation::GameRecord::result

If the game ended in a conclusive result, this holds the appropriate Result enumeration. If the game is ongoing, this is nullopt.

Note that this may be different from record.get_final_position().get_result(), as that function only accounts for decisive board state. This value may be set if a player resigned or the game was adjudicated.

Definition at line 97 of file PGN.hpp.


The documentation for this struct was generated from the following file:
  • libchess/include/libchess/notation/PGN.hpp