# The &kubrick; Handbook

## Introduction

### Gametype:

Logic

### Number of possible players:

One

&kubrick; is based on the famous Rubik's Cube puzzle, invented by Professor Erno Rubik in Hungary in the 1970s. His original puzzle was a cube that appeared to consist of 27 smaller colored cubes, called cubies, arranged in a 3x3x3 stack. When you turned the faces of the cube, the colors of the cubies became shuffled and the challenge was to unshuffle them, so that each face of the cube contained a single color.

In &kubrick; the cube sizes range from 2x2x2 (easy) up to 6x6x6 (very hard), or you can play with irregular bricks such as 5x3x2 and mats (one cubie thick) such as 6x4x1. The game has a selection of puzzles at several levels of difficulty, as well as some demonstrations of pretty patterns and solution moves. It is also possible to make up your own puzzles.

## How to Play

### Objective:

Return all the pieces of the cube to their starting positions after the computer has made several shuffling moves.

&kubrick; starts with an animated demonstration that randomly chooses cubes of various dimensions, shuffles them and solves them. If you have never seen a Rubik's Cube before, the demonstration will give you a general idea of how to play. Just click anywhere with the mouse to stop the demonstration and start playing. You will then see a new puzzle or the puzzle you were last working on, exactly as it was when you left it.

&kubrick; has a choice of three views, showing one, two or three cubes, all of which are the same cube viewed from different angles. Use the View menu or toolbar buttons to switch between views.

Use Game Choose Puzzle Type to choose the size of cube and degree of difficulty for the type of puzzle you wish to try. Then use Game New Puzzle each time you wish to re-shuffle the cube and start a new puzzle of that type.

### Making Moves

You can use either the mouse or the keyboard to move the cube.

Use the left mouse-button or keyboard to rotate single slices of the cube around any axis, as when solving a puzzle. Square slices (e.g. 4x4 cubies) rotate by 90 degrees at a time. Rectangular slices (e.g. 5x3 cubies) rotate by 180 degrees.

Use the right mouse-button to rotate the whole cube around any axis. Or use the C key, within a keyboard sequence. Such moves do not lead to a solution of the puzzle, but you might use them to examine the current position more closely or to get the cube into position for a sequence of solution moves, such as untwisting two corners.

All moves, however they are made, are displayed progressively in the toolbar using the widely-recognized Singmaster Notation. See the section Singmaster Moves for more details.

### Using the Mouse to Move

To move using the mouse, click the left or right mouse button on any colored sticker on any cubie in the view, hold the button down, drag and let go.

When using the left button, the sticker and a whole slice of the cube will move in the direction you indicated. The slice tilts slightly to help you see what will happen when you let go. If you are not happy with that, just move the mouse back to where you started.

If you are using the right button, the mouse pointer sticks to the cube and the whole cube rotates with it until you release the button.

### Using the Keyboard to Move

There are two styles of keyboard moves: XYZ moves, described here, and Singmaster moves, which are described in the section Singmaster Moves.

To move the cube with XYZ, first use key X, Y or Z to select an axis. On the screen, the X axis runs from left to right, the Y axis from bottom to top and the Z axis towards you from behind the screen. Now, to move the whole cube use key C or to move a slice use keys 1 to 6 (to select a slice number).

Finally use the left-arrow key for anti-clockwise rotation and right-arrow for clockwise. The slice that is going to move (numbered 1 to 6) will blink, until you hit an arrow key.

You can make further moves by using one, two or three of the above keys. For example, to move the same slice again, just hit an arrow key.

If you have used the right mouse button to rotate the cube, the meanings of X, Y and Z may have changed, so the cube is automatically realigned, using the Move Realign Cube action, before the keyboard move you have requested can be executed.

### Singmaster Moves

Professor David Singmaster, an English mathematician, was one of the first to investigate Rubik's Cube and its relationship to the branch of mathematics known as Group Theory. In his book, Notes on Rubik's 'Magic Cube', Fifth Edition, published in 1980, he sets out a way of describing sequences of cube moves briefly. Mathematicians call this a notation and Singmaster's Notation is now widely used internationally in books and on websites when discussing problems and solutions in Rubik's Cube puzzles. For example, see the Wikipedia article and its links on the subject of Rubik's Cube.

The &kubrick; program uses a modified form of Singmaster Notation to display all moves, by whatever method they are made, using an area of the toolbar. It also allows moves to be entered from the keyboard in Singmaster Notation. The notation has been modified for use on larger cubes, bricks and mats than the original size 3 cube and to allow convenient entry from the keyboard, without clashing with &kubrick; shortcuts or other actions.

