Skip to content

Gamers to play piecepack games/puzzles like Fuji-san

License

Unknown, MIT licenses found

Licenses found

Unknown
LICENSE
MIT
LICENSE.md
Notifications You must be signed in to change notification settings

piecepackr/ppgamer

Repository files navigation

ppgamer

CRAN Status Badge R-CMD-check codecov

Table of Contents

  • Currently this package only provides a Fuji-san solver solve_fujisan() which can compute the shortest solution (if it exists) to a given Fuji-san puzzle and output the PPN text to record/visualize the solution.
  • In the future it may provide computer players for other board games and/or puzzles.
  • This is an extraction and refinement of functionality originally contained in the experimental {ppgames} package.
remotes::install_github("piecepackr/ppgamer")
library("igraph")
library("piecepackr")
library("ppgamer")
library("ppn") # `remotes::install_github("piecepackr/ppn")`
puzzle2 <- matrix(c(4,4,4,5,2,0,2,4,0,3,1,1,
                    1,2,5,3,3,5,3,2,5,1,0,0), nrow=2, byrow=TRUE)
s2 <- solve_fujisan(coins=puzzle2)
game <- read_ppn(textConnection(s2$ppn))[[1]]

dark_colorscheme <- list(suit_color="darkred,black,darkgreen,darkblue,black",
                      invert_colors.suited=TRUE, border_color="black", border_lex=2)
piecepack_suits <- list(suit_text="\U0001f31e,\U0001f31c,\U0001f451,\u269c,\uaa5c", # 🌞,🌜,👑,⚜,꩜
                    suit_fontfamily="Noto Emoji,Noto Sans Symbols2,Noto Emoji,Noto Sans Symbols,Noto Sans Cham",
                    suit_cex="0.6,0.7,0.75,0.9,0.9")
traditional_ranks <- list(use_suit_as_ace=TRUE, rank_text=",a,2,3,4,5")
cfg3d <- list(width.pawn=0.75, height.pawn=0.75, depth.pawn=0.375, 
                   dm_text.pawn="", shape.pawn="convex6", invert_colors.pawn=TRUE,
                   edge_color.coin="tan", edge_color.tile="tan")
cfg <- pp_cfg(c(piecepack_suits, dark_colorscheme, traditional_ranks, cfg3d))

animate_game(game, op_scale=1, op_angle=90, trans=op_transform, cfg=cfg, file="fujisan.gif")

Animation of a Fuji-san game

R packages

About

Gamers to play piecepack games/puzzles like Fuji-san

Resources

License

Unknown, MIT licenses found

Licenses found

Unknown
LICENSE
MIT
LICENSE.md

Stars

Watchers

Forks