Unravelling Cubes of Size 2x2x2 and Above

Preamble

The Rubik's cube and its extensions have been around for a long time and provide perennial fascination. They come in both hardware and interactive software forms. Well-known hardware forms of the cube come in sizes 2x2x2 (Pocket Cube), 3x3x3 (standard Rubik's cube), 4x4x4 (Rubik's Revenge) and 5x5x5 (Professor's Cube). Hardware sizes 6x6x6 and 7x7x7 have also become available in recent times. For simplicity I will refer to such cubes as being of size 2, 3, 4, 5, 6 and 7 respectively.

A common but by no means universal approach for software forms is to emulate the cube by:

  1. Providing a "three-dimensional" display of the cube that makes it look like a real hardware cube.
  2. Providing a means for the user to change the cube state step-by-step and solve it.

Other interactive software approaches that don't emulate a three-dimensional cube are also used by some programmers.

A brief review of the status of the Rubik's family cubes (size 2 and above), with special emphasis on cubes of large size, is provided in the Rubik's n x n x n Cube Family file.

Unravel Interactive Software Program

My interest in cubes arose from a desire to solve cubes too large and complex to consider for manufacture in physical form. Interactive software I have developed for this purpose is referred to under the name Unravel. Freeware versions of Unravel are available for download.

Unravel Program Development History

The original version of Unravel was written pre-1991 in Fortran for use with monochrome monitors in common use at the time of the initial development. It used a numerical representation for the cube elements and catered for cubes in the size 2 to 11 range. If anybody has special needs or who may be interested in program history, email me and I will send you Rubknn.exe (dated 21-Oct-1991) which retains monochrome capability, handles cubes of size 2 to 11 and can run under Windows XP (but not later versions). The first version using colour graphics was also written in Fortran and the final Fortran version was produced in 1991. It catered for cubes in the size 2 to 15 range. Later versions written in C, C++ and Java included incremental improvements, with the current C++ version (available as a Windows executable program) catering for a cube size range of 2 to 16. The Java version has the same lower limit but has a settable upper limit ranging upwards from 16 but never exceeding 99 for a standard cube with unmarked centres.

Both versions of the software allow the cube size to be selected in increments of one within the available cube size range. Both versions of the software are available for download.

Standard and Marked Centres' Unravel Program Options for Java Version

A "standard" cube has no makings on centre cubies and individual centre cubies can end up in varying positions for the solved state. Corner and edge cubies awlays end up in the original set state positions when the cube is solved. For cubes with marked centres there is only one correct arrangement of centre cubies that satisfies a solved state.

The Java version of the Unravel program has a marked centres' option which is settable at run time. When set, the program implements marked centre cubies in the size 3 to a typical 32 upper limit. Centre markings impose a pixel penalty that places a restriction relative to the standard cube on the maximum cube size that can be accommodated.

Centre cubie marking adds complexity to the cube solving process relative that for standard cubes. While there are many approaches for the solving of standard cubes, two of the most common options relate to the order in which many of the centre cubies are placed. Centre cubies before or after many of the edge cubies are the main options.

It is theoretically possible to solve centre cubies for a size 4 cube with marked centres before the alignment of edge cubies is completed. However, it is impossible to align the final layer of centre cubies for any cube of larger size that has marked centre cubies until all edge cubies have been aligned. Refer to cuberules.pdf for details.

Cube Size Limit for Java Version

To achieve an upper limit that is the same for a very wide range of monitors, a settable option that allows some or all of the bottom face to be scrolled out of view is provided. For cubes with unmarked centres, most monitors will allow an upper limit of size 99 for a cubie colour element of size 2x2 pixel. Depending on the users' visual acuity and on whether they use magnifying spectacles that size may be out of range. To achieve the upper limit for cubes with marked centres the cubie colour element needs to be of size 8x8 pixel. Most users would regard that as a readily viewable limit. The Unravel program allows the user to be informed of the cube size limits applicable to the monitor in use at run-time.

Unravel Program Features

The first thing to observe is that the state of a cube is completely defined by what can be seen on its six external surfaces. For a standard cube of size n, the state is completely defined by the colours of n x n x 6 miniature squares. For a cube with marked centres, the markings can be superimposed on the six face colours used for standard cubes. It follows that the current state of the cube can be simply observed on a computer screen by displaying six flat two-dimensional faces each with n x n elements. This approach has been adopted for the Unravel software available for download and has also been used by some other programmers. While the two-dimensional display lacks a real-world look, it actually makes solving the cube easier than some other implementations because all cubies are visible all the time or, optionally, all cubies of current interest are visible. Of course, all the rules that apply to the real-world cube have to be implemented in the software.

