sliding_puzzle {fun} | R Documentation |
Sliding puzzle in R
Description
Use R to play sliding puzzle
Usage
sliding_puzzle(size = c(3, 3), bg = "lightblue", z = NULL)
Arguments
size |
two dimensional vector, the size of sliding puzzle. Note: the
element of |
bg |
the background color of blocks. |
z |
the matrix of sliding puzzle, if z is specified, |
Details
If size
is specified and z
is NULL
, then the function
will generate a solvable sliding puzzle.
Note
Linux/Mac users have to use X11(type = 'Xlib')
or the Cairo graphics device Cairo()
in the package
cairoDevice.
Author(s)
Taiyun Wei
References
About the sliding puzzle: https://en.wikipedia.org/wiki/Sliding_puzzle
Examples
## should use Xlib for the x11() device under *nix, e.g
if (interactive()) {
if (.Platform$OS.type == "windows")
x11() else x11(type = "Xlib")
sliding_puzzle()
sliding_puzzle(z = matrix(0:11, 3, 4))
}
[Package fun version 0.3 Index]