The generators were designed for a resolution of 1024x640. A distorted screen will result at any resolution less than this.

Many of the text fields are buttons. Their use may not be intuitive. It is suggested that the following section be read prior to using the generator.

The generator opens to one of the three build modes. Any of the six quadrillion possible nasik magic cubes can be made. Only valid cubes can be built.

Once the cube is built it can be manipulated to make a family of 9! different valid cubes or to make visually different modifications of any of the family's 9! valid cubes.

One can also quickly scan some of the many patterns that add to the magic constant.

The cube can be observed and manipulated either as an eight square representation or as a 3-dimensional rotatable cube.


The Cube Generator offers three methods for the generation of a magic cube each of which has its own merits. All approaches will only allow you to make selections that will lead to a valid magic cube. Because of a validation assumption, there is the possibility for a dead end to occur wherein a cube cannot be completed. I have never had this occur with the cube and would be interested if anyone else does. I am reasonably certain it will not occur for the cube.

The program opens in the Base Lines build mode. To select one of the other build modes, click on the restart button and release on the desired mode.

For all three methods of construction, the screen is split into two parts. The upper part controls the generation of the cube and the lower part, containing eight squares, represents the cube. To visualize the cube the squares are numbered from left to right with the top four squares representing numbers 1-4 and the bottom four 5-8 in the z direction. For the purpose of visualizing the cube, the upper left corner of the first square is the 0, 0, 0 point. Code entries for rows run from left to right, columns from top to bottom, and pillars from front to back. During construction a zero will always be present at the 0, 0, 0 position of the cube because all of the base lines start with 0 and therefore all exclusive OR combinations at that position will be 0.

Base Lines

When initially opened the program is set up to generate the cube by selecting Base Lines. To make the cube using this approach one must select from among the selectable base lines at each step until the cube is completed. This requires 27 selections. Base lines are chosen in the order row, column, and pillar. Selection of the pillar base line completes a base cube. Progress is shown by the prompt at the top. The buttons show both the abbreviated ABC base line codes and the 8-bit codes to aid selection.

Every time a base cube is completed the resulting array in the display will have all of the appropriate addition properties of a magic cube, and there will be even integral distribution of the numbers displayed. This statement is not true for the cubes shown after selection of a row or column base line. These intermediate cubes in general do not have appropriate addition properties.

Selection of the first base line will result in the entry of that base line from left to right in every row of every square. After entry of the first column base line each square will display the result of the OR function combination of the row and column base lines. Entry of the first pillar base line completes the first base cube and displays the results of the OR function for all three base lines in their respective directions.

When the row base line for the second base cube is selected, the numbers of the first base cube are doubled and the row code for the second base cube is added in every row of every square. Selection of the second column base line changes the values of the second base cube to reflect the OR combination of the second row and second column base lines. Selection of the second pillar base line again changes the values added to the first base cube, to the correct OR combination for all three base lines of the second base cube. The combination of the first two base cubes is doubled prior to the addition of the third row base line. The process is continued until the ninth base cube is completed.

Only one A base line, one B base line, and one C base line can be used in each base cube. Once a base line letter type is selected, it cannot be selected again until a new base cube is started. This is reflected in the base line choices available at each step. Possible choices for each successive base cube become more restricted as the cube is completed reflecting the decreasing number of choices possible to properly complete the cube.

Each time a base line is selected, that selection is shown at the top of the cube matrix. The base lines are grouped in threes of row, column, and pillar base lines from left to right. There are nine groups of three, one for each of the nine base cubes. The base line matrix is a fingerprint of the cube as generated.

While generating the cube, it is possible to Restart the cube in any one of the three build modes. Doing so will reset all values in the squares to 0 and cube generation will start from the beginning. It is also possible to Quit at any time. There is no mechanism for saving an intermediate cube.

When the last pillar is selected, the cube will have been successfully completed and additional manipulations can be selected using the Modify button.

Base Cubes

The Base Cubes build mode is the quickest way to generate a cube, as only nine selections are needed. This approach also closely mimics the approach I initially used to make a magic cube. The screen shows all 96 possible base cubes using combinations of three base lines representing in order the row, column, and pillar base lines. When first opened it is possible to select any of the 96 base cubes, but with each selection the number of remaining choices is further restricted by the dimming of the unusable codes.

