Read/write Portable Piecepack Notation (PPN) files

read_ppn(file, parse = TRUE)

write_ppn(games = list(), file = "")

Arguments

file

Filename, if "" will use stdout()

parse

Logical of whether to parse the moves in the ppn file

games

A list of parsed PPN games (as returned by read_ppn())

Value

A list, for each game in the file a list containing info about the game

See also

plot_move(), animate_game(), and cat_move() for visualizing parsed ppn games.

Examples

list.files(system.file("ppn", package = "ppgames"))
#> [1] "alien-city.ppn" "american-checkers.ppn" #> [3] "desfases.ppn" "four-field-kono.ppn" #> [5] "fujisan.ppn" "ice-floe.ppn" #> [7] "international-chess.ppn" "japan.ppn" #> [9] "plans-of-action.ppn" "relativity.ppn" #> [11] "tablut.ppn" "tic-tac-toe.ppn" #> [13] "xiangqi.ppn"
file <- system.file("ppn/tic-tac-toe.ppn", package = "ppgames") games <- read_ppn(file) tmp <- tempfile(fileext = ".ppn") write_ppn(games, tmp) unlink(tmp)