A Rubik’s Cube solver built to demonstrate how real-world problems can be modeled, decomposed, and solved using core computer science principles, object-oriented design, and search algorithms.
This project explores how a physical object like a Rubik’s Cube can be transformed into a computational model. It focuses on breaking down a complex system into manageable components and solving it using algorithmic strategies commonly used in Artificial Intelligence.
- Transformed a physical Rubik’s Cube into a structured computational representation.
- Designed abstractions that allow the cube to be manipulated programmatically.
- Broke down the complete solver into smaller, independent components:
- Cube representation
- Solver logic
- Applied modular design to improve clarity and scalability.
Implemented strong OOP principles throughout the project:
-
Classes and Objects
Represented cube states, moves, and solver logic. -
Inheritance
Created reusable base classes such as:- Rubik’s Cube Base Class
- Pattern Database Base Class
-
Abstraction & Virtual Functions
Defined abstract behaviors and extended them through derived classes. -
Operator Overloading
Enabled intuitive manipulation of cube states.
Applied classical search algorithms to solve the cube:
- BFS (Breadth-First Search)
- DFS (Depth-First Search)
- IDDFS (Iterative Deepening DFS)
- IDA* (Iterative Deepening A*)
These algorithms demonstrate how search techniques can solve structured state-space problems.
- Implemented A* and IDA* for optimized solving.
- Built Pattern Databases to improve heuristic accuracy.
- Used heuristics to significantly reduce search space and computation time.
- Used
unordered_mapwith custom objects. - Designed custom hash functions for efficient state lookup.
- Leveraged bit manipulation to store cube states compactly.
- Implemented functionality to save and load pattern databases.
Introduced the concept of Black Boxing:
- Designed components (like the Permutation Indexer) where:
- Input is provided
- Output is expected
- Internal implementation is abstracted away
This improves modularity and usability.
This project demonstrates how:
- Complex real-world systems can be modeled in software
- Large problems can be broken into smaller, manageable parts
- Core algorithms and data structures can be applied to solve AI-related challenges
- Clean architecture and OOP principles lead to scalable and maintainable systems