Debian Codegraph @

dietz/mcube/mcube.h

raw symbols SCIP
1 /*
2 * mcube.h v 20051216
3 * 4x4x4 Rubik's Cube Solver class (c) 2005 by Eric Dietz
4 * notes: readme.txt email: [email protected]
5 */
6
7 #ifndef _MCUBE_H_
8 #define _MCUBE_H_cxx . . $ `dietz/mcube/mcube.h:8:9`!
9
10 // includes
11 #include <string>
12 // namespace
13 using namespace std;
14
15 // defines
16
17 // mcube class declaration
18 class mcubecxx . . $ mcube#
19 {
20 public:
21 mcubecxx . . $ mcube#mcube(49f6e7a06ebc5aa8).(); // constructor
22 virtual ~cxx . . $ mcube#`~mcube`(ced63f7c635d850d).mcubecxx . . $ mcube#(); // destructor
23 static const char* versioncxx . . $ mcube#version.; // version string
24 static const int Ncxx . . $ mcube#N.=4; // cube size (NxNxN)
25 static const int MOVcxx . . $ mcube#MOV.=11; // number of move groups
26 static int numcubescxx . . $ mcube#numcubes.; // number of instantiated cubes
27 const bool operatorcxx . . $ mcube#`operator==`(57c16b97a841aa3a).==(const mcubecxx . . $ mcube# &q);// overloaded == comparison
28 const bool operatorcxx . . $ mcube#`operator!=`(57c16b97a841aa3a).!=(const mcubecxx . . $ mcube# &q);// overloaded != comparison
29 int *facecxx . . $ mcube#face(c989fc4ff283468d).(int x, int y, int z); // pointer to cube array
30 const void renderscreencxx . . $ mcube#renderscreen(70bbdaa4655ac679).(); // display cube diagram
31 const bool issolvedcxx . . $ mcube#issolved(b1128d3f2e1d5907).(); // return solvedness of cube
32 const void resetcubecxx . . $ mcube#resetcube(70bbdaa4655ac679).(); // reset the cube
33 void copytempcxx . . $ mcube#copytemp(79e3e40fddeb9278).(int c[Ncxx . . $ mcube#N.+2][Ncxx . . $ mcube#N.+2][Ncxx . . $ mcube#N.+2], int t[Ncxx . . $ mcube#N.+2][Ncxx . . $ mcube#N.+2][Ncxx . . $ mcube#N.+2]); // temporary copier function
34 const void slice_lcxx . . $ mcube#slice_l(a4480c1149c95c8d).(int s); // rotate given slice left
35 const void slice_rcxx . . $ mcube#slice_r(a4480c1149c95c8d).(int s); // rotate given slice right
36 const void slice_ucxx . . $ mcube#slice_u(a4480c1149c95c8d).(int s); // rotate given slice up
37 const void slice_dcxx . . $ mcube#slice_d(a4480c1149c95c8d).(int s); // rotate given slice down
38 const void slice_ccxx . . $ mcube#slice_c(a4480c1149c95c8d).(int s); // rotate given slice clockwise
39 const void slice_acxx . . $ mcube#slice_a(a4480c1149c95c8d).(int s); // rotate given slice counterclockwise
40 const void ULcxx . . $ mcube#UL(70bbdaa4655ac679).(); // rotate top slice left
41 const void URcxx . . $ mcube#UR(70bbdaa4655ac679).(); // rotate top slice right
42 const void DLcxx . . $ mcube#DL(70bbdaa4655ac679).(); // rotate bottom slice left
43 const void DRcxx . . $ mcube#DR(70bbdaa4655ac679).(); // rotate bottom slice right
44 const void LUcxx . . $ mcube#LU(70bbdaa4655ac679).(); // rotate left slice up
45 const void LDcxx . . $ mcube#LD(70bbdaa4655ac679).(); // rotate left slice down
46 const void RUcxx . . $ mcube#RU(70bbdaa4655ac679).(); // rotate right slice up
47 const void RDcxx . . $ mcube#RD(70bbdaa4655ac679).(); // rotate right slice down
48 const void FCcxx . . $ mcube#FC(70bbdaa4655ac679).(); // rotate front slice clockwise
49 const void FAcxx . . $ mcube#FA(70bbdaa4655ac679).(); // rotate front slice counterclockwise
50 const void BCcxx . . $ mcube#BC(70bbdaa4655ac679).(); // rotate rear slice clockwise (from front view)
51 const void BAcxx . . $ mcube#BA(70bbdaa4655ac679).(); // rotate rear slice counterclockwise (from front view)
52 const void uLcxx . . $ mcube#uL(70bbdaa4655ac679).(); // rotate inner top slice left
53 const void uRcxx . . $ mcube#uR(70bbdaa4655ac679).(); // rotate inner top slice right
54 const void dLcxx . . $ mcube#dL(70bbdaa4655ac679).(); // rotate inner bottom slice left
55 const void dRcxx . . $ mcube#dR(70bbdaa4655ac679).(); // rotate inner bottom slice right
56 const void lUcxx . . $ mcube#lU(70bbdaa4655ac679).(); // rotate inner left slice up
57 const void lDcxx . . $ mcube#lD(70bbdaa4655ac679).(); // rotate inner left slice down
58 const void rUcxx . . $ mcube#rU(70bbdaa4655ac679).(); // rotate inner right slice up
59 const void rDcxx . . $ mcube#rD(70bbdaa4655ac679).(); // rotate inner right slice down
60 const void fCcxx . . $ mcube#fC(70bbdaa4655ac679).(); // rotate inner front slice clockwise
61 const void fAcxx . . $ mcube#fA(70bbdaa4655ac679).(); // rotate inner front slice counterclockwise
62 const void bCcxx . . $ mcube#bC(70bbdaa4655ac679).(); // rotate inner rear slice clockwise (from front view)
63 const void bAcxx . . $ mcube#bA(70bbdaa4655ac679).(); // rotate inner rear slice counterclockwise (from front view)
64 const void CLcxx . . $ mcube#CL(70bbdaa4655ac679).(); // rotate whole cube left
65 const void CRcxx . . $ mcube#CR(70bbdaa4655ac679).(); // rotate whole cube right
66 const void CUcxx . . $ mcube#CU(70bbdaa4655ac679).(); // rotate whole cube up
67 const void CDcxx . . $ mcube#CD(70bbdaa4655ac679).(); // rotate whole cube down
68 const void CCcxx . . $ mcube#CC(70bbdaa4655ac679).(); // rotate whole cube clockwise
69 const void CAcxx . . $ mcube#CA(70bbdaa4655ac679).(); // rotate whole cube counterclockwise
70 const void U2cxx . . $ mcube#U2(70bbdaa4655ac679).(); // rotate top slice twice
71 const void D2cxx . . $ mcube#D2(70bbdaa4655ac679).(); // rotate bottom slice twice
72 const void L2cxx . . $ mcube#L2(70bbdaa4655ac679).(); // rotate left slice twice
73 const void R2cxx . . $ mcube#R2(70bbdaa4655ac679).(); // rotate right slice twice
74 const void F2cxx . . $ mcube#F2(70bbdaa4655ac679).(); // rotate front slice twice
75 const void B2cxx . . $ mcube#B2(70bbdaa4655ac679).(); // rotate rear slice twice
76 const void u2cxx . . $ mcube#u2(70bbdaa4655ac679).(); // rotate inner top slice twice
77 const void d2cxx . . $ mcube#d2(70bbdaa4655ac679).(); // rotate inner bottom slice twice
78 const void l2cxx . . $ mcube#l2(70bbdaa4655ac679).(); // rotate inner left slice twice
79 const void r2cxx . . $ mcube#r2(70bbdaa4655ac679).(); // rotate inner right slice twice
80 const void f2cxx . . $ mcube#f2(70bbdaa4655ac679).(); // rotate inner front slice twice
81 const void b2cxx . . $ mcube#b2(70bbdaa4655ac679).(); // rotate inner rear slice twice
82 const void scramblecubecxx . . $ mcube#scramblecube(70bbdaa4655ac679).(); // scramble the cube
83 const void domovescxx . . $ mcube#domoves(d1d478eb837e006d).(stringcxx . . $ std/string# s); // do a series of moves
84 const void dosolutioncxx . . $ mcube#dosolution(70bbdaa4655ac679).(); // execute solution
85 const int findcenter_ucxx . . $ mcube#findcenter_u(646a28ba8d60b002).(int a); // find given center on top
86 const int findcenter_dcxx . . $ mcube#findcenter_d(646a28ba8d60b002).(int a); // find given center on bottom
87 const int findcenter_lcxx . . $ mcube#findcenter_l(646a28ba8d60b002).(int a); // find given center on left
88 const int findcenter_rcxx . . $ mcube#findcenter_r(646a28ba8d60b002).(int a); // find given center on right
89 const int findcenter_fcxx . . $ mcube#findcenter_f(646a28ba8d60b002).(int a); // find given center on front
90 const int findcenter_bcxx . . $ mcube#findcenter_b(646a28ba8d60b002).(int a); // find given center on back
91 const int findcenter_not_ucxx . . $ mcube#findcenter_not_u(646a28ba8d60b002).(int a); // find given center not on top
92 const int findcenter_not_dcxx . . $ mcube#findcenter_not_d(646a28ba8d60b002).(int a); // find given center not on bottom
93 const int findcenter_not_lcxx . . $ mcube#findcenter_not_l(646a28ba8d60b002).(int a); // find given center not on left
94 const int findcenter_not_rcxx . . $ mcube#findcenter_not_r(646a28ba8d60b002).(int a); // find given center not on right
95 const int findcenter_not_fcxx . . $ mcube#findcenter_not_f(646a28ba8d60b002).(int a); // find given center not on front
96 const int findcenter_not_bcxx . . $ mcube#findcenter_not_b(646a28ba8d60b002).(int a); // find given center not on back
97 const int findcentercxx . . $ mcube#findcenter(646a28ba8d60b002).(int a); // find given center
98 const int find_not_center_ucxx . . $ mcube#find_not_center_u(646a28ba8d60b002).(int a); // find free center on top
99 const int find_not_center_dcxx . . $ mcube#find_not_center_d(646a28ba8d60b002).(int a); // find free center on bottom
100 const int find_not_center_lcxx . . $ mcube#find_not_center_l(646a28ba8d60b002).(int a); // find free center on left
101 const int find_not_center_rcxx . . $ mcube#find_not_center_r(646a28ba8d60b002).(int a); // find free center on right
102 const int find_not_center_fcxx . . $ mcube#find_not_center_f(646a28ba8d60b002).(int a); // find free center on front
103 const int find_not_center_bcxx . . $ mcube#find_not_center_b(646a28ba8d60b002).(int a); // find free center on back
104 const int findedge_lcxx . . $ mcube#findedge_l(294a6a4d43d7c739).(int a, int b); // find given left edge
105 const int findedge_rcxx . . $ mcube#findedge_r(294a6a4d43d7c739).(int a, int b); // find given right edge
106 const int findedgecxx . . $ mcube#findedge(294a6a4d43d7c739).(int a, int b); // find given edge
107 const int findcorner_ccxx . . $ mcube#findcorner_c(8e0e7a84f9d0a2a4).(int a, int b, int c); // find given corner in clockwise order
108 const int findcorner_acxx . . $ mcube#findcorner_a(8e0e7a84f9d0a2a4).(int a, int b, int c); // find given corner in counterclockwise order
109 const int findcornercxx . . $ mcube#findcorner(8e0e7a84f9d0a2a4).(int a, int b, int c); // find given corner
110 static const stringcxx . . $ std/string# std_to_metrcxx . . $ mcube#std_to_metr(39dc6b708eba1f06).(stringcxx . . $ std/string# s); // convert standard string to metric
111 static const stringcxx . . $ std/string# metr_to_stdcxx . . $ mcube#metr_to_std(39dc6b708eba1f06).(stringcxx . . $ std/string# s); // convert metric string to standard
112 static const stringcxx . . $ std/string# std_to_relcxx . . $ mcube#std_to_rel(39dc6b708eba1f06).(stringcxx . . $ std/string# s); // convert standard string to relative
113 static const stringcxx . . $ std/string# rel_to_stdcxx . . $ mcube#rel_to_std(39dc6b708eba1f06).(stringcxx . . $ std/string# s); // convert relative string to standard
114 static const stringcxx . . $ std/string# metr_to_relcxx . . $ mcube#metr_to_rel(39dc6b708eba1f06).(stringcxx . . $ std/string# s); // convert metric string to relative
115 static const stringcxx . . $ std/string# rel_to_metrcxx . . $ mcube#rel_to_metr(39dc6b708eba1f06).(stringcxx . . $ std/string# s); // convert relative string to metric
116 const stringcxx . . $ std/string# usehalfturnscxx . . $ mcube#usehalfturns(4f4d75843c23ed88).(stringcxx . . $ std/string# s, int b); // allow the use of the half turn
117 const stringcxx . . $ std/string# concisecxx . . $ mcube#concise(4f4d75843c23ed88).(stringcxx . . $ std/string# s, int b); // remove redundancies from solution
118 const void shortenmovcxx . . $ mcube#shortenmov(a4480c1149c95c8d).(int m); // shorten mov[]
119 const int solvecubecxx . . $ mcube#solvecube(a7a41534e65e842).(); // solve the cube
120 int cubecxx . . $ mcube#cube.[Ncxx . . $ mcube#N.+2][Ncxx . . $ mcube#N.+2][Ncxx . . $ mcube#N.+2]; // cube array
121 int fxcxx . . $ mcube#fx., fycxx . . $ mcube#fy., fzcxx . . $ mcube#fz.; // coordinates for find* functions
122 int shortencxx . . $ mcube#shorten.; // how short to make the solution
123 bool initedcxx . . $ mcube#inited.; // whether the cube is inited
124 int movcxx . . $ mcube#mov.[MOVcxx . . $ mcube#MOV.+1]; // number of moves in solution
125 int ervalcxx . . $ mcube#erval.; // possible error values
126 int warnvalcxx . . $ mcube#warnval.; // possible warning values
127 stringcxx . . $ std/string# solutioncxx . . $ mcube#solution.; // solution string
128 static const int NEGXcxx . . $ mcube#NEGX.=-1; // negative x axis
129 static const int POSXcxx . . $ mcube#POSX.=1; // positive x axis
130 static const int NEGYcxx . . $ mcube#NEGY.=-2; // negative y axis
131 static const int POSYcxx . . $ mcube#POSY.=2; // positive y axis
132 static const int NEGZcxx . . $ mcube#NEGZ.=-3; // negative z axis
133 static const int POSZcxx . . $ mcube#POSZ.=3; // positive z axis
134 static const int ERR_NOTINITEDcxx . . $ mcube#ERR_NOTINITED.=1; // cube not inited
135 static const int ERR_MISPAINTEDcxx . . $ mcube#ERR_MISPAINTED.=2; // not all cubelets present
136 static const int ERR_NONDESCRIPTcxx . . $ mcube#ERR_NONDESCRIPT.=3; // unknown error
137 static const int ERR_PARITY_EDGE_FLIPcxx . . $ mcube#ERR_PARITY_EDGE_FLIP.=4; // edge flip parity
138 static const int ERR_PARITY_CORNER_ROTATIONcxx . . $ mcube#ERR_PARITY_CORNER_ROTATION.=5;// corner rotation parity
139 static const int ERR_PARITY_CORNER_BACKWARDcxx . . $ mcube#ERR_PARITY_CORNER_BACKWARD.=6;// corner backward parity
140 static const int ERR_PARITY_CENTER_SWAPcxx . . $ mcube#ERR_PARITY_CENTER_SWAP.=7; // center swap parity
141 static const int SHORTEN_NONEcxx . . $ mcube#SHORTEN_NONE.=0; // no condensing
142 static const int SHORTEN_STRIP_SOMEcxx . . $ mcube#SHORTEN_STRIP_SOME.=1; // strip some
143 static const int SHORTEN_STRIP_ALLcxx . . $ mcube#SHORTEN_STRIP_ALL.=2; // strip all
144 static const int SHORTEN_STRIP_ROTATE_SOMEcxx . . $ mcube#SHORTEN_STRIP_ROTATE_SOME.=3; // strip and rotate some
145 static const int SHORTEN_STRIP_ROTATE_ALLcxx . . $ mcube#SHORTEN_STRIP_ROTATE_ALL.=4; // strip and rotate all
146 static const int ITER_THRESHOLDcxx . . $ mcube#ITER_THRESHOLD.=10; // iterative error threshold
147 protected:
148 private:
149 const stringcxx . . $ std/string# findsolutioncxx . . $ mcube#findsolution(f5c680baeeb2c589).(); // find a solution for a prepared cube
150 };
151
152 // macros
153 #define DOMOVEScxx . . $ `dietz/mcube/mcube.h:153:9`!(a, b) domoves(b); a += b // for those of you who like to do DOMOVES(a, "UL.LU.");
154 #define GETEDGE_Lcxx . . $ `dietz/mcube/mcube.h:154:9`!(a,b,x,y,z,f) f = findedge_l(a, b); x = fx; y = fy; z = fz // don't ask
155 #define GETEDGE_Rcxx . . $ `dietz/mcube/mcube.h:155:9`!(a,b,x,y,z,f) f = findedge_r(a, b); x = fx; y = fy; z = fz // yeah
156 #define GETCORNER_Ccxx . . $ `dietz/mcube/mcube.h:156:9`!(a,b,c,x,y,z,f) f = findcorner_c(a, b, c); x = fx; y = fy; z = fz // more...
157 #define GETCORNER_Acxx . . $ `dietz/mcube/mcube.h:157:9`!(a,b,c,x,y,z,f) f = findcorner_a(a, b, c); x = fx; y = fy; z = fz // ...
158
159 // end of mcube class declaration
160
161 #endif /* _MCUBE_H_ */
162
163 //