# hcube: Virtual Rubik's cube of arbitrary size.

[ bsd3, game, library, program ] [ Propose Tags ]

Provides virtual model of NxNxN Rubik's cube and console visualization for 2x2x2, 3x3x3 ,4x4x4, and 5x5x5. Console visualization is choosen in the interest of portability. Virtual cube can be constructed from the state of a physical cube. Support for a two phase algorithm will be given in a future release for cubes of size 3x3x3 to find the smallest number of moves which solve the cube. The Rubik's cube exhibits many non-trival aspects of group theory. The package comes with an executable "hcube". Refer to the README file for details.

Versions 0.1.0, 0.1.1 base (>=3 && <5), directory (>=1.1.0.1), HaskellForMaths (>=0.4.5), QuickCheck (>=2.5.1.1), text (>=0.11.2.3) [details] BSD-3-Clause Copyright 2012 Todd Wegner Todd Wegner Game by ToddWegner at Mon May 20 09:42:40 UTC 2013 NixOS:0.1.1 hcube 910 total (7 in the last 30 days) (no votes yet) [estimated by rule of succession] λ λ λ Docs uploaded by userBuild status unknown Hackage Matrix CI

## Modules

[Index]

• HCube

#### Maintainer's Corner

For package maintainers and hackage trustees

[back to package description]
----------------------------------------------------------------------------
--
--             :  hcube
-- Copyright   :  (c) Todd Wegner 2012
--
-- Maintainer  :  echbar137@yahoo.co.in
-- Stability   :  provisional
-- Portability :  portable
--
-----------------------------------------------------------------------------

Command line arguments for hcube :

./hcube 2	Loads the 2x2x2 cube state.
./hcube 3	Loads the 3x3x3 cube state.
./hcube 4	Loads the 4x4x4 cube state.
./hcube 5	Loads the 5x5x5 cube state.
./hcube		Loads the 3x3x3 cube state.
./hcube <name of physical cube file> Creates cube based on physical file.

Cube is created in a solved state if no previous state for that dimension exists.
Although the library supports cubes of arbitrary size, the hcube executable does not
support sizes beyond 5x5x5.

The state of cube is stored in the 'store' directory with a name based on the dimension
of the cube.  For example a 3x3x3 cube is saved as 'solved/3x3x3'.

If the 'solve' directory does not exist it is created.

Physical file must be placed in the 'store' directory.

Sample contents of a physical file for a 3x3x3 cube is :

[(UpS,    [White,Green,Yellow,Green,White,Green,Red,White,Green]),
(FrontS, [Blue,Blue,White,Yellow,Orange,Yellow,Red,Yellow,White]),
(DownS,  [Yellow,Blue,Green,White,Yellow,Blue,White,Orange,Green]),
(BackS,  [Orange,Blue,Orange,Yellow,Red,Red,Red,Orange,Blue]),
(LeftS,  [Orange,White,Yellow,Red,Green,Red,Orange,Red,Red]),
(RightS, [Blue,Green,Blue,Orange,Blue,White,Green,Orange,Yellow])]

This is a list of six tuples, corresponding to one for each six side of a cube.
A tuple consists of the cube side followed by a list of colors appearing on that cube side.
The tuples can be in any order, however it is easier to use the order given, rotating the cube
about the Left and Right axis to identify the colors of four of the sides.
The order of the colors appear in the list is important and is given by the following diagram :

1  2  3  Right     1  2  3  Up            1  2  3  Left
4  5  6  Side      4  5  6  Side          4  5  6  Side
7  8  9            7  8  9                7  8  9

1  2  3  Front
4  5  6  Side
7  8  9

1  2  3  Down
4  5  6  Side
7  8  9

1  2  3  Back
4  5  6  Side
7  8  9

Console commands for hcube :

help   displays command list
l1+    rotate layer 1 clockwise
l2-    rotate layer 2 counter
h3+    rotate horizontal slab 3 clockwise
h1-    rotate horizontal slab 1 counter
v2+    rotate vertical slab 2 clockwise
v3-    rotate vertical slab 3 counter
l      left side view
r      right side view
r+     rotate whole cube clockwise 90 degrees (z axis)
r-     rotate whole cube counter clockwise 90 degrees (z axis)
r2     rotate whole cube 180 degrees
fh     flip whole cube over along horizontal axis
fv     flip whole cube over along vertical axis
u      undo last cube operation

History :
0.1.0	Inital release.
0.1.1	hcube is able to physical cube from a file.

To Do :
1) Add two phase algorithm to solve 3x3x3 cube in minumal number of moves.