Scan and Solve: DecisionRules' Final Rubik's Cube Update

Welcome back to the world of Rubik’s Cube. We are proud to announce a new final big update for our Rubik’s Cube showcase that is using DecisionRules to solve this famous puzzle game. We present to you a new Cube Scanning mode that includes a complete graphical overhaul.

 It’s been some time since we have last had an article about Rubik’s cube. If you haven’t already, be sure to check out our previous two articles, talking about the beginning of the Rubik's cube, and the journey of creating an application for solving a Rubik’s cube with DecisionRules in Unity.

Before we start, I would like to briefly sum up our journey, to show you how far we’ve come.

Our journey began by exploring the history of Rubik’s Cube and showcasing our approach to Rubik’s Cube-solving software using the CFOP method, the most widely used technique for solving the cube. We delved into its intricacies in depth. We discussed the integration of DecisionRules, WebGL, and Unity, detailing how the Rubik’s Cube was connected with DecisionRules to create an algorithm. Additionally, we showcased the process of creating your own cube.

Now let’s take a look at what's new in this release.

Cube Scanning Mode: Refreshing the Setup Process

Imagine seamlessly integrating your physical Rubik's Cube into our Unity application* with just a few simple steps. The new Cube Scanning Mode makes this possible, enabling users to effortlessly scan and upload their cube's configuration. This feature enhances the interactive experience, making it more engaging and accessible, and connects DecisionRules with a real-world scenario.

How Do We Scan Our Cube?

There are multiple ways to scan a Rubik's Cube, such as taking multiple pictures of all its sides or using video. All you need for this is a computer or phone with a camera (and a Rubik's Cube).

Checking Cube Colors: The Challenge and Our Solution

One might think the simplest way to identify the colors on a Rubik’s Cube is to use AI. You could just take a photo, and AI would automatically detect the colors. However, there's a catch. AI, while powerful, doesn't inherently verify the accuracy of its outputs. It attempts to provide the best possible answer based on its training, but this can lead to errors.

For example, if you were to ask the AI to identify the colors on your Rubik’s Cube, it might still produce faulty outputs even if the colors are correct. This means you’d likely need to manually correct the errors afterward, which defeats the purpose of automated detection. Now, imagine combining this with poor lighting conditions. AI might confuse colors like red and orange or white and yellow, leading to even more mistakes. The result would be so many errors that we couldn't even call this a feature.

To overcome this, we developed a very simple, but more reliable method. Our solution involves a wireframe (for a 3x3 Rubik's cube) on the screen, with nine sensors in the middle of each segment that periodically check the color beneath them. When the user aligns their cube with the wireframe, these sensors accurately detect the cube's colors. This method ensures more precise color identification, even in less-than-ideal conditions, because we can fine-tune color ranges for sensors. While this approach is much better, lighting conditions can still produce incorrect results, so ensure good lighting.

Note that we support only standard Rubik’s Cube colors: red, green, blue, yellow, white, and orange.

For programming fans, here's the snapshot of the code

How It Works:

  1. Align and Scan: Position your cube correctly and scan the center.
  2. Verify Colors: Check the scanned colors against visual indicators and proceed.
  3. Complete the Process: Repeat for all sides to capture the entire cube.

This innovative mode provides a user-friendly, interactive navigation system that guides you through each step with clear visual aids. The colored lines and indicators adjust dynamically to ensure accurate scanning, making it easier than ever to input the cube's state.

Great, but what if I’ve scanned my cube in the wrong way?

That’s no problem, after scanning your cube, there comes the second part, editing (or creating your own cube) in Unity, where you can check and edit the color on your cube as you like. The steps for editing your cube are the same as for scanning, so it will be easy to understand. 

Workflow from scanning to solving the cube

A Polished User Experience

The latest UX/UI redesign brings a fresh, modern look to the application, enhancing both aesthetics and functionality. These updates aim to provide a smoother, more engaging experience for users across all devices.

Highlights of the Redesign:

  • Sleek New Interface: Enjoy a visually appealing design that is intuitive and easy to navigate.
Updated menu diagram for users to navigate through the app
  • Enhanced Mobile Experience: Optimized responsiveness ensures seamless use on mobile devices.
 Enhanced UX/UI elements with better mobile responsiveness
  • Clear and Concise Guidance: Step-by-step instructions and real-time feedback make the solving process straightforward and enjoyable.
New alert menu
  • Tutorial for beginners: A new tutorial option in the main menu helps users find their way around the app effectively.

Want to give it a try?

As this article was released, we have also published a new version of DecisionRules Rubik's Cube into our Sample Apps. Try to scan your cube, define one, or just play and solve.

If you don’t have a cube, but you still want to try this new feature, you can scan the following permutation:

Sample permutation for scan cube

This project demonstrates that BRMS (rule engine) are versatile tools, useful not only for mature organizations handling complex enterprise problems but also in diverse fields like indie game development.

Thank you, everyone, I hope you’ve enjoyed our Rubik’s cube journey. I am looking forward to seeing what you can build. 

Special thanks go to Erik Lehocký for his exceptional support and guidance throughout this project.

For the last time, happy solving!

The Rubik's Cube, invented in 1974 by Hungarian sculptor and professor Ernő Rubik, is a world-famous 3D combination puzzle. Originally called the Magic Cube, it quickly became a global sensation, with around 500 million units sold by January 2024, making it the world's bestselling puzzle game and toy. The classic cube features six faces with nine stickers each in solid colors, but modern versions often use colored plastic panels to prevent wear. Solving the puzzle involves aligning each face to display a single color, enabled by an internal pivot mechanism. The Rubik's Cube remains popular, inspiring numerous similar puzzles and a vibrant community of speedcubers competing under the World Cube Association since 2003. Inducted into the US National Toy Hall of Fame in 2014, the Rubik's Cube endures as a cultural and recreational icon.

More reading