read_ppn()
parses board games recorded in Portable Piecepack Notation (PPN) format.- If the suggested {piecepackr} package is installed then parsed games can be visualized with
{grid}
,{ggplot2}
,{rayrender}
,{rayvertex}
, or{rgl}
usingplot_move()
andanimate_game()
. - If the suggested {ppcli} package is installed then parsed games can be visualized in the terminal with
{cli}
usingcat_move()
andcat_game()
. - Has built-in setups for 100+ games playable with public domain game systems via use of the {ppdf} package. Allows users to write custom setup functions for additional games and board game systems.
view_game()
lets you interactively view and edit PPN recorded games with your choice of either a{shiny}
web interface or{cli}
command-line interface.- This is an extraction and refinement of functionality originally contained in the experimental {ppgames} package.
remotes::install_github("piecepackr/ppn")
ppn_file <- system.file("ppn/relativity.ppn", package = "ppn")
cat(paste("\t", readLines(ppn_file)), sep = "\n")
---
Round: Night
GameType:
Name: Relativity
Coins: "n45a5n/3a2243/3n4a2n/a25345"
...
{ Notes: Space has power of adjacency while Time has power of sequence }
1S. d3#e3 1T. d3#d1
2S. c2#c3 2T. d2#b1;M2@e6
3S. b2#a2 3T. e3#b2
4S. f1#f4 4T. e2#a3;M3@e6
5S. c4#d4 5T. f1#a1
6S. c1#c4;M5@b6 6T. b3#a3
7S. f3#a3 7T. d1#a3
8S. f2#f3 8T. b1#d2
9S. f3#a3;Mn@b6 9T. e2#c2
10S. e1#f1 10T. f1#d4
11S. c2#c3 11T. d4#c4
12S. b2#c2 12T. c1#e2;Ma@e6
library("gifski")
library("piecepackr")
library("ppn") # remotes::install_github("piecepackr/ppn")
library("tweenr")
envir <- game_systems("dejavu")
cfg <- as.list(envir$piecepack)
cfg$suit_color <- "black"
cfg$background_color.r1 <- "#E69F00"
cfg$background_color.r2 <- "#56B4E9"
cfg$background_color.r3 <- "#009E73"
cfg$background_color.r4 <- "#F0E442"
cfg$background_color.r5 <- "#D55E00"
cfg$background_color.r6 <- "#F079A7"
envir$piecepack <- pp_cfg(cfg)
ppn_file <- system.file("ppn/relativity.ppn", package = "ppn")
game <- read_ppn(ppn_file)[[1]]
animate_game(game, file = "man/figures/README-relativity.gif",
annotate = FALSE,
envir = envir, trans = op_transform, op_scale = 0.5,
n_transitions = 3, n_pauses = 2, fps = 7)