Briefly, Singmaster imagines that you are looking at the cube from slightly above and to the right of it, exactly as in the standard Front View of &kubrick;. You can see three faces at the top, front and right of the cube and these Singmaster has called (in English) Up, Front and Right, or U, F and R for short. The three faces you cannot see, which are on the Back View in &kubrick;, are at the bottom, back and left of the cube and Singmaster calls these (in English) Down, Back and Left, or D, B and L for short. Singmaster uses U and D for the top and bottom faces because B is reserved for the back face.

This is all summarised in the table below: now to the moves. A single letter or keystroke from UFRDBL represents a clockwise move of that face through a right angle (90 degrees) for a square face or through 180 degrees for a rectangular face (as on a brick or mat). Here is where it gets tricky.

Clockwise means clockwise when you are looking directly at that face. That is easy enough with the UFR faces you can see, but the faces you cannot see appear to move anti-clockwise when you use DBL moves. That is because you are looking at them from behind. On &kubrick;'s Back View, the DBL moves will be seen to go clockwise, as expected. Rather than trying to imagine yourself looking at the back of the cube when making DBL moves, it might be easier to think of them going anti-clockwise in the normal Front View.

### Singmaster Notation (Modified)

Key Meaning
- R Right face. In English, R is for Right.
- L Left face. In English, L is for Left.
- U Up or top face. In English, U is for Up.
- D Down or bottom face. In English, D is for Down.
- F Front face. In English, F is for Front.
- B Back face. In English, B is for Back.
- 'Suffix for a reverse or anti-clockwise move. R' is the reverse of R.
- 2 Suffix for double move. R2 rotates R twice.
- +Suffix for two-face move. R+ is RL' in another form.
- -Suffix for anti-two-face move. R- is RL in another form.
- .Prefix for inner-slice move. .R is one step in from the R face.
- C Prefix for whole-cube move. In English, C is for Cube.

Singmaster uses a letter followed by an apostrophe to represent an anti-clockwise or reverse move of a face. Mathematicians would say F' as F prime or F dash and it indicates an anti-clockwise move of the front face.

&kubrick; cannot tell if you are going to type an apostrophe, another letter or some other symbol after a letter, so it will not make a clockwise move of a face immediately after you type the letter. You can force &kubrick; to move by hitting the Return or Enter key. You can also use the space bar and it will leave a space in the display of moves, allowing you to separate groups of moves for readability.

On cubes, bricks or mats of size 3 or more, you might wish to move an inner slice, rather than a face. To do this, type one or more periods or dots before the face letter. For example, ..F moves the slice that is two layers behind the front face and ..B would move the slice two layers in front of the back face, assuming there are 5 or 6 layers that can move. The reverse of those moves would be ..F' and ..B'.

Finally, the C prefix moves the whole cube in the same way as a face. For example, CF moves the cube clockwise along with the front face and CF' moves it anti-clockwise.

If you have previously rotated the cube by hand, using the right mouse button, and you then make a Singmaster or other keyboard move, the cube will be realigned automatically to standard UFR view and some C moves will be generated and displayed. This ensures that you and &kubrick; have the same idea of top, front and right. Similar moves are generated when you use the Move Realign Cube menu item or the Home icon on the toolbar.

## Game Rules, Strategies and Tips

### Rules

There are no rules in &kubrick; other than having to move one slice at a time until all the cubies and their stickers are back in their original positions. No other rules are necessary, because the way the cube is built makes it almost impossible to perform any other moves.

In the original 3x3x3 Rubik's Cube, the inside of the cube contained an ingenious mechanism that made it possible to turn groups of 9 cubies (3x3) called slices, all at once as a group. To make any other moves you had to physically break the cube or take it apart and re-assemble it. The equivalent in &kubrick; would be to change the source program.

### The Complexity of the Puzzle

The outside faces of the cubies have stickers of 6 different colors, one for each of the 6 faces of the main cube. As you rotate the slices, the stickers become shuffled and the faces of the main cube become a jumble of colors. It looks like a simple puzzle, but as you move further away from the starting position, you begin to realise, as one writer put it, that you are like a small child who has let go of a helium balloon only to see it move more and more beyond reach or hope of return.

Mathematicians calculate that a 3x3x3 cube can be shuffled into 43,252,003,274,489,856,000 different patterns, yet they conjecture that all positions can be solved in 20 moves or less. The method that can do that (as yet undiscovered) is called God's Algorithm. Practical methods can take more than 100 moves. As there are 12 face-move possibilities at each step, the chances of solving the cube by trial and error are rather remote. Some cubes have 9-part pictures on the faces and that makes them even more complex, because you then have to get the orientations of the stickers correct as well as the positions.

### Strategies and Tips

&kubrick; shuffles the cube by a pre-selected number of random moves when setting a puzzle. The difficulty depends on how many cubies there are in your cube, how many shuffling moves there are and whether you can view the shuffling moves as they happen.

