parse_pgnlog: Extract data from the output of rbitr’s evaluate_pgn()...

View source: R/parse_pgnlog.R

parse_pgnlogR Documentation

Extract data from the output of rbitr’s evaluate_pgn() function

Description

The parse_pgnlog() function is a wrapper for the parse_gamelog() function, which iterates over all the games in a PGN file

Usage

parse_pgnlog(pgnlog, target, depth = NULL)

Arguments

pgnlog

A list of gamelogs from rbitr's evaluate_pgn() function.

target

A single-element character vector of the output to return. Allowed values are 'score' for the evaluation in centipawns, 'pv' for the principal variation, or 'bestmove' for the best move.

depth

(Optional, default = NULL) A single-element integer vector indicating which search depth to return. The value must not be less than 1 or greater than the maximum depth reported by the engine. A value of NULL returns data for the maximum depth.

Details

The output of rbitr's evaluate_pgn() function is a list of logs from the evaluate_game() function, with each entry in the list corresponding to a game. The parse_pgnlog() function can extract evaluations in centipawns (score), principal variations (pv), or best moves (bestmove), depending on the value of the target parameter.

See parse_gamelog() for more details.

Value

A list of vectors of the extracted data.

See Also

The 'tabulate' functions tabulate analysis logs into data frames.

  • tabulate_positionlog() for condensing analysis of one position.

  • tabulate_gamelog() for condensing analysis of one game.

  • tabulate_pgnlog() for condensing analysis of an entire pgn file.

The 'parse' functions extract specific data from analysis logs.

  • parse_gamelog() for extracting data from one evaluated game.

  • parse_pgnlog() for extracting data from games in a pgn.

The 'evaluate' functions produce analysis logs.

  • evaluate_position() for analyzing chess positions.

  • evaluate_game() for analyzing individual games.

  • evaluate_pgn() for evaluating all the games in a PGN file.

Examples

pgnlog <- list(list(c(
"Stockfish 13 by the Stockfish developers (see AUTHORS file)",
"readyok",
"info string NNUE evaluation using nn-62ef826d1a6d.nnue enabled",
"info depth 1 seldepth 1 multipv 1 score cp 146 nodes 30 nps 30000 tbhits 0 time 1 pv d2d4",
"bestmove d2d4"
)))
parse_pgnlog(pgnlog, 'score')
parse_pgnlog(pgnlog, 'pv')
parse_pgnlog(pgnlog, 'bestmove')

dryguy/rbitr documentation built on Oct. 15, 2024, 6:18 a.m.