hcube: Virtual Rubik's cube of arbitrary size.

[ bsd3, game, library, program ] [ Propose Tags ] [ Report a vulnerability ]

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.


[Skip to Readme]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.1.0, 0.1.1
Dependencies base (>=3 && <5), directory (>=1.1.0.1), HaskellForMaths (>=0.4.5), QuickCheck (>=2.5.1.1), text (>=0.11.2.3) [details]
License BSD-3-Clause
Copyright Copyright 2012
Author Todd Wegner
Maintainer Todd Wegner
Category Game
Uploaded by ToddWegner at 2013-05-20T09:42:40Z
Distributions
Reverse Dependencies 1 direct, 0 indirect [details]
Executables hcube
Downloads 1994 total (2 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs uploaded by user
Build status unknown [no reports yet]

Readme for hcube-0.1.1

[back to package description]
----------------------------------------------------------------------------
-- 
--             :  hcube
-- Copyright   :  (c) Todd Wegner 2012
-- License     :  BSD-style (see the LICENSE file)
-- 
-- 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.

Loading a physical Cube state :
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.
2) Add undo.
3) Add sequence macros.
4) Extend to 4x4x4 and 5x5x5.