diff --git a/DESCRIPTION b/DESCRIPTION index 1c295fd..4b38265 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -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"))) diff --git a/NEWS.md b/NEWS.md index 4458812..d93f4a2 100644 --- a/NEWS.md +++ b/NEWS.md @@ -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 =========== diff --git a/R/str_piece.R b/R/str_piece.R index 3cc37d9..232ae1b 100644 --- a/R/str_piece.R +++ b/R/str_piece.R @@ -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), @@ -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)), @@ -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, @@ -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", diff --git a/tests/testthat/_snaps/cat_piece.md b/tests/testthat/_snaps/cat_piece.md index d0e43d7..be16ebf 100644 --- a/tests/testthat/_snaps/cat_piece.md +++ b/tests/testthat/_snaps/cat_piece.md @@ -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 diff --git a/tests/testthat/test_cat_piece.R b/tests/testthat/test_cat_piece.R index c8b65ec..3e71470 100644 --- a/tests/testthat/test_cat_piece.R +++ b/tests/testthat/test_cat_piece.R @@ -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")