Matlab: Rubik’s Cube Simulator and Solver

Get files and more info from here (free mathworks account is required).

This program allows you to generate a randomly scramble cube of arbitrary dimension which can then be manipulated manually or solved by the computer. You can also input your own state using a webcam (3x3x3), or simply enter the colors of each facelet (2,3,4x.x.).

There are several built-in solving mechanisms available:
– God’s Algorithm for the 2x2x2: this is the optimal solution for the given state (in half-turn metric).
– Thistlethwaite 45 (T45) for the 3x3x3: this algorithm will always find a solution of 45 moves or less, averaging at 31.
– Layer-by-Layer (Beginners’) Solution: this is the method commonly used by beginners to solve the cube. More intuitive than T45, but also more extensive and less effective.
– 423T45 for the 4x4x4 (read 4 to 3, T45): this algorithm brings the cube to a state which can be handled like it was a 3x3x3 cube. When this is achieved, T45 can be applied to solve it (~180 moves on avg).
– Inverse Scramble for all cubes: it is like cheating, but when the scramble is known, each cube can be solved by inversing the sequence.

All of the above methods (with exception of the inverse scramble, which is trivial) are explained extensively in the included PDF. The PDF also contains a vast theoretical description of the cube.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s