The selections are highlighted and numbered in the order picked. The first selection gives an array of 0's and 1's corresponding to the OR combination of the three base lines of the first base cube. When the second base cube is selected the 0's and 1's of the first base cube become 0's and 2's and the OR combination of the three base lines of the second base cube are added. With selection of the third base cube the values from 0-3 in the cube are doubled and the third base cube values added, etc.

On completion of the cube, one has the option of further modification of the cube through the Modify button. At any time, it is possible to Quit or switch to one of the other modes of building the cube. It is also possible, after the selection of a base cube, to deselect the last base cube. Only the last base cube can be deselected, but this can be done sequentially back to the start.

It is interesting to watch which base cubes dim after each sequential selection. Predictable patterns can be generated by judicious choice of base cubes. This is not entirely by chance as the order in which the base cubes were arranged was picked to help show potential patterns based on selection rules. Some examples of selection rules are discussed in Base Cube Rules. This mode also is responsible for my assertion that it will always be possible to find the next base cube and thus complete the magic cube. The fewest next cubes I have ever seen are six, and that was only for the last selection.

Base Line Array

The Base Line Array gives the most flexibility in generating a magic cube. All 27 base lines can be set in any order. The base lines can also be set back to the null value by selecting the ? or changed at any time in any order. All entries and changes are subject to the restriction that a valid cube can be created after all other picks are made. It is also possible to carry out some of the transformations of the Base Line Editor at any time during the construction.

The array is set up such that the base cubes are shown in columns. There is no multiplication of intermediate cubes as the multiplication factors are built into the individual columns. The right hand column always adds 0's or 1's as an unmodified base cube. The second column from the right adds 0's and 2's as a result of multiplying the underlying base cube by 2. Each subsequent column to the right multiplies the underlying base cube by the next higher power of 2 so that the left hand column adds 0's and 256's.

When a button is selected, a submenu of all the base lines appears. Clicking on one of the base lines enters it into the cube array with the appropriate multiplication factor. When each subsequent button is selected, verification is carried out before the submenu is displayed. The verification determines which of the codes in that selection can be legally picked. If it is determined that the magic cube can be completed by using one of the base lines then it is selectable when the submenu opens. If no valid magic cube can be found containing a base line in that position in combination with all other selections, then it is grayed out.

Under most circumstances, verification is very fast with no noticeable delay. Under some circumstances, the amount of time required for the verification can become excessive. These delays usually occur when base lines are present in multiple unfinished columns containing only one entry. In a single row, six A0's can be entered with no perceptible delay on my computer. When a seventh button in that same row is then selected a delay of more than 15 minutes occurs before the algorithm determines that no more A0's are possible in that row. If there are other entries in three of the columns with the A0's then there is a pause of about two minutes. It is best to avoid creating too many unfinished base cubes with any but the fastest computers.

Row, column, and pillar base lines are grouped horizontally in the Base Line Array from top to bottom. They may be interchanged at any time by clicking on one of the black ovals at the left and dragging it to a new location. After this exchange, the base lines for the two dimensions that were switched trade places in the display reflecting the exchange. The position of the individual base cubes can also be changed by clicking one of the black ovals at the top and dragging it to a new location. Finally the base lines in a row, column, or pillar can be reversed with an accompanying translation by clicking one of the ovals on the left. The procedures in this paragraph are discussed in more detail in the Base Line Editor section where the processes can be carried out on the completed magic cubes.


When a cube has been successfully completed using any of the three build modes, the Modify button appears in the upper left corner of the screen. Transformations, the Base Line Editor, or the Magic Constant checker can be selected by clicking on the Modify button and releasing on the desired mode. It is possible to navigate among these three modes at any time once the cube is completed.

After the initial selection, a fourth choice appears under the Modify button. The Traditional Cube button will add one to every value in the cube so that numbers from 1-512 are displayed rather than numbers from 0-511. The wording changes from Traditional Cube to Base Line Cube after this selection to allow for a reversal to the 0-511 range.

