# Magic Cube Simulation Program

Magic cube, or the Rubik’s cube, is a popular 3D puzzle known by almost everyone in the world. There was a time when a lot of classmates in our class (including me) were crazy about this game. Everyone was trying to remember the awkward patterns and formulae for not only figuring out this puzzle but beating each others time records. Being very fond of designing games using Visual Basic and inspired by this puzzle, I constructed this simulated program for playing the magic cube.

A player can enter in commands on the input field according to the description (e.g. k = turn right face 90° clockwise, a = Reset cube …) in order to control the cube. The program would only show the front, right and top side of the cube, so the player should have to rotate the whole cube using certain commands for observing every side. Although it is more difficult to solve a scrambled cube for a normal human using this program, it is still possible if one takes time :). Lots of geometric concepts were used when designing this program. For instance, how should the data structure look like in order to record every block of color on the 6 sides of the cube? How can the variables be permutated if a certain command (e.g. turn top face 90° counter clockwise) is executed? How to even draw the cubes diagonal view?

I learned a lot myself from creating this program, gaining insights into various seemingly simple but somewhat counter intuitive geometric and algorithmic concepts.