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

Public Member Functions

auto get_final_position () const -> Position

Public Attributes

std::unordered_map< string, string > metadata
std::vector< Movemoves
std::optional< game::Resultresult
Position startingPosition

(Note that these are not member symbols.)

auto from_pgn (std::string_view pgnText) -> std::expected< GameRecord, std::string_view >
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.

Definition at line 72 of file PGN.hpp.

Member Function Documentation

◆ get_final_position()

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

Returns the final position of this game.

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 77 of file PGN.hpp.

◆ moves

std::vector<Move> chess::notation::GameRecord::moves

This game's moves.

Definition at line 124 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 90 of file PGN.hpp.

◆ startingPosition

Position chess::notation::GameRecord::startingPosition

The starting position of this game.

Definition at line 80 of file PGN.hpp.


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