Also, after making a selection from the Modify button a Save button will appear in the upper left corner. The cube can then be saved to a file. The default name for the file is cubedrop. The file will be saved as eight 8 x 8 squares. It will appear with the numbers in the positions they have at the time the Save button is pressed. Above the 8 x 8 squares will be the three line set of master base lines and a listing of the nine base lines in the shorthand ABC notation. The master base lines and base lines lists will also reflect the cubes configuration at the time it was saved. This means the master base lines may have their zeros in the middle of the line. The base lines list will indicate a vector that the cube must be shifted if the zero is not at the (0, 0, 0) position. The Reset may be pressed prior to saving to obtain the originally built cube.

It is also still possible to build another cube using any of the three build modes at any time by selecting the Restart button. This will erase the current cube. There is, however, now a fourth selection under the Restart button. The Reset button will return the display to the values that appeared after completion of the build, reversing all changes that were made to the original cube subsequent to completion. There are two exceptions. If Traditional Cube was selected it will stay as the Traditional Cube. If the Big Cube is displayed it will continue to be displayed.


Transformations do not fundamentally change the cube; they merely present it in a different orientation. Even though in outward appearance they may look different, they are, according to the magic cube cops, the same cube. They are either different aspects and/or different translations of the same cube. Most of the manipulations that can be carried out in the transformations mode are valid for any magic cube. The transformations have some mathematical merit but they are mostly just fun to do. When Transformations is selected the upper part of the screen changes from the build mode to a set of buttons which activate the possible transformations. There is a small 3D cube in the middle that will be used to select a direction for many of the transformations. A description of these transformations is below.


In the generation of the cube, the 0 was always at the upper left corner of the first square. This is the commonly used orientation for magic cubes but the position is somewhat arbitrary. The 0, or 1 for the traditional cube, can be moved to any position in the cube by clicking on that position in the cube grid. Translations of this type will result in valid cubes for the cubes constructed with this generator but the diagonals of most other cubes would be invalid after a translation.

Reverse Numbers

If all the values in a cube are reversed to their inverse, the resulting cube will be valid. By number reversal is meant replacing each number x with the number 511-x for the Base Line Cube or 513-x for the Traditional Cube. If the range 0-511 is used and the numbers are written as nine bit numbers then the reverse number is obtained by inversion of all nine bits. The pair of a number and its reversed number are called complements. In order-8 pan-2,3-agonal cubes the complementary or reversed number are always located 4 rows, 4 columns, and 4 pillars apart. Placing the mouse over the Reverse Numbers button initiates a sequential reversal of the numbers that will revert to the starting values if the mouse is removed. Clicking increases the speed and will take the reversal to completion regardless of mouse position. The reversal illustration is more dramatic than the actual effect. Reversal actually just translates the axis a (4, 4, 4) vector from its initial position. As with other translations cubes not generated by this program generally give invalid results after an inversion of this type.


The cube can be rotated either Clockwise or Counterclockwise on any of its three axes. To achieve this effect click on the desired button and then select one of the three faces of the little cube. The little cube will rotate in the appropriate direction and the numbers in the cube array will change accordingly. It may be difficult to visualize this transformation for xz and yz rotations.

Inversions (Reflections)

A cube has three planes of symmetry perpendicular to each of its three central axes (Parallel Plane). It also has six planes of symmetry defined by pairs of opposing cube edges and the diagonals on the faces connecting them (Diagonal Plane 1 and 2). The three central axes of the cube also are lines of symmetry of the cube (Axis Line) as are the six lines that pass through the centers of the pairs of opposite cube edges (Edge Line). The cube also has a point of symmetry in its center (Center Point). Moving each of the numbers to the opposing position of the plane, line, or point of symmetry results in a valid, transformed magic cube. Plane and point transformations create a mirror image of the original cube. Line transformations are comparable to a set of rotations. Except for the Center Point inversion, all inversions are achieved in the same way as the rotations. First select the inversion type, and then select a direction using the small cube. This is normally one of the faces as for the rotations but the individual lines must be picked to complete the Edge Line transformation. Selection of Center Point immediately initiates the inversion, as there is only one type.

The word inversion is used above to describe the transformation that occurs. In the magic literature, it is usually described as a reflection. I use the word inversion to more accurately describe the visual effect that is seen in the cube generator. The cube is inverted through a point, line or plane in the visual representation. The word reflection suggests that a mirror image is created that is separate from the original figure.

