An interactive, graphic magic cube program.
gnubik [window_system_options] [-hvs] [-z n[,m[,p]]] [-a m]
This is a program which displays a 3 dimensional image of a magic cube, as introduced to the world by its Hungarian inventor, Erno Rubik. The user rotates the blocks of the cube, and attempts to solve the puzzle, by moving all the blocks to their correct positions and orientations, resulting in a cube with a single colour on each face.
The user interacts with the program in the following ways:
The viewing position may be altered using the arrow keys or by using the mouse. The left and right arrow keys rotate the cube about the vertical axis. The up and down keys rotate the cube about the horizontal axis. Holding down the shift key whilst pressing the left and right arrow keys rotates the cube about the z axis.
To rotate the cube using the mouse, hold down button 1 and move the mouse anywhere on the window. If your mouse has a scroll wheel, you can use this to rotate the cube about the z axis.
Rotations are performed using the mouse. To manipulate the cube, place the mouse cursor on a square in the cube, against the edge facing the direction you want to move, and click button 1.
The mouse cursor will indicate the direction of rotation.
The following options may be specified on the command line at invocation.
-z n,m,p
Draws a cube of size n x m x p, where n,m and p are positive. The default size is 3 x 3 x 3.
-a m
When rotating parts of the cube, show m intermediate positions. The default for this value is 2. Setting to a higher value, will give smoother animations, but will result in a slower program.
-s
Starts with the cube already solved. By default, it starts in a random position.
-h
Display a help message and exit.
-v
Display version number and then exit.
The code for gnubik is written in C and Scheme. It uses the Mesa/OpenGL graphics library, and the Gtk+ library and Guile. As such, it should be easy to generate a version for any system complying with these standards.
The rendering process is slower than it could be, since display lists aren't currently used. The entire image is re-rendered, during each refresh, regardless of which components have changed their appearance.
Copyright (C) 1998, 2011 John Darrington.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.