Generate random cubes, random move sequences, and scrambles.
randCube(n = 1, cubie = TRUE, solvable = TRUE, drop = TRUE, spor = 1:6)
randMoves(n = 1, nm = 20, drop = TRUE)
scramble(n = 1, state = FALSE, nm = 20, drop = TRUE, type = c("KB", "ZT",
"TF", "ZZ", "CFOP"), maxMoves = 24, bound = TRUE)
Number of cubes, move sequences or scrambles to generate.
If FALSE
, simulate stickerCubes rather than cubieCubes.
If FALSE
, then solvable and unsolvable cubes can
be simulated. See Details.
If FALSE
, then a list of one element is returned when n
is equal to one.
The spatial orientation vector that is added to each simulated cubieCube.
The number of moves in the move sequence or the scramble. Ignored for
scramble
if state
is TRUE
.
If FALSE
(the default), use a random moves scramble. If
TRUE
, use a random state scramble.
The type of solver used for the random state scramble. This and all
following arguments are ignored unless state
is TRUE
.
Argument passed to the solver.
Argument passed to the solver.
A cube object or list of cube objects for randCube
.
A move sequence or list of move sequences for randMoves
and scramble
.
If solvable
is TRUE
, the randCube
function generates a
solvable cube where every solvable state is equally likely. If solvable
is FALSE
, it generates a random cube where every obtainable physical
construction is equally likely. The resulting cube may or may not be solvable:
the chance of it being solvable is only 1 in 12.
The randMoves
function generates a random move sequence using URFDLB face
turns, restricted so that you cannot get two moves in a row on the same face, or
three moves in a row on opposing faces. An alternative way of constructing a
random cube is getMovesCube(randMoves())
. If nm
is 20 or more
then every solvable state has a non-zero chance of occuring, but the states
will not be equally likely to occur.
The scramble
function generates random move scrambles by default (which
just uses the randMoves
function), but will generate random state
scrambles when state
is TRUE
.
# NOT RUN {
randCube()
getMovesCube(randMoves())
sapply(randCube(20, solvable = FALSE), is.solvable)
randMoves(5, nm = 25)
scramble(nm = 17)
scramble(state = TRUE, type = "ZT", maxMoves = 24)
# }
Run the code above in your browser using DataLab