View source: R/sliding_puzzle.R
sliding_puzzle | R Documentation |
Use R to play sliding puzzle
sliding_puzzle(size = c(3, 3), bg = "lightblue", z = NULL)
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, |
If size
is specified and z
is NULL
, then the function
will generate a solvable sliding puzzle.
Linux/Mac users have to use X11(type = 'Xlib')
or the Cairo graphics device Cairo()
in the package
cairoDevice.
Taiyun Wei
About the sliding puzzle: https://en.wikipedia.org/wiki/Sliding_puzzle
## 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)) }
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.