Cube It: Creating a 3D Rubik's Cube Simulator in C++ and OpenGL
CSEF · 2011 Mathematics & Software
Overview
Objectives/Goals The objective of this project was to program a 3D Rubik's Cube simulator in C++ and OpenGL. The application should be able to scramble and solve the Rubik's Cube. Along with that, the application should allow the user to put in their own position and have the application generate a moves list needed to solve it. Methods/Materials The program I wrote has a graphical user interface in which the user can view the Rubik's Cube in 3D or as a 2D net. The application can scramble and solve the Rubik's Cube. The computer scrambles the cube by choosing a random face, executing a move on that face, then moving on to another face; the application does this 30 times per scramble. The application also has the ability to have the user input their own position. For every solve the application will generate a moves list needed to solve the cube. Results After the project was completed, many runs were taken. These runs helped show truly how the application should be rated. One hundred thousand runs were executed to see how many moves on average it would take to solve the cube. On average, it was able to solve it in about eighty-one moves. The minimum number of moves was thirty-nine, and the maximum was one hundred and six moves. The application was very successful and was able to accomplish its task. Conclusions/Discussion This application has been working flawlessly 100% of the time. The application was able to have the user input their position and the program will solve it. In addition the application can scramble and solve it on its own. The user can also view the cube in 3D or as a 2D net. If the user is viewing it in a 2D map they will have the option to edit the position of the cube. After the application is told to solve the cube it will generate a moves list needed to solve it. Although the application solves the Rubik's Cube fairly quickly, more complex algorithms can result in faster speeds and less moves. The optimal solution would be God's Algorithm, this solves the cube in the minimum amount of moves needed.
Summary statement
For this project I programmed a 3D Rubik's Cube simulator in C++ and OpenGL.
Help received
My computer science teacher, Mrs. Najwan, for honing my programming skills and teaching me object oriented programming; My mother for helping me with my board.
Competition history
- CSEF 2011
Resources
Related projects
CSEF · 2008
Writing a Rubik's Cube Solver using Mathematica
CSEF · 2004
Software and Hardware Implementation of Rubik's Cube Solving Algorithms
ISEF · 2016
Python Cubed
CSEF · 2015
Devising an Effective Way of Solving the Rubiks Cube
CSEF · 2005
Rubik's Cube Solving Robot, Year Two: Faster Algorithm, Graphical User Interface, and Vision
CSEF · 2003
Mathematics Behind Realistic Computer Graphics
CSEF · 2002
Rotational Symmetry of Third Order Magic Cubes
CSEF · 2014
Speedsolving a Rubik's Cube: Which Algorithms First?
Closest projects by meaning, across every fair and year in the corpus.
Browse more like this
Source: California Science & Engineering Fair public projects