No BSD License  

Highlights from
flatRubiks

image thumbnail
from flatRubiks by Trent Russi
A Rubiks Cube unwrapped onto a 2D plane.

flatRubiks
Flat Rubiks Cube Function Reference
flatRubiks

A graphical game representing an "unfolded" Rubik's Cube.

Syntax
  • flatRubiks
    flatRubiks -ABOUT
    flatRubiks -HELP
Description

Imagine that you take a Rubik's Cube and unfold it so that it is 2D. But you still are allowed the same moves as before. Therefore, a twist on one face affects the others.

Manipulating the Cube

There are 18 default arrow buttons that are used for rotating the cube faces. Each buttons rotates one slice of the cube 90° in the specified direction. The goal is the same as any Rubik's cube: to get every face to contain only one color.

The entire cube can also be rotated. This does not change the pattern, but merely the orientation of the cube. This is accomplished by clicking on the cube itself. By clicking on a given cube a series of moves is performed that effectively rotates the cube about an axis that passes through that small cube and the center of the Rubik's Cube. By clicking on a center cube, the entire Rubik's Cube will be rotated 90° about that point. If a side piece is clicked on, the entire Rubik's Cube effectively rotates 180° such that the two faces that share the small cube switch. Clicking a corner piece is similar, rotating the entire cube 120° about the corner piece.

By default there is a small 3D view of the Rubik's Cube in the bottom left corner of the figure. This is to help with the visualization of the complete cube. You cannot manipulate the cube using this view. However, you can rotate this small view. Simply grab and drag the cube.

Menu Items

File

New Game (Ctrl+N)
Scrambles the cube.
Solve (Ctrl+S)
Solves the Rubik's Cube. The algorithm used is © Mark Jeays. I chose this particular solution, not because of its efficiency, but because of its simplicity. It may not be the most direct to solving the cube, but it definately is more entertaining to watch solve.
Quit (Ctrl+Q)
Quits the game, closing the figure window.

View

Colors
Opens the color selection window.
Animation Speed (Ctrl+0 - Ctrl+3)
Sets the speed at which the cube rotation animation is performed. When the animation is off, clicking a button will cause a slight pause, then the cube will "jump" to the new configuration. This setting also affects the animation of the solve command. Note that if the animation speed is set to "off" and the solve command is executed, a pause before anything happens will be at least a few seconds. Please be patient.
3D View
Toggles the small 3D view between visible and not.
Redundant Buttons
Toggle a series of redudant buttons between visible and not. These are used when it's difficult to figure out which button rotates which face.

Help

Help
Opens this help in the MATLAB helpbrowser. Can also be accessed by typing flatRubiks -HELP at the command prompt.
About
Opens a message box with some credits. Can also be accessed by typing flatRubiks -ABOUT at the command prompt.

Color Selector

The color selctor is used change the color scheme of the cube. It is accessed through the view menu.

Each of the six colors has three sliders representing the amount of red, green, and blue in the color. Adjusting any of these colors, automatically sets the pull-down menu to "custom."

The pull-down contains some pre-set color themes. Most of them (except Default and Custom) are created from MATLAB colormap functions of the same names.

Closing the window will save the colors and update the view.

Remarks

You may be asking yourself why I created this. First and foremost I was bored. Not so bored that I worked on this a lot. It actually took me a month to write. But you'll note that I was able to easily create a small 3D view. For a while it was animated too. But that wasn't my purpose with this guy. I didn't wnat to make another Rubik's Cube thing. You may be thinking that by making it 2D it was easier to make. Au contrair. The 3D view was much easier to make, and frankly, there are already some great 3D MATLAB Rubik's Cubes out there. Also, I think the 2D version is much harder to solve. Especially for people like me that have a certain algorithm memorized to solve the real life 3D version. When trying to solve this guy, I'm constantly trying to visualize the flat guy wrapped around a cube. I ended up putting in the 3D view as kind of a cheat (visually anyway).

If you have any comments, questions, or whatever, I'd really love to hear them. Visit my website, Troatie.com.

© 2005, Trent Michael Russi

Contact us at files@mathworks.com