It needs to be noted that even though it is the "same" cube after a transformation some of the base lines may change to their complementary pairs as noted in the discussion of the square. The pairs of base lines that can switch are B0 and B1 as in the square, C0 and C7, C1 and C3, C2 and C5, and C4 and C6. This is discussed in more detail in the Base Line Editor.

Big Cube

Clicking on the Change to Big Cube button converts the flat representation of the cube into a 3D representation. Clicking on the Convert to Squares button will change the representation back to eight squares. Clicking and dragging will rotate the 3D image. The little cube always rotates in concert with the big cube, although they sometimes appear to be rotating differently due to an optical illusion. The transformations can be performed with the big cube stationary or rotating. All transformations can be done with the big cube active. Translations are accomplished by using the slider controls on the left side of the screen.


When the Base Line Editor is selected from the Modify button, the upper part of the screen changes to show two arrays of 27 base lines similar to that seen in the Code Array build mode. The columns in these arrays represent the nine base cubes and the rows indicate which of the three dimensions the base lines reside in. Between these two arrays is a set of three black ovals that show the position of the 0 (the 1 for the traditional cube). Numbers from 1 to 8 may be entered in the ovals. The lower part of the screen may be either the group of eight squares or the Big Cube. There is, however, no way to switch between them in the Base Line Editor.


The array on the left has black ovals on three sides and the multiplier for the corresponding base cube on the bottom. Clicking on an oval on the left and dragging to another position will exchange the base line assignments for one dimension with the assignments for another. On the right side of the array is a set of ovals that allow the base lines in the associated dimension to be reversed by clicking on the oval. When base lines are reversed in the Base Line Editor, they are also translated so that they retain the zero (or 1) in the same position. A reversal causes base lines to become their complementary pair base line, the B0 becomes a B1, C0 becomes C7, etc. With the appropriate selections of dimension assignments, base line reversals, and translations, any of the changes discussed under Transformations can be duplicated. There are six, 3!, dimensional arrangements. Each dimension can be reversed independently of the others giving eight, 23, flipping arrangements. This gives 48, six time eight, visually different cubes. By current convention, however, these are all considered different aspects of the same cube. Translations should also be considered linked to the same cube.

Unique Cube Conformation

The Base Line Editor also allows shifting of the order of the base cubes. In the square description it was shown that valid magic squares are generated no matter what the multiplier order of the four base squares. The same concept is also true for the cube. If a valid cube is generated from 9 base cubes, the multipliers for those 9 base cubes can be rearranged in any order to create different valid magic cubes. The multipliers are powers of 2, from 20 to 28. One nasik magic cube in effect defines a set of 9! nasik magic cubes. Based on my interpretation of current definitions, the magic cube cops consider these all to be different magic cubes.

Benson and Jacoby5 have suggested method of grouping the set of 48 magic cubes aspects under a master cube based on a set of criteria. I would like to propose a different approach for these cubes that incorporates all 17,418,240 (9! X 48) permutations of the Base Line Editor. This is the array on the upper left of the Base Line Editor called the Unique Cube Conformation. This is based somewhat arbitrarily on an alphanumeric order of the base cube's base lines following these rules:

  1. The first base cube must have the lowest possible A0, B0, C(0-2) score. Score is based on letter order first then numerical in the row, column, and pillar base lines respectively. The ABC order scores lower than the ACB followed by the orders BAC, BCA, CAB, and CBA. The order for the first base cube will always be A, B, C from top down in the array because the dimension assignments can be shuffled to any order. With shuffling, the first base line for the first base cube will always be A0. The second base line will always be B0 because a B1 code can be reversed to make a B0 code. The third base line can be C0, C1, C2, or C4 as the other four C base lines are complements. It is not possible to make a cube with exclusively C4's and C6's (or any other complementary pair). One of the other C codes must be used somewhere in the cube so that the first base cube must have a C0, C1, or C2. Keep in mind that when reversing or shuffling codes, it must be the entire row(s) that is changed. All of the base cubes must be evaluated to determine if they are the first base cube in the Unique Cube Conformation. Selection of the first base cube sets the dimensional arrangement of the Unique Cube Conformation.
  2. If there is more than one base cube with the same lowest score in the first step, then the second, third, etc. base cube must be used to determine the dimensional arrangement of the Unique Cube Conformation. If there is a tie, the tied base cubes will have different dimensional arrangements. For each of the tied potential first base cubes the remaining base cubes must be evaluated to determine the second base cube with the lowest score while in the dimensional arrangement defined by that potential first base cube. With selection of the potential first base cube the dimensional order becomes fixed for the remaining base cubes, therefore shuffling is no longer possible. If the second base cube begins with a B or C base line then the row base lines can be reversed in order to obtain the lowest score. The column and pillar codes cannot be reversed as the first base cube's B and C base lines determined their order.
  3. Once the first base cube has been determined, the remainder of the base cubes are then lined up from lowest to highest score. If the first base cube was determined based on just A0 base lines in the row dimension then the remainder of the base cubes must be evaluated after reversal of the row base lines to determine which row order takes precedence.

