save_ruleset: Save ruleset

View source: R/rules.R

save_rulesetR Documentation

Save ruleset

Description

save_ruleset save ruleset of a game. save_pamphlet is a variant that saves the ruleset as a (tri-fold) pamphlet while save_pocketmod is a variant that saves the rulest as a “pocketmod” booklet.

Usage

save_ruleset(
  game,
  gk = game_kit(),
  output = NULL,
  quietly = TRUE,
  size = "letter",
  ...,
  game_info = NULL,
  game_files = NULL,
  cmd_options = NULL
)

save_pamphlet(
  game,
  gk = game_kit(),
  output = NULL,
  quietly = TRUE,
  size = "letter",
  duplex_edge = "short",
  ...,
  game_info = NULL,
  game_files = NULL,
  save_promo_fn = save_promo_image
)

save_pocketmod(
  game,
  gk = game_kit(),
  output = NULL,
  quietly = TRUE,
  size = "letter",
  duplex_edge = "short",
  ...,
  game_info = NULL,
  game_files = NULL,
  save_promo_fn = save_promo_image
)

Arguments

game

Game name to generate ruleset for. See names_rulesets(). Will be normalized by normalize_name().

gk

A game_kit R6 object.

output

Path to the output file. If NULL the function will guess a default.

quietly

Whether to hide document compilation output.

size

Paper size (either "letter", or "A4").

...

Ignored

game_info

List with game info. If NULL then we use yaml::yaml.load_file(system.file("extdata/game_info.yaml", package = "ppgames")).

game_files

Character vector of (full path to) "Rtex" game rules. If NULL then we use list.files(system.file("rules", package = "ppgames"), full.names = TRUE).

cmd_options

Options passed to pandoc when using non-pdf output formats. If NULL we try to guess a good set of options.

duplex_edge

String specifying the desired duplex printing edge. If "short" match the second page along its short edge (second page flipped up, easier to preview on computer) and if "long" match along its long edge (second page flipped upside down, usual printer default).

save_promo_fn

A function with arguments game, gk, and file that saves a promo image for game. Defaults to save_promo_image().

See Also

See https://pocketmod.com/ for more information about “pocketmod” booklets including folding instructions.

Examples

  cfg <- piecepackr::game_systems()$dual_piecepacks_expansion
  gk <- game_kit(list(cfg = cfg))
  if (Sys.which("xelatex") != "") {
    output <- tempfile(fileext = ".pdf")
    save_pamphlet("tablut", gk = gk, output = output)
    # xopen::xopen(output)
    # browseURL(output)
  }

piecepackr/ppgames documentation built on Jan. 17, 2025, 2:24 p.m.