Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Encoding: UTF-8
Package: ppcli
Type: Package
Title: Plaintext Board Game Visualizations
Version: 0.2.2-1
Version: 0.3.0-1
Authors@R: c(person("Trevor L.", "Davis", role=c("aut", "cre"),
email="trevor.l.davis@gmail.com",
comment = c(ORCID = "0000-0001-6341-4639")))
Expand Down
4 changes: 2 additions & 2 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
ppcli 0.2.2 (development)
ppcli 0.3.0 (development)
=========================

* No user-facing changes.
* `cat_piece()` and `str_piece()` add support for "cubes" bit pieces (#4).

ppcli 0.2.1
===========
Expand Down
5 changes: 4 additions & 1 deletion R/str_piece.R
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,7 @@ get_style_rs <- function(style, big = FALSE) {
dominoes_yellow = dominoes_ranks,
icehouse_pieces = rep(" ", 6L),
alquerque = rep_len("\u25cf", 6L),
cubes = rep_len("\u25a0", 6L),
go = rep_len("\u25cf", 6L),
marbles = rep_len("\u25cf", 9L),
morris = rep_len("\u25cf", 9L),
Expand Down Expand Up @@ -323,6 +324,7 @@ get_style_ss <- function(style, big = FALSE) {
dominoes_yellow = dominoes_ranks,
icehouse_pieces = c(rep_len("\u25b2", 5L), "\u25b3", rep_len("\u25b2", 2L)),
alquerque = c(rep_len("\u25cf", 5L), "\u25cb", rep_len("\u25cf", 2L)),
cubes = c(rep_len("\u25a0", 5L), "\u25a1", rep_len("\u25a0", 2L)),
go = c(rep_len("\u25cf", 5L), "\u25cb", rep_len("\u25cf", 2L)),
marbles = c(rep_len("\u25cf", 5L), "\u25cb", rep_len("\u25cf", 2L)),
morris = c(rep_len("\u25cf", 5L), "\u25cb", rep_len("\u25cf", 2L)),
Expand Down Expand Up @@ -360,6 +362,7 @@ get_style_fg <- function(style) {
dominoes_yellow = rep_len(dice_colors[5L], 7L),
icehouse_pieces = dice_colors,
alquerque = suit_colors,
cubes = suit_colors,
go = suit_colors,
marbles = suit_colors,
morris = suit_colors,
Expand Down Expand Up @@ -514,7 +517,7 @@ clean_df <- function(df) {
)

# Go stones and marbles should be "bit_back"
bit_back_cfgs <- c("alquerque", "go", "marbles", "morris")
bit_back_cfgs <- c("alquerque", "cubes", "go", "marbles", "morris")
df$piece_side <- ifelse(
df$piece_side == "bit_face" & df$cfg %in% bit_back_cfgs,
"bit_back",
Expand Down
11 changes: 11 additions & 0 deletions tests/testthat/_snaps/cat_piece.md
Original file line number Diff line number Diff line change
Expand Up @@ -609,6 +609,17 @@



---

Code
dfs <- tibble(piece_side = "bit_back", x = 1:6, y = 1, suit = 1:6, cfg = "cubes")
cat_piece(dfs)
Output

■ ■ ■ ■ ■ □



---

Code
Expand Down
6 changes: 6 additions & 0 deletions tests/testthat/test_cat_piece.R
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,12 @@ test_that("text diagrams", {
cat_piece(df)
})

# cubes
expect_snapshot({
dfs <- tibble(piece_side = "bit_back", x = 1:6, y = 1, suit = 1:6, cfg = "cubes")
cat_piece(dfs)
})

# morris
expect_snapshot({
df2 <- tibble(piece_side = "board_face", x = 2, y = 2, rank = 2L, suit = 3L, cfg = "morris")
Expand Down
Loading