evaluate_pgn | R Documentation |
The evaluate_pgn()
function analyzes chess games in a PGN file using a
UCI-compatible chess engine. It applies the evaluate_game()
function from
the rbitr
package to each game in the PGN file and returns a list of game
logs.
evaluate_pgn(
pgn_path,
engine_path,
limiter,
limit,
n_cpus = 1L,
n_pv = 1L,
hash_size = NULL,
mute = FALSE,
save_logs = FALSE,
save_path = NULL
)
pgn_path |
A single-element character vector of the path to the PGN file. |
engine_path |
A single-element character vector of the path to a UCI chess engine. |
limiter |
A single-element character vector indicating the desired mode of search termination. Allowed values are 'depth' (to search a fixed number of plies), 'nodes' (to search a fixed number of nodes), and 'movetime' (to search a fixed number of milliseconds). |
limit |
A single-element integer vector of the desired search depth (# of plies), search nodes (# of nodes), or search time (# of mseconds). |
n_cpus |
(Default = 1) A single-element integer vector of the number of cpus to use. |
n_pv |
(Default = 1) A single-element integer vector of the desired number of principal variations. |
hash_size |
(Default = NULL) A single-element integer vector of the desired hash size, in MB. |
mute |
(Boolean, default = FALSE) Suppress progress report? |
save_logs |
(Boolean, default = FALSE) Save progress? Recommended for long analyses in case it has to be stopped before finishing all games. |
save_path |
A single-element character vector of the path to a directory where the game logs should be saved. |
Chess games are analyzed using a UCI compatible chess engine.
The function evaluate_pgn()
is a wrapper for rbitr's
evaluate_game()
function that applies evaluate_game()
to each game in
the specified PGN file. Note that this can take a very long time for PGN
files with a lot of games, and even longer when searching high numbers of
principal variations or running deep evaluations. For long runs, it is
recommended to set save_logs = TRUE. This will save the evaluation of each
game to a folder with the same name as the PGN file. If the analysis has to
be stopped and restarted, it will pick up where it left off if the
save_logs option was activated.
Since analysis can take a long time, progress is reported as each game is completed, along with a rough estimate of the time remaining. Progress reports may be turned off by setting mute = TRUE.
See evaluate_game()
for further details.
A list of gamelogs (see evaluate_game()
for details).
The server analysis on lichess.org uses a limit of 2250000 nodes. To mimic this, set limiter = 'nodes', and limit = 2250000.
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.
# Modify engine_path as required for your engine location & operating system
engine_path <- '//stockfish.exe'
pgn_path <- file.path(
system.file(package = 'rbitr'),
'extdata',
'fools_mate.pgn'
)
evaluate_pgn(pgn_path, engine_path, limiter = 'depth', limit = 1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.