Skip to contents

setup_by_name() returns setup data frames by game name and game system. alquerque_setup_by_name(), checker_setup_by_name(), chess_setup_by_name(), dominoes_setup_by_name(), marble_setup_by_name(), piecepack_setup_by_name() and stackpack_setup_by_name() are aliases that set the game system.

Usage

setup_by_name(
  name,
  system = known_game_systems,
  ...,
  getter = function(x) get(x, envir = getNamespace("ppdf"))
)

alquerque_setup_by_name(
  name,
  ...,
  getter = function(x) get(x, envir = getNamespace("ppdf"))
)

checker_setup_by_name(
  name,
  ...,
  getter = function(x) get(x, envir = getNamespace("ppdf"))
)

chess_setup_by_name(
  name,
  ...,
  getter = function(x) get(x, envir = getNamespace("ppdf"))
)

domino_setup_by_name(
  name,
  ...,
  getter = function(x) get(x, envir = getNamespace("ppdf"))
)

go_setup_by_name(
  name,
  ...,
  getter = function(x) get(x, envir = getNamespace("ppdf"))
)

marble_setup_by_name(
  name,
  ...,
  getter = function(x) get(x, envir = getNamespace("ppdf"))
)

morris_setup_by_name(
  name,
  ...,
  getter = function(x) get(x, envir = getNamespace("ppdf"))
)

piecepack_setup_by_name(
  name,
  ...,
  getter = function(x) get(x, envir = getNamespace("ppdf"))
)

reversi_setup_by_name(
  name,
  ...,
  getter = function(x) get(x, envir = getNamespace("ppdf"))
)

stackpack_setup_by_name(
  name,
  ...,
  getter = function(x) get(x, envir = getNamespace("ppdf"))
)

tarot_setup_by_name(
  name,
  ...,
  getter = function(x) get(x, envir = getNamespace("ppdf"))
)

Arguments

name

Game name. Will be normalized by normalize_name().

system

Game system.

...

Additional arguments to pass to the underlying setup function.

getter

Function with a single function name argument to use. By default will just look for functions in this package but a developer may want to consider dynGet() or a wrapper around get() with a custom envir argument.

Value

A tibble::tibble() data frame with the following columns:

  • "piece_side"

  • "suit"

  • "rank"

  • "cfg" (optional, defaults to "piecepack")

  • "x"

  • "y"

  • "angle" (optional, defaults to 0).

This data frame is compatible with piecepackr::render_piece() and likely ppcli::cat_piece().

Examples

df <- chess_setup_by_name("chess")
if (requireNamespace("ppcli", quietly = TRUE) &&
    packageVersion("ppcli") >= "0.3.0-1") {
  ppcli::cat_piece(df, annotate = TRUE)
}
#>  ┌─┰─┰─┰─┰─┰─┰─┰─┐
#> 8│♜┃♞┃♝┃♛┃♚┃♝┃♞┃♜│
#>  ┝━╋━╋━╋━╋━╋━╋━╋━┥
#> 7│♟┃♟┃♟┃♟┃♟┃♟┃♟┃♟│
#>  ┝━╋━╋━╋━╋━╋━╋━╋━┥
#> 6│ ┃ ┃ ┃ ┃ ┃ ┃ ┃ │
#>  ┝━╋━╋━╋━╋━╋━╋━╋━┥
#> 5│ ┃ ┃ ┃ ┃ ┃ ┃ ┃ │
#>  ┝━╋━╋━╋━╋━╋━╋━╋━┥
#> 4│ ┃ ┃ ┃ ┃ ┃ ┃ ┃ │
#>  ┝━╋━╋━╋━╋━╋━╋━╋━┥
#> 3│ ┃ ┃ ┃ ┃ ┃ ┃ ┃ │
#>  ┝━╋━╋━╋━╋━╋━╋━╋━┥
#> 2│♙┃♙┃♙┃♙┃♙┃♙┃♙┃♙│
#>  ┝━╋━╋━╋━╋━╋━╋━╋━┥
#> 1│♖┃♘┃♗┃♕┃♔┃♗┃♘┃♖│
#>  └─┸─┸─┸─┸─┸─┸─┸─┘
#>   a b c d e f g h