From 16d8eba57e1cadda7f02018e25eb01b30dd5aa08 Mon Sep 17 00:00:00 2001 From: Trevor L Davis Date: Fri, 24 Apr 2026 12:20:22 -0700 Subject: [PATCH] feat: `checker_jeson_mor()`, `chess_jeson_mor()`, and `piecepack_jeson_mor()` Co-Authored-By: Claude Sonnet 4.6 --- DESCRIPTION | 2 +- NAMESPACE | 3 +++ NEWS.md | 8 +++++- R/checker_games_other.R | 16 +++++++++++ R/chess_games_variant.R | 19 +++++++++++++ R/piecepack_games_chess.R | 27 +++++++++++++++++++ man/checker_games_other.Rd | 6 ++++- man/chess_games_variant.Rd | 10 ++++++- man/piecepack_games_chess.Rd | 6 ++++- tests/testthat/_snaps/checker_games_other.md | 26 ++++++++++++++++++ tests/testthat/_snaps/chess_games_variant.md | 26 ++++++++++++++++++ .../testthat/_snaps/piecepack_games_chess.md | 26 ++++++++++++++++++ tests/testthat/test-checker_games_other.R | 1 + tests/testthat/test-chess_games_variant.R | 1 + tests/testthat/test-games_info.R | 6 ++--- tests/testthat/test-piecepack_games_chess.R | 1 + 16 files changed, 176 insertions(+), 8 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 134e94f..5632e19 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -2,7 +2,7 @@ Encoding: UTF-8 Package: ppdf Type: Package Title: Board Game Setups -Version: 0.3.0-17 +Version: 0.3.0-18 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/NAMESPACE b/NAMESPACE index 2941830..adfcbc7 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -34,6 +34,7 @@ export(checker_grasshopper) export(checker_international_checkers) export(checker_italian_checkers) export(checker_jamaican_checkers) +export(checker_jeson_mor) export(checker_julgonu) export(checker_kangaroo) export(checker_lasca) @@ -89,6 +90,7 @@ export(chess_fischer_random_chess) export(chess_games) export(chess_horde_chess) export(chess_international_chess) +export(chess_jeson_mor) export(chess_monochrome_chess) export(chess_none) export(chess_racing_kings) @@ -243,6 +245,7 @@ export(piecepack_italian_checkers) export(piecepack_jamaican_checkers) export(piecepack_japan) export(piecepack_japanese_chess) +export(piecepack_jeson_mor) export(piecepack_julgonu) export(piecepack_kangaroo) export(piecepack_kings_valley) diff --git a/NEWS.md b/NEWS.md index 936a084..4749151 100644 --- a/NEWS.md +++ b/NEWS.md @@ -4,11 +4,16 @@ ppdf 0.3.0 (development) New features ------------ -* The following functions generate data frames to setup checkers sets (#49): +* The following functions generate data frames to setup checkers sets (#49, #50): + `checker_dodgem()` + + `checker_jeson_mor()` + `checker_kangaroo()` +* The following functions generate data frames to setup chess sets (#50): + + + `chess_jeson_mor()` + * The following functions generate data frames to setup cubes (#76): + `cube_bits()` @@ -24,6 +29,7 @@ New features + `piecepack_achi()` + `piecepack_dara()` + `piecepack_dodgem()` + + `piecepack_jeson_mor()` + `piecepack_kangaroo()` + `piecepack_kings_valley()` + `piecepack_leapfrog()` diff --git a/R/checker_games_other.R b/R/checker_games_other.R index dc9597a..273f775 100644 --- a/R/checker_games_other.R +++ b/R/checker_games_other.R @@ -54,6 +54,10 @@ checker_games_other <- function() { , "``checker_grasshopper()``" , NA_character_ , "http://www.cyningstan.com/game/71/grasshopper" + , "Jeson Mor" + , "``checker_jeson_mor()``" + , NA_character_ + , "https://en.wikipedia.org/wiki/Jeson_Mor" , "Jul-Gonu" , "``checker_julgonu()``" , NA_character_ @@ -131,6 +135,18 @@ checker_grasshopper <- function(cell_width = getOption("ppdf.checker_cell_width" to_checkers(piecepack_grasshopper(), cell_width) } +#' @rdname checker_games_other +#' @export +checker_jeson_mor <- function(cell_width = getOption("ppdf.checker_cell_width", 1)) { + force(cell_width) + local_options(ppdf.checker_cell_width = NULL) + df_board <- checker_board(9L, piece_side = "board_back") + df_w <- checker_bits(suit = 6L, x = 1:9, y = 1) + df_b <- checker_bits(suit = 2L, x = 1:9, y = 9) + bind_rows(df_board, df_w, df_b) |> + set_cell_width(cell_width, "checkers") +} + #' @rdname checker_games_other #' @export checker_julgonu <- function(cell_width = getOption("ppdf.checker_cell_width", 1)) { diff --git a/R/chess_games_variant.R b/R/chess_games_variant.R index 8940220..6e68909 100644 --- a/R/chess_games_variant.R +++ b/R/chess_games_variant.R @@ -40,6 +40,10 @@ chess_games_variant <- function() { , "``chess_horde_chess()``" , NA_character_ , "https://lichess.org/variant/horde" + , "Jeson Mor" + , "``chess_jeson_mor()``" + , NA_character_ + , "https://en.wikipedia.org/wiki/Jeson_Mor" , "Monochrome Chess" , "``chess_monochrome_chess()``" , NA_character_ @@ -143,6 +147,21 @@ chess_horde_chess <- function( #' @export chess_international_chess <- chess_chess +#' @rdname chess_games_variant +#' @export +chess_jeson_mor <- function( + cell_width = getOption("ppdf.chess_cell_width", 1), + ..., + fen = "nnnnnnnnn/9/9/9/9/9/9/9/NNNNNNNNN" +) { + check_dots_empty() + force(cell_width) + local_options(ppdf.chess_cell_width = NULL) + df_board <- chess_board(nrows = 9L) + bind_rows(df_board, fen_to_chess_bits(fen)) |> + set_cell_width(cell_width, "chess") +} + #' @rdname chess_games_variant #' @export chess_monochrome_chess <- function( diff --git a/R/piecepack_games_chess.R b/R/piecepack_games_chess.R index c16a3df..89635d7 100644 --- a/R/piecepack_games_chess.R +++ b/R/piecepack_games_chess.R @@ -47,6 +47,10 @@ piecepack_games_chess <- function() { , "``piecepack_international_chess()`` aka ``piecepack_chess()``" , NA_character_ , "https://www.ludism.org/ppwiki/Chess" + , "Jeson Mor" + , "``piecepack_jeson_mor()``" + , NA_character_ + , "https://en.wikipedia.org/wiki/Jeson_Mor" , "Minishogi" , "``piecepack_minishogi()``" , NA_character_ @@ -423,6 +427,29 @@ piecepack_chess_pieces <- function( #' @export piecepack_international_chess <- piecepack_chess +#' @rdname piecepack_games_chess +#' @export +piecepack_jeson_mor <- function() { + df_t <- piecepack_rectangular_board(9L, 9L) + df_cb <- piecepack_coins( + side = "back", + x = 1:9, + y = 9, + suit = c(rep(1L, 5L), rep(2L, 4L)), + rank = c(1:5, 1:4), + angle = 180 + ) + df_cw <- piecepack_coins( + side = "back", + x = 1:9, + y = 1, + suit = c(rep(4L, 4L), rep(3L, 5L)), + rank = c(1:4, 1:5) + ) + df_d <- piecepack_dice(suit = 4L, rank = 2L, x = 5, y = 5) + bind_rows(df_t, df_cb, df_cw, df_d) +} + #' @rdname piecepack_games_chess #' @export piecepack_japanese_chess <- function(has_subpack = FALSE, cfg2 = "piecepack") { diff --git a/man/checker_games_other.Rd b/man/checker_games_other.Rd index cf47de3..2e9a95b 100644 --- a/man/checker_games_other.Rd +++ b/man/checker_games_other.Rd @@ -9,6 +9,7 @@ \alias{checker_focus} \alias{checker_four_field_kono} \alias{checker_grasshopper} +\alias{checker_jeson_mor} \alias{checker_julgonu} \alias{checker_kangaroo} \alias{checker_lines_of_action} @@ -31,6 +32,8 @@ checker_four_field_kono(cell_width = getOption("ppdf.checker_cell_width", 1)) checker_grasshopper(cell_width = getOption("ppdf.checker_cell_width", 1)) +checker_jeson_mor(cell_width = getOption("ppdf.checker_cell_width", 1)) + checker_julgonu(cell_width = getOption("ppdf.checker_cell_width", 1)) checker_kangaroo(cell_width = getOption("ppdf.checker_cell_width", 1)) @@ -57,7 +60,7 @@ A \code{\link[tibble:tibble]{tibble::tibble()}} data frame with the following co This data frame is compatible with \code{\link[piecepackr:render_piece]{piecepackr::render_piece()}} and likely \code{\link[ppcli:cat_piece]{ppcli::cat_piece()}}. } \description{ -\code{tibble} data frames of setups for 10 other games playable with a checkers set. +\code{tibble} data frames of setups for 11 other games playable with a checkers set. Data frame output can usually be plotted with \code{pmap_piece(df, default.units = "in")}. } \details{ @@ -70,6 +73,7 @@ Here are links for more information about the various games:\tabular{ll}{ Focus \tab \url{https://en.wikipedia.org/wiki/Focus_(board_game)} \cr Four Field Kono \tab \url{https://en.wikipedia.org/wiki/Four_Field_Kono} \cr Grasshopper \tab \url{http://www.cyningstan.com/game/71/grasshopper} \cr + Jeson Mor \tab \url{https://en.wikipedia.org/wiki/Jeson_Mor} \cr Jul-Gonu \tab \url{https://en.wikipedia.org/wiki/Jul-Gonu} \cr Kangaroo \tab \url{https://boardgamegeek.com/boardgame/6132/kangaroo-the-jumping-game} \cr Lines of Action \tab \url{https://en.wikipedia.org/wiki/Lines_of_Action} \cr diff --git a/man/chess_games_variant.Rd b/man/chess_games_variant.Rd index 5f41405..5278df3 100644 --- a/man/chess_games_variant.Rd +++ b/man/chess_games_variant.Rd @@ -7,6 +7,7 @@ \alias{chess_fischer_random_chess} \alias{chess_horde_chess} \alias{chess_international_chess} +\alias{chess_jeson_mor} \alias{chess_monochrome_chess} \alias{chess_racing_kings} \title{Setups for chess variants} @@ -43,6 +44,12 @@ chess_international_chess( fen = "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1" ) +chess_jeson_mor( + cell_width = getOption("ppdf.chess_cell_width", 1), + ..., + fen = "nnnnnnnnn/9/9/9/9/9/9/9/NNNNNNNNN" +) + chess_monochrome_chess( cell_width = getOption("ppdf.chess_cell_width", 1), ..., @@ -80,7 +87,7 @@ A \code{\link[tibble:tibble]{tibble::tibble()}} data frame with the following co This data frame is compatible with \code{\link[piecepackr:render_piece]{piecepackr::render_piece()}} and likely \code{\link[ppcli:cat_piece]{ppcli::cat_piece()}}. } \description{ -\code{tibble} data frames of setups for 5 chess variants. +\code{tibble} data frames of setups for 6 chess variants. Data frame output can usually be plotted with \code{pmap_piece(df, default.units = "in")}. } \details{ @@ -89,6 +96,7 @@ Here are links for more information about the various games:\tabular{ll}{ (International) Chess \tab \url{https://en.wikipedia.org/wiki/Chess} \cr Fischer Random Chess AKA Chess960 \tab \url{https://www.chessvariants.com/diffsetup.dir/fischer.html} \cr Horde Chess \tab \url{https://lichess.org/variant/horde} \cr + Jeson Mor \tab \url{https://en.wikipedia.org/wiki/Jeson_Mor} \cr Monochrome Chess \tab \url{https://wunderland.com/WTS/Andy/Games/monochess.html} \cr Racing Kings \tab \url{https://www.chessvariants.com/diffobjective.dir/racing.html} \cr } diff --git a/man/piecepack_games_chess.Rd b/man/piecepack_games_chess.Rd index 54688f9..b3217f1 100644 --- a/man/piecepack_games_chess.Rd +++ b/man/piecepack_games_chess.Rd @@ -11,6 +11,7 @@ \alias{piecepack_chinese_chess} \alias{piecepack_four_seasons_chess} \alias{piecepack_international_chess} +\alias{piecepack_jeson_mor} \alias{piecepack_japanese_chess} \alias{piecepack_minishogi} \alias{piecepack_racing_kings} @@ -37,6 +38,8 @@ piecepack_four_seasons_chess(has_subpack = FALSE) piecepack_international_chess(has_subpack = FALSE) +piecepack_jeson_mor() + piecepack_japanese_chess(has_subpack = FALSE, cfg2 = "piecepack") piecepack_minishogi() @@ -75,7 +78,7 @@ A \code{\link[tibble:tibble]{tibble::tibble()}} data frame with the following co This data frame is compatible with \code{\link[piecepackr:render_piece]{piecepackr::render_piece()}} and likely \code{\link[ppcli:cat_piece]{ppcli::cat_piece()}}. } \description{ -\code{tibble} data frames of setups for 10 chess variants playable with a piecepack. +\code{tibble} data frames of setups for 11 chess variants playable with a piecepack. Data frame output can usually be plotted with \code{pmap_piece(df, default.units = "in")}. } \details{ @@ -86,6 +89,7 @@ Here are links for more information about the various chess variants:\tabular{ll Fischer Random Chess AKA Chess960 \tab \url{https://www.chessvariants.com/diffsetup.dir/fischer.html} \cr Four Seasons Chess \tab \url{https://www.chessvariants.com/historic.dir/4seiz.html} \cr (International) Chess \tab \url{https://www.ludism.org/ppwiki/Chess} \cr + Jeson Mor \tab \url{https://en.wikipedia.org/wiki/Jeson_Mor} \cr Minishogi \tab \url{https://en.wikipedia.org/wiki/Minishogi} \cr Racing Kings \tab \url{https://www.chessvariants.com/diffobjective.dir/racing.html} \cr Shogi AKA Japanese Chess \tab \url{https://www.ludism.org/ppwiki/Shogi} \cr diff --git a/tests/testthat/_snaps/checker_games_other.md b/tests/testthat/_snaps/checker_games_other.md index 17418ae..7908c0f 100644 --- a/tests/testthat/_snaps/checker_games_other.md +++ b/tests/testthat/_snaps/checker_games_other.md @@ -116,6 +116,32 @@ └─┸─┸─┸─┸─┸─┸─┸─┘ +--- + + Code + cat_piece(checker_jeson_mor(), annotate = TRUE) + Output + ┌─┰─┰─┰─┰─┰─┰─┰─┰─┐ + 9│⛂┃⛂┃⛂┃⛂┃⛂┃⛂┃⛂┃⛂┃⛂│ + ┝━╋━╋━╋━╋━╋━╋━╋━╋━┥ + 8│ ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┃ │ + ┝━╋━╋━╋━╋━╋━╋━╋━╋━┥ + 7│ ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┃ │ + ┝━╋━╋━╋━╋━╋━╋━╋━╋━┥ + 6│ ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┃ │ + ┝━╋━╋━╋━╋━╋━╋━╋━╋━┥ + 5│ ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┃ │ + ┝━╋━╋━╋━╋━╋━╋━╋━╋━┥ + 4│ ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┃ │ + ┝━╋━╋━╋━╋━╋━╋━╋━╋━┥ + 3│ ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┃ │ + ┝━╋━╋━╋━╋━╋━╋━╋━╋━┥ + 2│ ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┃ │ + ┝━╋━╋━╋━╋━╋━╋━╋━╋━┥ + 1│⛀┃⛀┃⛀┃⛀┃⛀┃⛀┃⛀┃⛀┃⛀│ + └─┸─┸─┸─┸─┸─┸─┸─┸─┘ + a b c d e f g h i + --- Code diff --git a/tests/testthat/_snaps/chess_games_variant.md b/tests/testthat/_snaps/chess_games_variant.md index 50af6a3..11e1856 100644 --- a/tests/testthat/_snaps/chess_games_variant.md +++ b/tests/testthat/_snaps/chess_games_variant.md @@ -118,6 +118,32 @@ └─┸─┸─┸─┸─┸─┸─┸─┘ +--- + + Code + cat_piece(chess_jeson_mor(), annotate = TRUE) + Output + ┌─┰─┰─┰─┰─┰─┰─┰─┰─┐ + 9│♞┃♞┃♞┃♞┃♞┃♞┃♞┃♞┃♞│ + ┝━╋━╋━╋━╋━╋━╋━╋━╋━┥ + 8│ ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┃ │ + ┝━╋━╋━╋━╋━╋━╋━╋━╋━┥ + 7│ ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┃ │ + ┝━╋━╋━╋━╋━╋━╋━╋━╋━┥ + 6│ ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┃ │ + ┝━╋━╋━╋━╋━╋━╋━╋━╋━┥ + 5│ ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┃ │ + ┝━╋━╋━╋━╋━╋━╋━╋━╋━┥ + 4│ ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┃ │ + ┝━╋━╋━╋━╋━╋━╋━╋━╋━┥ + 3│ ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┃ │ + ┝━╋━╋━╋━╋━╋━╋━╋━╋━┥ + 2│ ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┃ │ + ┝━╋━╋━╋━╋━╋━╋━╋━╋━┥ + 1│♘┃♘┃♘┃♘┃♘┃♘┃♘┃♘┃♘│ + └─┸─┸─┸─┸─┸─┸─┸─┸─┘ + a b c d e f g h i + --- Code diff --git a/tests/testthat/_snaps/piecepack_games_chess.md b/tests/testthat/_snaps/piecepack_games_chess.md index f7d3055..37f8091 100644 --- a/tests/testthat/_snaps/piecepack_games_chess.md +++ b/tests/testthat/_snaps/piecepack_games_chess.md @@ -166,6 +166,32 @@ └─┸─┴─┸─┴─┸─┴─┸─┘ +--- + + Code + cat_piece(piecepack_jeson_mor(), annotate = TRUE) + Output + + 9 ☀⃝─☀⃝─☀⃝─☀⃝─☀⃝─☽⃝─☽⃝─☽⃝─☽⃝ + │ ┃ │ ┃ │ ┃ │ ┃ │ + 8 ┝━╋━┿━╋━┿━╋━┿━╋━┥ + │ ┃ │ ┃ │ ┃ │ ┃ │ + 7 ├─╂─┼─╂─┼─╂─┼─╂─┤ + │ ┃ │ ┃ │ ┃ │ ┃ │ + 6 ┝━╋━┿━╋━┿━╋━┿━╋━┥ + │ ┃ │ ┃ │ ┃ │ ┃ │ + 5 ├─╂─┼─╂─a⃞─╂─┼─╂─┤ + │ ┃ │ ┃ │ ┃ │ ┃ │ + 4 ┝━╋━┿━╋━┿━╋━┿━╋━┥ + │ ┃ │ ┃ │ ┃ │ ┃ │ + 3 ├─╂─┼─╂─┼─╂─┼─╂─┤ + │ ┃ │ ┃ │ ┃ │ ┃ │ + 2 ┝━╋━┿━╋━┿━╋━┿━╋━┥ + │ ┃ │ ┃ │ ┃ │ ┃ │ + 1 ⸸⃝─⸸⃝─⸸⃝─⸸⃝─♛⃝─♛⃝─♛⃝─♛⃝─♛⃝ + + a b c d e f g h i + --- Code diff --git a/tests/testthat/test-checker_games_other.R b/tests/testthat/test-checker_games_other.R index df6e030..4186a20 100644 --- a/tests/testthat/test-checker_games_other.R +++ b/tests/testthat/test-checker_games_other.R @@ -8,6 +8,7 @@ test_that("checker other games work as expected", { expect_snapshot(cat_piece(checker_focus())) expect_snapshot(cat_piece(checker_four_field_kono())) expect_snapshot(cat_piece(checker_grasshopper())) + expect_snapshot(cat_piece(checker_jeson_mor(), annotate = TRUE)) expect_snapshot(cat_piece(checker_julgonu())) expect_snapshot(cat_piece(checker_kangaroo())) expect_snapshot(cat_piece(checker_lines_of_action())) diff --git a/tests/testthat/test-chess_games_variant.R b/tests/testthat/test-chess_games_variant.R index 3935399..2961f05 100644 --- a/tests/testthat/test-chess_games_variant.R +++ b/tests/testthat/test-chess_games_variant.R @@ -10,6 +10,7 @@ test_that("chess variant setups work as expected", { expect_snapshot(cat_piece(chess_international_chess())) expect_snapshot(cat_piece(chess_fischer_random_chess(seed = 12))) expect_snapshot(cat_piece(chess_horde_chess())) + expect_snapshot(cat_piece(chess_jeson_mor(), annotate = TRUE)) expect_snapshot(cat_piece(chess_monochrome_chess())) expect_snapshot(cat_piece(chess_racing_kings())) }) diff --git a/tests/testthat/test-games_info.R b/tests/testthat/test-games_info.R index 3ef4fcc..95ad7ea 100644 --- a/tests/testthat/test-games_info.R +++ b/tests/testthat/test-games_info.R @@ -1,12 +1,12 @@ test_that("*_games() row counts", { expect_equal(nrow(alquerque_games()), 2L) - expect_equal(nrow(checker_games()), 33L) - expect_equal(nrow(chess_games()), 5L) + expect_equal(nrow(checker_games()), 34L) + expect_equal(nrow(chess_games()), 6L) expect_equal(nrow(domino_games()), 10L) expect_equal(nrow(go_games()), 2L) expect_equal(nrow(marble_games()), 0L) expect_equal(nrow(morris_games()), 7L) - expect_equal(nrow(piecepack_games()), 114L) + expect_equal(nrow(piecepack_games()), 115L) expect_equal(nrow(reversi_games()), 2L) expect_equal(nrow(stackpack_games()), 10L) expect_equal(nrow(tarot_games()), 0L) diff --git a/tests/testthat/test-piecepack_games_chess.R b/tests/testthat/test-piecepack_games_chess.R index 529c322..9260a52 100644 --- a/tests/testthat/test-piecepack_games_chess.R +++ b/tests/testthat/test-piecepack_games_chess.R @@ -9,6 +9,7 @@ test_that("piecepack chess games work as expected", { expect_snapshot(cat_piece(piecepack_fischer_random_chess(seed = 42))) expect_snapshot(cat_piece(piecepack_four_seasons_chess(), reorient = "all")) expect_snapshot(cat_piece(piecepack_international_chess())) + expect_snapshot(cat_piece(piecepack_jeson_mor(), annotate = TRUE)) expect_snapshot(cat_piece(piecepack_minishogi(), reorient = "all")) expect_snapshot(cat_piece(piecepack_racing_kings(), reorient = "symbols")) expect_snapshot(cat_piece(piecepack_shogi(), reorient = "all"))