Skip to contents

domino_tiles() generates a data frame of dominoes tiles. By default will generate all the dominoes tiles of a double-6 set.

Usage

domino_tiles(
  n = 7,
  ...,
  side = "face",
  piece_side = paste0("tile_", side),
  suit = sequence(n:1, from = 1:n),
  rank = rep.int(1:n, n:1),
  cfg = "dominoes",
  x = sequence(n:1, from = 1:n),
  y = 2 * rep.int(n:1, n:1) - 0.5,
  angle = 0
)

Arguments

n

The number of doubles in a set e.g. n = 7 for double-6 set, n = 10 for a double-9 set, n = 13 for a double-12 set.

...

Should be left empty.

side

Either "face" or "back".

piece_side

Either "tile_face" or "tile_back".

suit

"Bottom" half of domino. Will be coerced by domino_suit().

rank

"Top" half of domino. Will be coerced by piece_rank().

cfg

"dominoes" or perhaps "dominoes_black", "dominoes_blue", "dominoes_green", "dominoes_red", "dominoes_white", or "dominoes_yellow".

x, y

Cartesian coordinates (numeric vectors)

angle

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

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_double6 <- domino_tiles()
nrow(df_double6)
#> [1] 28
df_double9 <- domino_tiles(n = 10)
nrow(df_double9)
#> [1] 55
df_double12 <- domino_tiles(n = 13)
nrow(df_double12)
#> [1] 91
df_double15 <- domino_tiles(n = 16)
nrow(df_double15)
#> [1] 136