Skip to contents

A gm_game is the S3 container returned by gm_read_pgn(), gm_play() and the study tools. It is a list with four elements:

Details

moves

Character vector of mainline moves in standard algebraic notation, one per half-move.

positions

List of gm_position objects, one longer than moves: the starting position followed by the position after each move.

tags

Named list of 'PGN' header tags, e.g. Event or White.

result

One of "1-0", "0-1", "1/2-1/2" or "*".

Use is_gm_game() to test for the class, gm_write_pgn() to serialise it and gm_plot_eval() to visualise how the evaluation moved.

Examples

game <- gm_read_pgn("1. e4 e5 2. Nf3 Nc6 *", text = TRUE)
game$moves
#> [1] "e4"  "e5"  "Nf3" "Nc6"
game$result
#> [1] "*"