invCube {cubing}R Documentation

Calculate Inverse Cube

Description

Calculates the inverse of a cube.

Usage

invCube(aCube, edges = TRUE, corners = TRUE)

Arguments

aCube

A cubieCube object.

edges

If FALSE, the inverse is not taken for the edges.

corners

If FALSE, the inverse is not taken for the corners.

Details

Every 3x3x3 cube A has a unique inverse cube A' where AA' and A'A are both equal to the solved state. The cube A does not need to be solvable. Larger cubes do not have unique inverses because larger cubes have indistinct pieces in the centres.

One use of the inverse is to enable the solver function to generate moves towards a target state that is not the solved state. For an initial cube A and a target state B the solver is applied to B'A. The moves of the solver then represent post-multiplication by A'B, which when applied to A gives AA'B which is equal to B, the target state. Only B'A needs to be solvable; both A and B could be unsolvable.

A solvable cube will always remain solvable after the function invCube is applied, even if edges or corners is FALSE. This is because the sign (even or odd) of a permutation is the same as the sign of the inverse permutation.

Value

A cubieCube object.

See Also

%v%, invMoves, is.solvable, solver

Examples

aCube <- getCubieCube("Tetris")
is.solved(aCube %v% invCube(aCube))
is.solved(invCube(aCube) %v% aCube)

## Not run: plot(aCube)
## Not run: plot(invCube(aCube))
## Not run: plot3D(aCube)
## Not run: plot3D(invCube(aCube))

[Package cubing version 1.0-5 Index]