One kind of puzzle has a small number of shuffling moves (3, 4 or 5) and the idea is to solve the cube in that number of moves (or less). This is fun, challenging and quite quick to play.

Then there is the traditional puzzle, with 10 to 20 or more shuffling moves. The 3x3x3 cube has been very well explored and written about, but other sizes are not so well known and understood.

&kubrick; also has bricks and mats you can play with. Some of them are easier to solve than cubes and could be fun for children too.

Another game you can try is to find pretty patterns for sizes other than 3x3x3.

&kubrick; can be used as a laboratory for studying cubes and finding sequences of solution moves, since all moves can be undone or redone to any degree, either instantaneously or at a selectable speed of animation.

It is also possible to save and restore a partly solved cube at any time and the current state of the cube is automatically saved and restored when you quit and restart &kubrick;.

On a cube with an odd number of cubies per face, the stickers at the centres of the six faces maintain their positions relative to each other, regardless of how you move. You can use those centres as anchors or guide posts for your moves.

The Settings menu has options to turn animations on or off and to vary the speed of animations. These can be useful when trying to follow a sequence of moves and understand what is happening.

If you are in real trouble, &kubrick; has a solve action which appears to show God's Algorithm in animated form then reshuffles the cube. Actually the computer cheats. It remembers the shuffling moves and then just undoes and redoes them.

Another source of ideas is the Demos Solution Moves menu item. One systematic way to solve a cube is to solve the bottom layer first, then the edge cubies in the middle layer and finally the top layer. The demos show sequences of moves on the 3x3x3 cube that will rearrange a few cubies at a time, without messing up parts of the cube you have already solved. One of the demos plays a complete solution of an example cube, using these methods, but it requires over 100 moves.

## Interface Overview

### Menu Items

N Game New Puzzle &Ctrl;N

- Generate a new puzzle of the type currently selected.

&Ctrl;O Game Load Puzzle...

- Load a previously saved puzzle, with all of its dimensions, settings, current state of the cube and history of moves, using a file selection dialog box to locate the required file.

&Shift;U Game Restart Puzzle

- Undo all previous moves and start again.

&Ctrl;S Game Save Puzzle...

- Save the current puzzle, with all of its dimensions, settings, current state of the cube and history of moves, using a file selection dialog box to name a new file if the puzzle has not previously been saved and loaded.

Game Save Puzzle As...

- Save the current puzzle under a new file name, with all of its dimensions, settings, current state of the cube and history of moves, using a file selection dialog box.

Game Choose Puzzle Type

- Choose a type of puzzle to play from a series of sub-menus graded by difficulty, based on cube dimensions and number of shuffling moves, or use sub-menu item Make your own... to create your own puzzle, using a dialog box.

&Ctrl;Q Game Quit

- Quit &kubrick;, automatically saving the current puzzle's dimensions, settings, state of the cube and history of moves.

&Ctrl;Z Move Undo

- Undo a previous move (repeatedly if required).

&Ctrl;&Shift;Z Move Redo

- Redo a previously undone move (repeatedly if required).

&Ctrl;D Move Main Demo

- Start/Stop demo of random puzzle solving on the start page of &kubrick;.

S Move Solve

- Solve the cube. This shows all your moves being undone, then all the shuffling moves being undone and then the shuffling moves being re-done, leaving you set up to have another go at the puzzle.

&Shift;U Move Restart Puzzle

- Undo all previous moves and start again.

&Shift;R Move Redo All

- Redo all previously undone moves.

Home Move Realign Cube

- Adjust the orientation of a rotated cube by the minimum amount needed to make the rotations a combination of 90 degree moves, thus setting the axes parallel to the XYZ axes. In addition, some whole-cube 90 degree moves are inserted in your list of moves to achieve the desired effect.

  This is to standardise the view's perspective so that the top, front and right sides are visible together and keyboard moves become properly meaningful. The inserted moves can be undone and redone, exactly as if you had made them directly yourself.

  For example, if you have used the right mouse-button to turn the cube upside-down, the top or Up (U) face is now what used to be the bottom or Down (D) face and what used to be the Y axis is pointing downwards. In this situation, Move Realign Cube will redefine the faces and axes so that the new top face is known as Up (U) and the Y axis is again the one that points upwards.

View 1 Cube

- Show a view of the front of the cube.

View 2 Cubes

- Show views of the front and back of the cube. Slice moves and rotations can be performed on either picture and the other will move simultaneously.

View 3 Cubes

- Show a large view of the front of the cube and two smaller views of the front and back. Slice moves can be performed on any of the pictures and the others will move simultaneously, but only the large one can be rotated.

&Ctrl;D Demos Main Demo