Based on the above each magic cube generated with the cube generator defines 9! or 362,880 other magic cubes. Each of the 9! magic cubes encompass 48 different aspects that are by definition the same magic cube. These 48 aspects can be used to independently generate the same cube using the cube generator. As currently designed, the cube generator treats these 48 times 9! cubes autonomously in the build mode. They become grouped in the Base Line Editor. It was stated earlier that there are 6,436,518,100,992,000 magic cubes with the zero at the 0, 0, 0 position. This can be divided by 9! to give 17,737,318,400 unique magic cube conformations. Further division by 48, however, gives 369,527,466.66. This suggests that not all cubes have 9! analogs. There are some cubes that are made with three different dimensional arrangements of the same three base cubes. This can account for the discrepency.


The Magic Constant checker was the last thing added to the cube generator. It was added in order to give a visual picture of the magic addition properties of the cubes. It is not used for verification. It can be accessed from the Modify button. When accessed as usual it is primarily the top part of the screen that changes, in this case to a list of types of patterns that add to the magic constant. The lower part of the screen may contain either the array of eight squares or the big cube. The discussion will focus on an eight square display at first and then discuss the big cube differences.


When initially opened, 1-D lines is selected as the Magic Constant type and row is selected as the sub type. The 0,0,0 position is selected in the array of eight squares below. Any of the positions in the eight square array can be selected by clicking on the number to look at the sum of the numbers in that row. Each position represents a different example of that particular sub type. The eight positions in the same row will sum the same eight numbers, however. When the mouse is in the upper part of the screen, the row containing the selected position is blue and the selected position has a square around it. When the mouse is over the lower part of the screen the row of the position it is currently over is blue and the number it is over is the selected position regardless of where the square marker resides.

There are three sub types of 1-D lines that can be selected by clicking on the sub type. These represent the three axes of the cube. There are also 19 other Magic Constant types of groups that add to the magic sum with their associated sub types. Again, the blue numbers indicate what is currently being summed and the selected number has a square around it.

The sum of the eight numbers in the group is shown in the upper left and I assure you that it is indeed summing the correct numbers it is not just a dummy fixed number. The sum will be 2044 for the Base Line Cube and 2052 for the Traditional Cube.

Lines and Diagonals

The rows, columns, and pillars are sub types of the 1-D lines. Each face has two diagonals; therefore, there are two sub types of diagonals that can be selected for each of the three 2-D planes that can be chosen. One must consider the wrap around nature of these magic cubes to visualize most of the diagonals in the square array as they appear to be split into two parts. The sub type description indicates the direction of the diagonal. If both dimensions are + then the diagonal increases in both dimensions, whereas a + and - indicates that while the coordinates of one dimension are increasing the coordinates of the other decrease. There are four sub types of cube diagonals and again most of these are wrapped and can be hard to visualize in the square array.

Selection of any of the cube numbers in a given row results in the same group of numbers being summed. This effect will be true for rows, columns, pillars, and all diagonals but not for most of the other types. Because of this effect the groups of eight numbers for these types will all be selected redundantly eight times in the Magic Constant checker. The order in which they are selected will however be different. This latter effect can be seen when the big cube is active. There are thus 64 unique examples of each sub type of the lines and diagonals.

