# Discover Your Own Rubik's Cube Algorithms

I have always wanted to solve a Rubik's Cube but was not really interested in getting the solution handed to me. But solving seemed way too daunting to do all at once when I first encountered the cube as a kid. But since I've spent a good amount of time in the interim solving puzzles, doing programming, and understanding algorithms, I figured I would take another shot.

I'll be updating this page at the bottom with updates on my progress.

## The Challenge

Given the cube and the names of each step, can I discover and document the steps that are necessary to solve the Rubik's Cube?

This challenge is a bit too much for me to try and figure it out TOTALLY from scratch, so I'm bringing in the *names* of the steps and the movement descriptors to aid in my documentation and discovery.

## Given Information

### Steps

- White cross
- White corners
- Second layer
- Yellow cross
- Yellow edges
- Yellow corners
- Orient yellow corners

### Glossary of Singmaster notation

Notation | Description

- `F` (Front): the side currently facing the solver
- `B` (Back): the side opposite the front
- `U` (Up): the side above or on top of the front side
- `D` (Down): the side opposite the top, underneath the Cube
- `L` (Left): the side directly to the left of the front
- `R` (Right): the side directly to the right of the front
- `M` (Middle): the layer between L and R, turn direction as L (top-down)
- `E` (Equator): the layer between U and D, turn direction as D (left-right)
- `S` (Standing): the layer between F and B, turn direction as F
- `x` (axis): rotate the entire Cube on R
- `y` (axis): rotate the entire Cube on U
- `z` (axis): rotate the entire Cube on F

Each of these notations means to rotate that segment clockwise respective to their face, with a `'` on a step meaning rotate the segment anticlockwise. In both cases, the `M`/`E`/`S` layers follow their `L`/`U`/`F` counterparts.

A `2` after a notation means to perform that operation twice in a row.

`w` (wide) means to include the middle layer on the same axis (e.g. `Fw` includes the front face and the layer behind). For example, `M2 Dw' F D'` would mean:

- Rotate the `M` (middle) twice
- Rotate the side underneath the cube *and* the layer adjacent to it anticlockwise
- Rotate the face of the cube clockwise
- Rotate the the side underneath the cube anticlockwise

Piece notation is `face/edge/corner`. If `edge` or `corner` are omitted, assume they are the center. For example (lets assume `X` means "null" for these)

- Piece `F` is the center piece of the `F` (front) face (could also be notated as `FXX`, as it is not an edge, nor a corner);
- Piece `FU` is the `U` edge in the center column on the `F` face (could also be notated as `FUX`, as it is not a corner);
- Piece `FUR` is the `R` corner of the `U` edge on the `F` face.

## The Solution

### 1. White Cross

The white cross step is pretty trivial, as far as I can tell. If there are algorithms, it kind of doesn't seem to be super important. The goal is to get all the white squares together to make a cross shape, with the center included, like a `+`. Looking at it straight on should look like this:

```
.X. // X's being white squares, and
XXX // dots representing anything
.X. // other than the white squares.
```

### 2. White Corners

First, select a corner/column to focus on. You need to rotate `E` and `D` layers until you have the white corner somewhere within the same column. This could mean on the underside of that column or somewhere on the side of that column.

The algorithm that is simplest but will take the longest is this: `R' D R D'`. If this is repeated, eventually that black square will end up on the top of the cube.

There are a few simpler ones that can be deduced from this and I will leave it to the cuber to figure them out. Practice will elucidate these algorithms very clearly!

Once this is finished, the cube should have all of the white squares on top of the cube.

### 3. Second Layer

Assuming the white squares are on top of the cube, you first want to rotate `Dw` until you have the `FU` and `F` as the same color. Sometimes, you can end up with more than one set of connected colors on other layers (`RU` and `R`, `LU` and `L`, or `BU` and `B`) through successive rotations. Our goal is to have the maximum connections possible.

Once this is complete, there are two possibilities with two different algorithms.

### Two *adjacent* faces with connected colors

- Rotate `x` until the two connected color sections are on the `L` and `B` layers (i.e. the `FU`/`F` and `RU`/`R` pairs will *not* be the same. For example, `FU` would be green and `F` orange, and `RU` would be orange and `R` green).
- Do the following: `M D2 M' D M D' M'`. When this is complete, the color that was on `FU` should be on `UD`, and vice versa.
- Rotate `x` and repeat step 2.
- Rotate `x'` and do the following: `M D' M' x M D2 M' x' M D M'`.

### Two *opposite* faces with connected colors

- Rotate `x` until the two connected color sections are on the `L` and `R` layers (i.e. the `FU`/`F` and `UU`/`U` pairs will *not* be the same. For example, `FU` would be green and `F` orange, and `UU` would be orange and `U` green).
- Do the following: `M2 D2 M'2`.

Once complete with any of these situations, you should have all four colors connected on the `M` column of the `T` layer of the `F`, `L`, `R`, and `B` layers.

NOTE: I have not figured out how to get the side pieces of `T` or `E` aligned yet.

## References

https://ruwix.com/the-rubiks-cube/notation/advanced/

- 20211022: Add instructions for steps 1, 2, and 3.
- 20211025: Added piece notation and revised my rotation notation.