Revision d8862934
Added by Leszek Koltunski about 3 years ago
src/main/java/org/distorted/solvers/SolverMain.java | ||
---|---|---|
101 | 101 |
} |
102 | 102 |
} |
103 | 103 |
|
104 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
105 |
|
|
106 |
private int mapCubitToFace(int cubit, int face) |
|
107 |
{ |
|
108 |
if( cubit<8 ) return face; |
|
109 |
if( cubit>19) return 4; |
|
110 |
|
|
111 |
switch(face) |
|
112 |
{ |
|
113 |
case 0: return cubit==15 || cubit==18 ? 3 : 5; |
|
114 |
case 1: return cubit==13 || cubit==16 ? 3 : 5; |
|
115 |
case 2: return cubit==10 ? 5 : 3; |
|
116 |
case 3: return cubit== 8 ? 3 : 5; |
|
117 |
case 4: return cubit== 9 ? 3 : 5; |
|
118 |
case 5: return cubit== 8 ? 5 : 3; |
|
119 |
} |
|
120 |
|
|
121 |
return -1; |
|
122 |
} |
|
123 |
|
|
104 | 124 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
105 | 125 |
// order: Up --> Right --> Front --> Down --> Left --> Back |
106 | 126 |
// (because the first implemented Solver - the two-phase Cube3 one - expects such order) |
... | ... | |
130 | 150 |
|
131 | 151 |
for(int i=0; i<9; i++) |
132 | 152 |
{ |
133 |
int color = mObject.getCubitFaceColorIndex(U_INDEX[i], i==4 ? F : U); |
|
153 |
int face = mapCubitToFace(U_INDEX[i],U); |
|
154 |
int color = mObject.getCubitFaceColorIndex(U_INDEX[i], face); |
|
134 | 155 |
objectString.append(FACE_NAMES[color]); |
135 | 156 |
} |
136 | 157 |
for(int i=0; i<9; i++) |
137 | 158 |
{ |
138 |
int color = mObject.getCubitFaceColorIndex(R_INDEX[i], i==4 ? F : R); |
|
159 |
int face = mapCubitToFace(R_INDEX[i],R); |
|
160 |
int color = mObject.getCubitFaceColorIndex(R_INDEX[i], face); |
|
139 | 161 |
objectString.append(FACE_NAMES[color]); |
140 | 162 |
} |
141 | 163 |
for(int i=0; i<9; i++) |
142 | 164 |
{ |
143 |
int color = mObject.getCubitFaceColorIndex(F_INDEX[i], i==4 ? F : F); |
|
165 |
int face = mapCubitToFace(F_INDEX[i],F); |
|
166 |
int color = mObject.getCubitFaceColorIndex(F_INDEX[i], face); |
|
144 | 167 |
objectString.append(FACE_NAMES[color]); |
145 | 168 |
} |
146 | 169 |
for(int i=0; i<9; i++) |
147 | 170 |
{ |
148 |
int color = mObject.getCubitFaceColorIndex(D_INDEX[i], i==4 ? F : D); |
|
171 |
int face = mapCubitToFace(D_INDEX[i],D); |
|
172 |
int color = mObject.getCubitFaceColorIndex(D_INDEX[i], face); |
|
149 | 173 |
objectString.append(FACE_NAMES[color]); |
150 | 174 |
} |
151 | 175 |
for(int i=0; i<9; i++) |
152 | 176 |
{ |
153 |
int color = mObject.getCubitFaceColorIndex(L_INDEX[i], i==4 ? F : L); |
|
177 |
int face = mapCubitToFace(L_INDEX[i],L); |
|
178 |
int color = mObject.getCubitFaceColorIndex(L_INDEX[i], face); |
|
154 | 179 |
objectString.append(FACE_NAMES[color]); |
155 | 180 |
} |
156 | 181 |
for(int i=0; i<9; i++) |
157 | 182 |
{ |
158 |
int color = mObject.getCubitFaceColorIndex(B_INDEX[i], i==4 ? F : B); |
|
183 |
int face = mapCubitToFace(B_INDEX[i],B); |
|
184 |
int color = mObject.getCubitFaceColorIndex(B_INDEX[i], face); |
|
159 | 185 |
objectString.append(FACE_NAMES[color]); |
160 | 186 |
} |
161 | 187 |
|
Also available in: Unified diff
Fix the solver (after rearranging the faces of the cuboids)