Package 'ppgamer'

Title: Players for Piecepack Games like Fuji-san
Description: Functions that provide players for piecpack games like a solver for "Fuji-san".
Authors: Trevor L Davis [aut, cre]
Maintainer: Trevor L Davis <[email protected]>
License: MIT + file LICENSE
Version: 0.1.0-1
Built: 2024-11-03 05:42:31 UTC
Source: https://github.com/piecepackr/ppgamer

Help Index


Solve Fujisan game

Description

Solves a game of Fujisan (if possible).

Usage

solve_fujisan(coins = random_fujisan_coins(), dice = random_dice() - 1)

Arguments

coins

A vector or matrix of Fujisan coin layout. Default is a random layout.

dice

A vector of Fujisan dice layout. Default is random dice. Usually not needed.

Value

A list with solution of Fujisan solution, its length, coin layout, dice (if needed), and portable piecepack notation.

Examples

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)
 if (rlang::is_installed(c("piecepackr", "ppn"))) {
   g2 <- ppn::read_ppn(textConnection(s2$ppn))[[1]]
   ppn::plot_move(g2)
 }