Central to the Unravel cube solution software is the adoption of keyboard text entry as the means by which the user manipulates the state of the cube. A useful addition to the cube software is the introduction of some shortcuts. The conventional approach is to advance in 90 degree rotation (quarter turn) steps of one or more layers throughout the solution process. Computers are ideally set up to allow sequences to be defined in "macros". The term "macro" as used in computer science is a rule or pattern that specifies how a certain input sequence should be mapped into an output sequence. Macros are normally used to map a short string to a longer string (sequence of instructions). Macros simplify things in Unravel by providing short-cuts for long sets (or frequently used short sets) of instructions on how to rotate the cube. Implementation of macros is achieved via keyboard entry. Macros may be of limited use in the initial stages of unscrambling a cube and most are used for centre element placement (centre elements become numerically dominant for n greater than 4). The default macro set included with the Unravel software provides just one of many paths to a solution. The macro sequences provided for cubes of size 4 and above may not be as short as some published sequences. It needs to be emphasized that I was looking for "a" solution, not necessarily the solution with the least number of moves. From a computer standpoint, short or long macro sequences can be executed "instantly". Users can use the default macros, or write and use their own macros, or not use any macros, if they wish.

An essential addition to cube software, particularly for cubes of large size, is the provision of the capability for users to save the state of their partially arranged cube on their disk or other storage medium, and be able to readily recover it at a later time. For cubes of large size it would be safe to say that non-specialist cubists would not want to rely on being able to solve the cube in one sitting.

For those who have an interest in the time they take to solve a cube, an elapsed timer is provided. "Processor" time is logged separately to "user" time, so a slower computer does not give rise to any penalty. Elapsed time is also saved when the cube state is saved. The elapsed time display can be turned off if desired.

The Unravel program can be run directly from this website in either Applet or Web Start mode. If the Web Start mode is selected the Java program will be downloaded to the user's computer and can subsequently be run off-line if desired. Users who experience difficulties with Web Start or who wish to download just the basic program and run it direct from the program's Java Archive (jar) file can achieve this with an alternative download referred to on the Programs for Unravelling Cubes page as Java Archive (JAR) Direct Mode. For users who have a Windows operating system, the earlier version developed using C++ is available for download as an alternative to the Java implementation, if preferred. For the C++ version, there are some advantages in respect of start-up speed, neatness of graphics, and program installation, but the cube size limit of 16 may be unacceptable for some cubists. Also, some options available in the later Java version are not available in the C++ version. For discussion on and implementation of the software options, go to the Programs for Unravelling Cubes page.

The main features of the software including those expanded upon above are:

  • A scroll option is available to increase the cube size upper limit for monitors that have a cube size restriction due to insufficient vertical pixels being available.
  • Cube size is selectable at run-time in increments of 1 from cube size 2 to 99 on most computers.
  • Marked centres' style can be selected for the Java version for the cube size range of 3 to 32 on most computers.
  • Automatic resizing of cube display to make best use of available screen area occurs.
  • Cube state is changed using keyboard character commands.
  • Default or user-defined macros can be used to provide shorthand means of implementing a sequence of rotations. Macros can call other macros and can be nested to any depth.
  • A grid can be optionally displayed on cubes of large size to simplify location of cubies distant from cube edges.
  • State of cube can be saved at any time and later recovered.
  • Elapsed time from scrambled start is tracked, optionally displayed, and saved whenever cube state is saved. The time to solve the cube is automatically logged for future reference (not available in Java applet mode).
  • The cube can be initialised to the set state, scrambled state, or previously saved state.
  • The colour set used for the application can be changed at run time and is then automatically saved for later use (not available in Java applet mode). When marked cubes are dislayed default colours are used for the six cube faces and cannot be changed by the user.
  • General help and default macro help are available, the latter being generated at run time according to the selected cube size. Help can be accessed by pressing the F1 key at just about any time.
  • Error messages are displayed if the user enters an invalid command sequence when solving the cube or when creating a new macro.
  • A runtime selectable option for determining the cycle length of any user-nominated permutation for cubes of any size is accommodated by the program.

Other

Supplementary help, particularly for beginners, in solving standard cubes of various sizes using my Unravel program, is available in document form from the Instructions for Solving Rubik Family Cubes of Any Size file cubesolving.pdf. Supplementary help in solving the more complex marked centres' style cubes is available in document form from the Implementing and Solving Rubik's Family Cubes with Marked Centres file markctr.pdf.

In summary, my motivation for developing the program, referred to by the name Unravel, was to develop my own methods, including macros, to facilitate solving cubes of size n = 4 and above. I realize that hardware cubes are still likely to be preferred by many people. It needs to be stressed that the supplied program does not make it overly simple to solve complex cubes but it makes it fairly straight forward for an amateur cubist to do so. There are plenty of challenges along the way, and users can decide how far they want to go - from simple and quick to complex and long-winded.

The number of reachable states possible for cubes in the size range 2 to 25 was calculated as a separate exercise. This has nothing to do with solving the cube. If you manage to solve the size 16 cube (with unmarked centres) you will have arrived at the one in 10933.175 possible states that represents the solution to the standard size 16 cube.

A full list of my supporting documents relating to Rubik's family cubes is provided on the Cube Publications page.

** Size 2 cube **

** Size 3 cube **

** Size 4 cube **

** Size 5 cube **

** Size 2 cube **

** Size 3 cube **

** Size 4 cube **

** Size 5 cube **

** Size 2 cube **

** Size 3 cube **

** Size 4 cube **

** Size 5 cube **

** Size 2 cube **

** Size 3 cube **

** Size 4 cube **

** Size 5 cube **

** Size 2 cube **

** Size 3 cube **

** Size 4 cube **

** Size 5 cube **

** Size 2 cube **