Skip to contents

cube_bits() returns cubes.

Usage

cube_bits(
  ...,
  suit = 1:6,
  rank = 2L,
  x = as.double(1:6),
  y = 1,
  angle = 0,
  length.out = NA_integer_
)

Arguments

...

Should be left empty.

suit

Suit value (color) of cubes. 1L is "red", 2L is "black", 3L is "green", 4L is "blue", 5L is "yellow", and 6L is "white". Will be coerced by piece_suit().

rank

Determines the size of the cube from 8mm (rank 1) to 25mm (rank 6). Default is 10mm cubes.

x, y

Cartesian coordinates (numeric vectors)

angle

Rotation of piece (numeric vector of degrees, counter-clockwise). Will be coerced by piece_angle().

length.out

The number of pieces. Not needed if all the arguments are the same length (or of length one) and this length is the same as the number of desired pieces.

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 <- cube_bits(suit = 6:1, rank = 6:1, x = 6:1, y = 1)
if (requireNamespace("ppcli", quietly = TRUE) &&
    packageVersion("ppcli") >= "0.3.0-1") {
  ppcli::cat_piece(df)
}
#>               
#>     
#>               
#>               
if (require("piecepackr", quietly = TRUE) &&
    packageVersion("piecepackr") >= "1.16.0-3") {
  grid::grid.newpage()
  envir = game_systems()
  pmap_piece(df, envir = envir, default.units = "in", op_scale = 0.5)
}