dice_dice() generates data frames for standard six-sided dice.
d4_dice(), numeral_dice(), d8_dice(), d10_dice(), percentile_dice(), d12_dice(), and d20_dice() generates data frames for the classic seven polyhedral dice.
fudge_dice() generates data frames for fudge dice.
Usage
dice_dice(
...,
suit = 1:6,
rank = 1L,
x = as.double(1:6),
y = 1,
angle = 0,
length.out = NA_integer_
)
d4_dice(
...,
suit = 1:6,
rank = 1L,
x = as.double(1:6),
y = 1,
angle = 0,
length.out = NA_integer_
)
fudge_dice(
...,
suit = 1:6,
rank = 1L,
x = as.double(1:6),
y = 1,
angle = 0,
length.out = NA_integer_
)
numeral_dice(
...,
suit = 1:6,
rank = 1L,
x = as.double(1:6),
y = 1,
angle = 0,
length.out = NA_integer_
)
d8_dice(
...,
suit = 1:6,
rank = 1L,
x = as.double(1:6),
y = 1,
angle = 0,
length.out = NA_integer_
)
d10_dice(
...,
suit = 1:6,
rank = 1L,
x = as.double(1:6),
y = 1,
angle = 0,
length.out = NA_integer_
)
percentile_dice(
...,
suit = 1:6,
rank = 1L,
x = as.double(1:6),
y = 1,
angle = 0,
length.out = NA_integer_
)
d12_dice(
...,
suit = 1:6,
rank = 1L,
x = as.double(1:6),
y = 1,
angle = 0,
length.out = NA_integer_
)
d20_dice(
...,
suit = 1:6,
rank = 1L,
x = as.double(1:6),
y = 1,
angle = 0,
length.out = NA_integer_
)Arguments
- ...
Should be left empty.
- suit
Suit value (color) of dice.
1Lis "red",2Lis "black",3Lis "green",4Lis "blue",5Lis "yellow", and6Lis "white". Will be coerced bypiece_suit().- rank
Rank value of dice from
1L(one) on up. d10 zeroes are10L. Will be coerced bydice_rank()exceptpercentile_dice()will coerce withpercentile_dice_rank()andfudge_dice()will coerce withfudge_dice_rank().- x, y
Cartesian coordinates (numeric vectors)
- angle
Rotation of dice (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
dfd <- dice_dice(suit = 1:6, rank = 1:6, x = 1:6, y = 1)
dfn <- numeral_dice(suit = 1:6, rank = 1:6, x = 1:6, y = 2)
dff <- fudge_dice(suit = 1:6, rank = rep(c("-", " ", "+"), 2L),
x = 1:6, y = 3)
dfd12 <- d12_dice(suit = 1:6, rank = 1:6, x = 1:6, y = 4)
df <- rbind(dfd, dfn, dff, dfd12)
if (require("piecepackr", quietly = TRUE) &&
packageVersion("piecepackr") >= "1.15.0-1" &&
piecepackr:::device_supports_unicode()) {
grid::grid.newpage()
envir = game_systems()
pmap_piece(df, envir = envir, default.units = "in", op_scale = 0.01)
}