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: 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")))
Expand Down
3 changes: 3 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
8 changes: 7 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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()`
Expand All @@ -24,6 +29,7 @@ New features
+ `piecepack_achi()`
+ `piecepack_dara()`
+ `piecepack_dodgem()`
+ `piecepack_jeson_mor()`
+ `piecepack_kangaroo()`
+ `piecepack_kings_valley()`
+ `piecepack_leapfrog()`
Expand Down
16 changes: 16 additions & 0 deletions R/checker_games_other.R
Original file line number Diff line number Diff line change
Expand Up @@ -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_
Expand Down Expand Up @@ -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)) {
Expand Down
19 changes: 19 additions & 0 deletions R/chess_games_variant.R
Original file line number Diff line number Diff line change
Expand Up @@ -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_
Expand Down Expand Up @@ -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(
Expand Down
27 changes: 27 additions & 0 deletions R/piecepack_games_chess.R
Original file line number Diff line number Diff line change
Expand Up @@ -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_
Expand Down Expand Up @@ -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") {
Expand Down
6 changes: 5 additions & 1 deletion man/checker_games_other.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 9 additions & 1 deletion man/chess_games_variant.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion man/piecepack_games_chess.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 26 additions & 0 deletions tests/testthat/_snaps/checker_games_other.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
26 changes: 26 additions & 0 deletions tests/testthat/_snaps/chess_games_variant.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
26 changes: 26 additions & 0 deletions tests/testthat/_snaps/piecepack_games_chess.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions tests/testthat/test-checker_games_other.R
Original file line number Diff line number Diff line change
Expand Up @@ -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()))
Expand Down
1 change: 1 addition & 0 deletions tests/testthat/test-chess_games_variant.R
Original file line number Diff line number Diff line change
Expand Up @@ -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()))
})
6 changes: 3 additions & 3 deletions tests/testthat/test-games_info.R
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
Loading
Loading