1 /*
2  * cubex.h
3  * Cubex by Eric Dietz (c) 2003
4  * Cube Puzzle and Universal Solver.
5  * Notes: readme.txt  Email: root@wrongway.org
6  * NOTE: This program is unaffiliated with the Rubik's Cube Trademark.
7  * This program MAY NOT be reproduced or modified outside the licensing terms
8  * set forth in the readme.
9  */
10 
11 #ifndef _CUBEX_H_
12 #define _CUBEX_H_
13 
14 // required includes/namespace
15 #include <string>
16 // gcc 4.3 needs cstdlib for rand() to compile
17 #include <cstdlib>
18 using namespace std;
19 
20 // Class declaration - class members/methods, some encapsulated
21 class Cubex
22 {
23 public:
24   Cubex();
25   virtual ~Cubex();
26   static int numcubes;
27   const static char* ver;
28   const static char* author;
29   const static int N = 3; // <-- size of the cube (NxNxN)
30   const static int MOV = 8;
31   const bool operator==(const Cubex &q);
32   const bool operator!=(const Cubex &q);
33   int *face(int x, int y, int z);
34   const void RenderScreen();
35   const bool IsSolved();
36   const void ResetCube();
37   const bool XML(int a, bool n);
38   const bool XMR(int a, bool n);
39   const bool XMU(int a, bool n);
40   const bool XMD(int a, bool n);
41   const bool XMC(int a, bool n);
42   const bool XMA(int a, bool n);
43   const void UL();
44   const void UR();
45   const void DL();
46   const void DR();
47   const void LU();
48   const void LD();
49   const void RU();
50   const void RD();
51   const void FC();
52   const void FA();
53   const void BC();
54   const void BA();
55   const void ML();
56   const void MR();
57   const void MU();
58   const void MD();
59   const void MC();
60   const void MA();
61   const void CL();
62   const void CR();
63   const void CU();
64   const void CD();
65   const void CC();
66   const void CA();
67   const void XCL();
68   const void XCR();
69   const void XCU();
70   const void XCD();
71   const void XCC();
72   const void XCA();
73   const void ScrambleCube();
74   const void DoSolution();
75   const int SolveCube();
76   int Cub[N+2][N+2][N+2];
77   bool shorten;
78   bool cubeinit;
79   int cenfix;
80   int mov[MOV+1];
81   int erval;
82   string solution;
83   const int FindCent(int a);
84   const int FindEdge(int a, int b);
85   const int FindCorn(int a, int b, int c);
86   const string Concise(string a);
87   const string Efficient(string a);
88   int fx;
89   int fy;
90   int fz;
91 protected:
92 private:
93   const void Ctemp();
94   const string TopEdges();
95   const string TopCorners();
96   const string MiddleEdges();
97   const string BottomEdgesOrient();
98   const string BottomEdgesPosition();
99   const string BottomCornersPosition();
100   const string BottomCornersOrient();
101   const string CentersRotate();
102   int Tmp[N+2][N+2][N+2];
103 };
104 // end of header
105 
106 #endif /* _CUBEX_H_ */
107 
108 // many of the routines have been generalized for NxNxN, with a few exceptions,
109 // mainly to accomadate the CentersRotate feature.
110