Introduce algorithm basics with the Rubik’s cube
Even if you aren’t experienced in coding yet, you can challenge yourself and your abilities during the weekend, by trying this classic yet modern puzzle.
The word algorithm was first coined in the 9th century, being now used all around us, from solving a division problem, to the functionality of a search engine.
In computers, an algorithm gives a specific set of instructions, being the backbone of everything a computer does.
Here’s an unplugged way to introduce algorithms to your students by solving the Rubik’s cube:
For this activity, we use a simple algorithm to substantially reduce the time it takes to solve the cube – with other different algorithms (from simple to complex) also known to solve the puzzle.
First, similar to a programming language, let’s establish the notation we use:
Each of the 6 cube faces will be given the first letter of their name:
- U – Up
- D – Down
- L – left
- R – right
- F – front
- B – back
Also, we need to have in mind that each face can be turned in 3 directions.
Here’s an example using L on how this is represented:
- L – clockwise quarter-turn of the upper face
- L’ – counter-clockwise quarter-turn of the upper face
- L2 – half turn in either direction of the upper face
Now grab a Rubik’s Cube and follow this algorithm with your students to solve it:
Step 1 – The Plus:
- Turn some edges until you have a white plus on the upper face
- Do the following turns F, R’, D’, R, F2, R’, U, R, U’, R’, R2, L2, U2, R2, L2
- The plus should now be solved.
Step 2 – The Corners
- While the edges on the white face are complete, the corners are still not done.
- Based on where the white-orange-green corner is in the puzzle, use one of the following turning algorithms:
- Bottom: R’, D’, R, D – repeat until the corner is in correct position
- Top: R’, D’, R, D – once the corner is to the bottom, follow the above instructions
Step 3: Middle Layer Edges
- Turn the cube so the white is on the bottom
- Find an edge that is on top face without yellow on it
- Do a U-turn so that the color on the front face of the edge matches the center
- Based on direction of the edge can go, use one of the following turning algorithms:
- Left: U’, L’, U, L, U, F, U’, F’
- Right: U, R, U’, R’, U’, F’, U, F
Step 4: Yellow Plus
- Do the following turns until a yellow cross appears with the yellow center: F, R, U, R’, U’, F’
- If an “L” shape is seen where the two yellow pieces are adjacent to each other, do the following turns: F, U, R, U’, R’, F’
- If a horizontal “Line” shape is seen, do the following turns: F, R, U, R’, U’, F’
Step 5: Sune and Anti-Sune1 algorithms
1 Sune and Anti-Sune – Sune is a term used in Rubik’s Cube when the edges are oriented and three corners are twisted counterclockwise – also being the name of the algorithm which solves it.
- Find the face with the yellow center.
- Based on the below occurrences, apply one of the following series of turns:
- For only one oriented corner: R, U, R’, U, R, U2, R’ – repeat until correct position
- For one oriented corner and one right-facing corner: U2, R, U2, R’, U’, R, U’, R’
Step 6: Solving the cube
- Look for sets of “split matches” – two squares in the of the same color in the same row, separated by a sticker of a different color
- Based on how many there are, use one of the following turning algorithms:
- If you see a set of split matches on each side: R, U’, R, U, R, U, R, U’, R’, U’, R2
- If not, use: R’, F, R’, B2, R, F’, R’, B2, R2
The Rubik’s Cube should now be solved!
At the end, why not offer an extra incentive to your students and check with them the Chrome Cube Lab that offers various puzzles and interactive objects based on Rubik’s Cube:
As you know, algorithm thinking is essential in all technical fields, from machine learning to artificial intelligence.
Teaching your students basic algorithm concepts will allow them to break down problems and conceptualize solutions in terms of concrete steps.
Have fun with the Rubik’s Cube and its many algorithms, and don’t forget to share the results!