Corners of Cubes and Rectangular Prisms

The remaining types are mostly of two general types, corners of cubes or rectangular prisms of different dimensions and shifted lines or diagonals. There are 4 sub types of cube corners described, and 3 sub types of each of the rectangular prism corners. For the rectangular prisms the three numbers in the sub types describe in order the row, column and pillar prism size. With the exception of the 5x5x5 cube every position selected in the cube will give a different grouping of eight numbers, i.e. 512 corners of 3x3x3 cubes, etc. In looking at all the possible positions it can be seen that not all appear to conform to the description, i.e. a 4x4x4, cube often appears to be a 6x4x4 or 4x6x6, etc. rectangular prism. This is due to the wrap around properties of the cube. Because of this 2's and 8's, 3's and 7's, and 4's and 6's are interchangeable for both the cube corners and rectangular prism corners. Wrapping around the 5x5x5 cubes always yields a 5x5x5. For this cube, each group of eight numbers is therefore selected redundantly eight times.

Shifted Lines and Diagonals

Shifted rows, columns, and pillars consist of four numbers in one straight line and four numbers in a second line displaced by a (a, b, c) vector from that line, where the vector in the direction of the line is always 4 and one or both of the other vectors is also 4. If only one is a 4 the other is 0. For the Shifted Rows, for example, the second half of the row of the first sub type is shifted a (4, 4, 0) vector from the first half. The next sub type uses that same first line, but in this case the other part of the line is shifted a(4, 0, 4) vector. The last sub type shifts the second part of the line by a (4, 4, 4) vector.

Shifted diagonals are similar to shifted rows, etc. in concept. Only the two dimensional diagonals can be shifted and the shift is always by a (4, 4, 4) vector from the first part of the line. There are two sub types for each plane of the cube due to the two diagonals in each plane. Because there are two sections to the shifted lines and diagonals each group of eight numbers can be selected in two ways. There are 256 examples of each sub type.

Shifted Squares

Shifted square corners are the four corners of a square in one plane and the four corners of a second square displaced by a (a, b, c) vector from the first square. The vector in the plane is always (4, 4). The vector in the third dimension is either 0 or 4. Often mentioned in the magic cube literature is a configuration described as the middle two number of each of the four sides of the squares of the cube. This is just a special case of the shifted squares due to the wrap around property. Another special case consists of the four corners and four middle numbers of each square of the cube. There are 256 examples of each sub type.

Viewing in the Big Cube Mode

To observe the Magic Constant checker in the Big Cube mode select the Modify button and then Big Cube. To change it back click on the Modify button and then Square. When the lower part of the screen is set up as a Big Cube, visualization of the groups being summed is often easier especially if the cube is rotating slowly. Selected groups are overlaid with a larger font blue image of the appropriate number while the original black number is still present. The resulting image allows observation of the selected numbers as the cube rotates. On the right side of the screen are the eight numbers being summed, the coordinates of those numbers, and the sum of those eight numbers. Again, the sum seems frozen but it is indeed adding the eight numbers above it, the sum is just always the same. Navigation in the top part of the screen is the same as when the eight squares were displayed.

The row, column, and pillar coordinates for the first member of the group being summed are shown to the left of the cube. The sliders allow the selection of any position in the cube. The various addition groups can be selected manually by selecting the x, y, z, coordinates, a type and a sub type. Alternatively, two scan buttons are provided. The scan types button will scan through all the types and sub types while keeping the position of the first member of the group constant. The scan position button will scan through all the examples of the selected sub type, thus sequentially picking different positions for the first member of the group. Both buttons have a relatively slow scan speed to allow visualization of the pattern and a fast speed that will scan rapidly allowing one to observe the unchanging sum. If any of the groups do not add to the magic sum the sum value will appear to flicker. This should never happen.

There are thousands of other groupings that can be described as above. Additional groups are discussed in Magic Constant Groups. For those of you who prefer to work with Excel spreadsheets there is available a spreadsheet in CubeCheck which shows the same sums. It includes among other things the ability to build cubes but with no guarantee of success. The SquareLines spreadsheet will also provide sums for those cubes that can be made using master base lines. Harvey Heinz has a sheet also which will sum the traditional lines and diagonals.