View source: R/game_summary_plot.R
game_summary_plot | R Documentation |
Generate a plot of various game statistics.
game_summary_plot(
pgn_path,
game_number,
engine_path = NULL,
n_cpus = 1,
use_pgn_evals = TRUE,
limiter = "nodes",
limit = 2250000,
style = "graph"
)
pgn_path |
A single-element character vector of the path to a PGN file. |
game_number |
A single-element integer vector indicating which game in the PGN file to plot. |
engine_path |
A single-element character vector of the path to a UCI compatible chess engine. |
n_cpus |
(Default = 1) A single-element integer vector indicating how many cpus to use for analysis. |
use_pgn_evals |
(Default = TRUE) A single-element boolean indicating whether to use evals from the PGN file, if present. |
limiter |
(Default = 'nodes') A single-element character vector indicating the desire 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 |
(Default = 2250000) A single-element integer vector of the desired search depth (# of plies), search nodes (# of nodes), or search time (# of milliseconds). |
style |
(Default = 'graph') A single-element character vector indicating the plot style. Allowed values are 'graph' for a traditional graph with axes, or 'infographic' to add a background gradient and remove the axes (similar to lichess.org). |
The function game_summary_plot()
will first look for existing
analysis in the PGN file, and if not found, it will look for a saved
analysis. If no analysis data is found, it will analyze the game. The
default search is by depth, and the default depth is 2,250,000 nodes. The
defaults may be changed via the limiter
and limit
parameters.
An advantage plot and move time plot will be generated. (See
advantage_plot()
and scaled_time_plot()
for details.) In addition, a
table will be displayed showing the number of inaccuracies, mistakes, and
blunders, and the average centipawn loss (ACPL). (See get_imb()
and
get_acpl()
.) If clock data is not available in the PGN file, the
move-time plot will display a message that no data is available.
A ggplot object of the plotted data.
advantage_plot()
to plot advantage data.
time_plot()
to plot move time data.
get_acpl()
to calculate average centipawn loss.
get_imb()
to calculate inaccuracies, mistakes, and blunders.
pgn_path <- file.path(
system.file(package = 'rbitr'),
'extdata',
'short_game.pgn'
)
# Modify engine_path as required for your engine location & operating system
engine_path <- '//stockfish.exe'
p1 <- game_summary_plot(pgn_path, game_number = 1, engine_path)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.