- Run the Main Demo, in which a cube changes shape, shuffles and solves itself as it rotates at random.

Demos Pretty Patterns

- Show a sub-menu in which pretty patterns on the 3x3x3 cube can be selected and the moves to create them are demonstrated. There is also an Info item that tells you a little more about such patterns.

Demos Solution Moves

- Show a sub-menu in which sequences of moves used to solve the 3x3x3 cube can be selected and the sequences are demonstrated. There is also an Info item that tells you a little more about such solution moves.

W Settings Watch Shuffling

- Show animations of shuffling moves as they occur. This is an aid for beginners, but might be a form of cheating for experienced players.

O Settings Watch Your Own Moves

- Show animations of your own moves as they occur. This is an aid for beginners, because it slows down the animations. Experienced players can turn this option off and moves are then animated at high speed, taking about a tenth of a second to turn 90 degrees.

Settings Configure Toolbars...

- Open a dialog where you can configure the toolbar actions for &kubrick;.

Settings&kubrick; Game Settings

- Open a game settings dialog. See Game Configuration section for more details.

Additionally &kubrick; has the common &kde; Settings and Help menu items, for more information read the sections about the Settings Menu and Help Menu of the &kde; Fundamentals.

## Frequently Asked Questions

How do I pause the game?

&kubrick; does not have a Pause feature, because none is required. If a demo is running, just click anywhere to stop it.

Can I change the way this game looks?

Currently you can change the view, using the View menu, the amount and speed of animation and the bevel on the edges of the cubies, using the Settings menu.

I have made a mistake. Can I undo?

Yes. This is one of the strengths of &kubrick; as compared to a real puzzle. You can undo and redo moves to any level, or undo all moves and start again. To undo and redo moves, use the Move menu or the corresponding keyboard shortcuts and toolbar buttons.

Can I use the keyboard to play this game?

Yes. &kubrick; has keyboard moves based on the X, Y and Z axes and others based on Singmaster notation, which uses one-letter abbreviations for Front, Back, Left, Right, Up and Down faces of the cube.

I cannot figure out what to do here! Are there hints?

No. However, the 3x3x3 Rubik's Cube has been extensively analysed and you can find solution methods on the Internet and in menu item Demos Solution Moves (Info item and demonstrations of moves).

I have to quit the game now. Can I save my position?

Yes. In fact your position is saved automatically when you quit, just as when you put a real cube back on the shelf. You can also save a particular position by using menu item Game Save Puzzle... and the corresponding shortcut keys and toolbar button.

How do I restore the game I saved?

Your automatically saved game is restored automatically when you start &kubrick;. To load other saved games, use Game Load Saved Puzzle... and the corresponding shortcut keys and toolbar button.

Where are the high scores?

&kubrick; does not have such a feature.

## Game Configuration

To open a configuration (settings) dialog use one of the menubar items: Settings&kubrick; Game Settings... or Game Choose Puzzle Type, sub-menu Make Your Own... Only the latter dialog has the options to change the cube dimensions and shuffling difficulty. Below is a list of the options available.

Watch shuffling in progress?

- Provides an animated view of the cube when it is being shuffled by the &kubrick; program. You can select the speed of animation.

Watch your moves in progress?

- Provides an animated view of your own moves at a speed you can select.

Speed of moves:

- Sets the speed at which animations go. The range is 1 to 15 degrees of turn per animation frame.

% of bevel on edges of cubies:

- Sets the percentage of bevelled edge on each cubie, relative to the size of the colored stickers. It affects the overall shape of each cubie. The range is from 4% to 30%.

Cube dimensions:

- Sets the three dimensions of the cube, brick or mat in cubies per side. Dimensions can range from 2x2x1 up to 6x6x6: the larger the dimensions, the harder the puzzle. Only one of the dimensions can be 1, otherwise the puzzle becomes too easy.

Moves per shuffle (difficulty):

- Sets the number of moves the &kubrick; program will use to shuffle the cube. The number can range from 0 to 50: the more moves, the harder the puzzle. 2, 3 or 4 shuffling moves make for relatively easy puzzles, especially if the shuffling moves can be watched.

  Selecting zero moves can be useful if you wish to experiment with different sequences of moves and what they do to the cube, such as when you are searching for pretty patterns or new solving moves.

## Credits and License

&kubrick; is Copyright 2008 Ian Wadham ianw@netspace.net.au

&kubrick; was inspired by Professor Erno Rubik's famous Rubik's Cube puzzle.

The programming is original work in C++ but owes several good ideas to the Rubik XScreensaver, a C program by Marcelo Vianna, and GNUbik, a C program by John M. Darrington.

Documentation Copyright 2008 Ian Wadham ianw@netspace.net.au

&underFDL; &underGPL;
&documentation.index;