Skip to content

Latest commit

 

History

History
44 lines (24 loc) · 2.29 KB

README.md

File metadata and controls

44 lines (24 loc) · 2.29 KB

2x2x2 BFS Rubik's Cube Solver

Description

Rails application to visualize and solve a 2×2×2 Rubik’s Cube in the fewest possible twists. The Rubik’s Cube is solved using a Ruby implementation of the two-way Breadth-First Search algorithm and visualized using the JavaScript library three.js.

A 2x2x2 Rubik's Cube has 3,674,160 possible combinations and the application has been optimized to find most solutions in less than 5 seconds.

Screenshots

Rubik Solver home page Home page for the Rubik Solver app showing the 3D cube created with three.js.

Rubik Solver shuffled The cube can be randomly shuffled while maintaining geometry like any real-world Rubik's cube.

Rubik Solver solved Uses 2-way BFS to automatically find the shortest number of twists required to solve the Rubik's cube.

Background

Inspired by MIT's 6.006 "Introduction to Algorithms" class which uses this Rubik's Cube problem to teach Breadth-First Search and algorithmic optimization.

Features

  • Ruby implementation of the two-way Breadth-First Search algorithm
  • 3D visualization of a Rubik's Cube using three.js

Development/Contribution

Please feel free to contribute to the project.

Future

Maybe in the future I will attempt to create a solver for the classic Rubik's Cube. Turns out the classic Cube is quite a computational challenge. A 3x3x3 Rubik's Cube has over 43 quintillion possible combinations and requires specialized algorithms to reduce the complexity of the problem at the cost of sacrificing optimization.

Created by:

License

This Rubik's Cube Solver is MIT Licensed. See LICENSE for details.