Solve your Rubik's Cube with an easy two-cycle solution
Solve your Rubik's Cube with an easy two-cycle solution
Can you solve the Rubik's Cube? Do you want to learn how? GREAT!
We will teach you a very simple two-cycle solution for solving the Rubik's Cube. It's so simple that I used this exact solution to solve the cube blindfolded in the 2005 Rubik's World Championship with a time of 5 minutes and 40 seconds. After you've mastered this solution, you will average less than 2 minutes and will have enough understanding to progress to the Fridrich CFOP method. You'll be solving the Rubik's Cube in less than 20 seconds in no time. WOW!
require 'rubiks_cube'cube = RubiksCube::Cube.new cube.solved? #=> true
scramble = "U D B2 U B D2 B2 F' R' U2 F U' L2 F L2 B2 L2 R' U R' U' D R2 F2 B2"
cube.perform! scramble cube.solved? #=> false
solution = RubiksCube::TwoCycleSolution.new(cube)
solution.length #=> 458
puts solution.pretty
Setup: L2
Fix: R U R' U' R' F R2 U' R' U' R U R' F'
Undo: L2
Setup: M2 D L2
Fix: R U R' U' R' F R2 U' R' U' R U R' F'
Undo: L2 D' M2
Setup: U' F' U
Fix: R U R' U' R' F R2 U' R' U' R U R' F'
Undo: U' F U
...
If you have a scrambled Rubik's Cube sitting in front of you right now, you may not know how to get it back to the solved position. That's OK! We can set the Rubik's Cube state manually and learn how to solve it.
Starting with the F face, enter the color of each sticker from top-left to bottom-right. You may use any characters you like to describe the color of your cube, but make sure all six colors are unique. Whitespace is not important.
The cube state must be entered in the following order:
See the examples below for more help.
Entering cube state manually can be confusing at first. Here are some examples to help you out.
A Rubik's Cube is solved by default.
require 'rubiks_cube'cube = RubiksCube::Cube.new
cube.state = < true
Our cube is now slightly scrambled.
require 'rubiks_cube'cube = RubiksCube::Cube.new
cube.state = < false
Here's a fully scrambled cube. This looks hard to solve. We can start our cube in this state if we like and have the solver tell us a solution.
Here's the scramble we used to mix the cube if you'd like to try it yourself:
U D B2 U B D2 B2 F' R' U2 F U' L2 F L2 B2 L2 R' U R' U' D R2 F2 B2
require 'rubiks_cube'cube = RubiksCube::Cube.new
cube.state = < false
Each Rubik's Cube face ( L, R, F, B, D, U ) can be turned clockwise manually by calling the appropriate method on the cube. For example, if we'd like to turn the right face twice, the down face once, and the back face three times:
require 'rubiks_cube'cube = RubiksCube::Cube.new
cube.r.r.d.b.b.b
Most people will prefer to use standard Rubik's Cube algorithm notation for turning the cube. Here's the same example with with cube notation:
require 'rubiks_cube'cube = RubiksCube::Cube.new
cube.perform! "R2 D B'"
Performing face turns on the cube changes the state.
require 'rubiks_cube'cube = RubiksCube::Cube.new
cube.perform!( "U D2 F2 L' R' D' B' U' D L D U2 B' L2 F2 R' U D F2 B' R' F2 U F2 B" )
cube.solved? #=> false
cube.state
"DB UF RB RF LB DL UR RD FD UB LF UL FDL DFR UBR BDR UFL LDB FUR LBU"
We've provided a simple two-cycle solution to help you solve the Rubik's Cube. This solution is very inefficient, but wonderful for humans. Using the two-cycle solution, you can quickly learn how to solve the Rubik's Cube without using the computer.
The two-cycle solution is a popular solution used to solve the Rubik's Cube blindfolded. It requires little memorization and takes little time to learn. Solutions usually range from 400-600 turns, but most of those turns are quickly executed. We can easily achieve times of less than 4 minutes with this solution.
The two-cycle solution solves the cube by swapping two cubies at a time until all cubies are in the correct location. This is the permutation step. After the cubies are permuted, we then rotate two cubies at a time (in their current location) until all are oriented correctly. This is the orientation step. We call this the two-cycle solution because everything is done in pairs.
You can use the
rubiks_cubegem to learn the two-cycle solution. For each step, we provide setup moves, the fixing algorithm (either changing permutation or orientation), and the undo moves. Pay close attention to how the cube moves and you will be solving by yourself in no time.
See Usage for an example of the
TwoCycleSolution
The permutation step is completed using only two algorithms. One swaps two edges and the other swaps two corners. The diagram above shows which edges and corners are swapped.
When a solution is calculated, we present a 'setup' algorithm (which gets the cubies into a position where they can be swapped), then we present one of the two swapping algorithms, followed by an 'undo' algorithm that reverses the setup move.
The orientation step is completed using only two algorithms. One flips two edges and the other rotates two corners (one clockwise and the other counter-clockwise). The diagram above shows which edges and corners are rotated.
When a solution is calculated, we present a 'setup' algorithm (which gets the cubies into a position where they can be rotated), then we present one of the two rotation algorithms, followed by an 'undo' algorithm that reverses the setup move.
All algorithms can be found in
RubiksCube::Algorithms
Rubik's Cube algorithm notation is easy to understand, but may look confusing at first. Each face is represented by a letter:
When we see a letter in an algorithm, then we turn that face 90 degrees clockwise. To determine which direction is clockwise, rotate the cube so that you are looking at the face, then make the turn.
Faces may be followed by one of two modifiers:
For example, if we want to apply the algorithm
F2 B D' R, then we would take these steps:
There is one special algorithm notation that does not map to a face. This is called the M slice. The M slice is the middle vertical layer of the Rubik's Cube.
When you see M, then rotate this slice 90 degrees clockwise. To figure out which direction is clockwise, look at the L face.
For example, if we want to apply the algorithm
M2 F M2, then we would take these steps:
$ gem install rubiks_cube
Please see the Contributing Document
Copyright (C) 2013 Chris Hunt, MIT License