cycle {cubing} | R Documentation |

## Cycle and Twist Cubies

### Description

Functions for cycling permuatations and altering orientations.

### Usage

```
flipEdges(aCube, flip = 1:12)
twistCorners(aCube, clock = numeric(0), anti = numeric(0))
cycleEdges(aCube, cycle, right = TRUE, orient = TRUE)
cycleCorners(aCube, cycle, right = TRUE, orient = TRUE)
```

### Arguments

`aCube` |
A cubieCube object. |

`flip` |
An integer vector subset of |

`clock` |
An integer vector subset of |

`anti` |
An integer vector subset of |

`cycle` |
An integer vector representing the permutation cycle. See Details. |

`right` |
If |

`orient` |
Controls the orientation change for the permuation cycle. If |

### Details

The `cycle`

vector should be given according to mathematical cycle notation. For
example, the vector `c(5,3,7)`

means that the edge at position 5 moves to 3, 3 moves
to 7 and 7 moves to 5. The vectors `c(3,7,5)`

and `c(7,5,3)`

are equivalent.
The length of the vector is the length of the cycle, and so this example is a 3-cycle.
If `right`

is `FALSE`

it cycles in the opposite direction, so 7 moves to 3,
3 moves to 5 and 5 moves to 7.

All of these functions can change the solvability of a cube. Solvability of a cube can be
tested using the `is.solvable`

function. For orientation solvability, the sum of the
edge orientation vector must be even, and the sum of the corner orientation
vector must be divisible by three. For the edge orientation to remain solvable, you must flip an
even number of edges. For the corner orientation to remain solvable, the difference between
the number of clockwise and anti-clockwise twists must be divisible by three. For example,
the number of twists in each direction could be the same (a difference of zero), or you could
have three clockwise twists and no anti-clockwise twists.

The sign of a permuation (even or odd) changes under a 2-cycle, which is just a swapping of two
elements. In mathematical terminology this is called a transposition. A k-cycle can be written
as k-1 transpositions, and therefore a k-cycle will change the sign of a permuatation if and
only if k is even. So for a solvable cube to remain solvable, the length of `cycle`

should
be odd.

Two binary operators within the package that also impact solvability are `%e%`

and
`%c%`

, which are composition operators for only edges and only corners respectively.
If two cubes A and B are solvable, then A `%e%`

B may be unsolvable because the edge
and corner permuations may be of different sign; the orientations will always remain solvable.
It is also possibe for A `%e%`

B to be solvable but B `%e%`

A to be unsolvable.
The same reasoning applies to `%c%`

.

In detail: if A and B have odd permutations, then both A `%e%`

B and B `%e%`

A
become unsolvable. If A and B have even permutations, then both A `%e%`

B and
B `%e%`

A remain solvable. If A has even and B has odd, then A `%e%`

B is
unsolvable but B `%e%`

A is solvable.

### Value

A cubieCube object.

### See Also

`%v%`

, `is.solvable`

, `is.solved`

, `invCube`

### Examples

```
aCube <- getCubieCube("Superflip")
aCube <- flipEdges(aCube, flip = 1:12)
is.solved(aCube)
aCube <- twistCorners(aCube, clock = 3:6, anti = 2)
is.solvable(aCube)
aCube <- cycleEdges(aCube, c(2,10,5,6))
is.solvable(aCube)
```

*cubing*version 1.0-5 Index]