scramble {cubing}R Documentation

Generate Random Cubes, Moves and Scrambles

Description

Generate random cubes, random move sequences, and scrambles.

Usage

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)

Arguments

n

Number of cubes, move sequences or scrambles to generate.

cubie

If FALSE, simulate stickerCubes rather than cubieCubes.

solvable

If FALSE, then solvable and unsolvable cubes can be simulated. See Details.

drop

If FALSE, then a list of one element is returned when n is equal to one.

spor

The spatial orientation vector that is added to each simulated cubieCube.

nm

The number of moves in the move sequence or the scramble. Ignored for scramble if state is TRUE.

state

If FALSE (the default), use a random moves scramble. If TRUE, use a random state scramble.

type

The type of solver used for the random state scramble. This and all following arguments are ignored unless state is TRUE.

maxMoves

Argument passed to the solver.

bound

Argument passed to the solver.

Details

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.

Value

A cube object or list of cube objects for randCube. A move sequence or list of move sequences for randMoves and scramble.

See Also

getMovesCube, invCube, invMoves, is.solvable, solver

Examples

randCube()
getMovesCube(randMoves())
sapply(randCube(20, solvable = FALSE), is.solvable)
randMoves(5, nm = 25)
scramble(nm = 17)
scramble(state = TRUE, type = "ZT", maxMoves = 24)

[Package cubing version 1.0-5 Index]