invMoves {cubing}R Documentation

Manipulate Move Sequences

Description

Invert, mirror and rotate move sequences, and calculate the order of a move sequence.

Usage

invMoves(moves, revseq = TRUE, collapse = NULL)
mirMoves(moves, mirror = c("0","UD","DU","RL","LR","FB","BF"), collapse = NULL)
rotMoves(moves, rotation = c("0","x","x1","x3'","y","y1","y3'","z","z1","z3'",
	"x2","x2'","y2","y2'","z2","z2'","x'","x3","x1'","y'","y3","y1'","z'","z3",
	"z1'"), invrot = FALSE, collapse = NULL)
moveOrder(moves)

Arguments

moves

A move sequence. Either a character sting, which may include white space, or a character vector where each element is a single move. For moveOrder, can include only URFDLB face turns. For other functions, can include URFDLBEMS face turns, URFDLB wide turns and xyz rotations.

revseq

If FALSE, the move sequence is not reversed so that only the direction of the turns is altered.

mirror

The mirror to be used. The U/D mirror can be specified using the UD or DU character string. Similarly for R/L and F/B.

rotation

The rotation to be used.

invrot

Inverts the direction of the rotation.

collapse

If not NULL then the returned moves are output as a single string with collapse as the separator, rather than a character vector of moves. If collapse is the empty string then a single string with no separator is returned.

Details

For moveOrder an integer value is returned giving the order of the move sequence, which is the number of times it needs to be applied for the solved cube to return to its solved state. The largest order for any sequence is known to be 1260; for example, the order of "R U2 D' B D'" is 1260.

For other functions, a move sequence is returned. The returned move sequence will always use the canonical form for the turn notation: U not U1, U' not U1', and Uw not u for wide turns. However any form may be used for the input.

The Examples section below demonstrates the relationship between rotated move sequences. If the rotation is r and the rotated move sequence is m, then the move sequence rmr' is equivalent to the original. If invrot is TRUE, then this becomes r'mr.

Value

A character vector of moves, or a character string if collapse is not NULL.

See Also

move, invCube, rotate, scramble

Examples

mv <- "RB'y'F2MD'"
invMoves(mv)
mirMoves(mv, mirror = "RL")

iCube <- getCubieCube("TwistedChickenFeet")
rmv <- rotMoves(mv, rotation = "x")
aCube <- move(iCube, c("x", rmv, "x'"))
bCube <- move(iCube, mv)
identical(aCube, bCube)

moveOrder("RU2D'BD'")

[Package cubing version 1.0-5 Index]