Revision 7dbbda72
Added by Leszek Koltunski almost 2 years ago
src/main/java/org/distorted/solvers/SolverCube3.java | ||
---|---|---|
190 | 190 |
{ |
191 | 191 |
case '1': result = mRes.getString(R.string.solver_cube3_error1); break; |
192 | 192 |
case '2': result = mRes.getString(R.string.solver_cube3_error2); break; |
193 |
case '3': result = mRes.getString(R.string.solver_cube3_error3); break;
|
|
193 |
case '3': result = mRes.getString(R.string.solver_generic_edge_twist); break;
|
|
194 | 194 |
case '4': result = mRes.getString(R.string.solver_cube3_error4); break; |
195 | 195 |
case '5': result = mRes.getString(R.string.solver_generic_corner_twist); break; |
196 | 196 |
case '6': result = mRes.getString(R.string.solver_cube3_error6); break; |
src/main/java/org/distorted/solvers/SolverMain.java | ||
---|---|---|
91 | 91 |
SolverTablebase solver = new SolverCuboid232(mRes,mObject); |
92 | 92 |
solver.solve(screen); |
93 | 93 |
} |
94 |
else if( mSignature==ObjectSignatures.PYRA_3 ) |
|
95 |
{ |
|
96 |
SolverTablebase solver = new SolverPyraminx(mRes,mObject); |
|
97 |
solver.solve(screen); |
|
98 |
} |
|
94 | 99 |
else |
95 | 100 |
{ |
96 | 101 |
screen.displayErrorDialog(mRes.getString(R.string.solver_generic_not_implemented)); |
src/main/java/org/distorted/solvers/SolverPyraminx.java | ||
---|---|---|
1 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
2 |
// Copyright 2023 Leszek Koltunski // |
|
3 |
// // |
|
4 |
// This file is part of Magic Cube. // |
|
5 |
// // |
|
6 |
// Magic Cube is proprietary software licensed under an EULA which you should have received // |
|
7 |
// along with the code. If not, check https://distorted.org/magic/License-Magic-Cube.html // |
|
8 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
9 |
|
|
10 |
package org.distorted.solvers; |
|
11 |
|
|
12 |
import android.content.res.Resources; |
|
13 |
|
|
14 |
import org.distorted.main.R; |
|
15 |
import org.distorted.objectlib.main.ObjectType; |
|
16 |
import org.distorted.objectlib.main.TwistyObject; |
|
17 |
import org.distorted.objectlib.tablebases.ImplementedTablebasesList; |
|
18 |
import org.distorted.objectlib.tablebases.TablebasesAbstract; |
|
19 |
|
|
20 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
21 |
|
|
22 |
public class SolverPyraminx extends SolverTablebase |
|
23 |
{ |
|
24 |
private static final int ERROR_CORNER_GYB_MISSING = -1; |
|
25 |
private static final int ERROR_CORNER_GYR_MISSING = -2; |
|
26 |
private static final int ERROR_CORNER_GBR_MISSING = -3; |
|
27 |
private static final int ERROR_CORNER_YBR_MISSING = -4; |
|
28 |
|
|
29 |
private static final int ERROR_VERTEX_GYB_MISSING = -5; |
|
30 |
private static final int ERROR_VERTEX_GYR_MISSING = -6; |
|
31 |
private static final int ERROR_VERTEX_GBR_MISSING = -7; |
|
32 |
private static final int ERROR_VERTEX_YBR_MISSING = -8; |
|
33 |
|
|
34 |
private static final int ERROR_EDGE_RB_MISSING = -9; |
|
35 |
private static final int ERROR_EDGE_RY_MISSING = -10; |
|
36 |
private static final int ERROR_EDGE_RG_MISSING = -11; |
|
37 |
private static final int ERROR_EDGE_YB_MISSING = -12; |
|
38 |
private static final int ERROR_EDGE_GB_MISSING = -13; |
|
39 |
private static final int ERROR_EDGE_GY_MISSING = -14; |
|
40 |
|
|
41 |
private static final int ERROR_CORNERS_CANNOT = -15; |
|
42 |
private static final int ERROR_VERTICES_CANNOT = -16; |
|
43 |
private static final int ERROR_CORNER_TWISTED = -17; |
|
44 |
private static final int ERROR_EDGE_TWISTED = -18; |
|
45 |
private static final int ERROR_C_V_DONT_MATCH = -19; |
|
46 |
|
|
47 |
TablebasesAbstract mSolver; |
|
48 |
|
|
49 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
50 |
|
|
51 |
private boolean pieceEqual3(int[] piece, int c1, int c2, int c3) |
|
52 |
{ |
|
53 |
return ( (piece[0]==c1 && piece[1]==c2 && piece[2]==c3) || |
|
54 |
(piece[0]==c1 && piece[2]==c2 && piece[1]==c3) || |
|
55 |
(piece[1]==c1 && piece[0]==c2 && piece[2]==c3) || |
|
56 |
(piece[1]==c1 && piece[2]==c2 && piece[0]==c3) || |
|
57 |
(piece[2]==c1 && piece[1]==c2 && piece[0]==c3) || |
|
58 |
(piece[2]==c1 && piece[0]==c2 && piece[1]==c3) ); |
|
59 |
} |
|
60 |
|
|
61 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
62 |
|
|
63 |
private boolean pieceEqual2(int[] piece, int c1, int c2) |
|
64 |
{ |
|
65 |
return ( (piece[0]==c1 && piece[1]==c2) || |
|
66 |
(piece[0]==c2 && piece[1]==c1) ); |
|
67 |
} |
|
68 |
|
|
69 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
70 |
|
|
71 |
private int checkAllCornersPresent(int[][] corners) |
|
72 |
{ |
|
73 |
boolean ybr = false; |
|
74 |
boolean gbr = false; |
|
75 |
boolean gyr = false; |
|
76 |
boolean gyb = false; |
|
77 |
|
|
78 |
for(int i=0; i<4; i++) |
|
79 |
{ |
|
80 |
if( pieceEqual3(corners[i],0,1,2) ) gyb = true; |
|
81 |
if( pieceEqual3(corners[i],0,1,3) ) gyr = true; |
|
82 |
if( pieceEqual3(corners[i],0,2,3) ) gbr = true; |
|
83 |
if( pieceEqual3(corners[i],1,2,3) ) ybr = true; |
|
84 |
} |
|
85 |
|
|
86 |
if( !ybr ) return ERROR_CORNER_YBR_MISSING; |
|
87 |
if( !gbr ) return ERROR_CORNER_GBR_MISSING; |
|
88 |
if( !gyr ) return ERROR_CORNER_GYR_MISSING; |
|
89 |
if( !gyb ) return ERROR_CORNER_GYB_MISSING; |
|
90 |
|
|
91 |
return 0; |
|
92 |
} |
|
93 |
|
|
94 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
95 |
|
|
96 |
private int checkAllVerticesPresent(int[][] vertex) |
|
97 |
{ |
|
98 |
boolean ybr = false; |
|
99 |
boolean gbr = false; |
|
100 |
boolean gyr = false; |
|
101 |
boolean gyb = false; |
|
102 |
|
|
103 |
for(int i=0; i<4; i++) |
|
104 |
{ |
|
105 |
if( pieceEqual3(vertex[i],0,1,2) ) gyb = true; |
|
106 |
if( pieceEqual3(vertex[i],0,1,3) ) gyr = true; |
|
107 |
if( pieceEqual3(vertex[i],0,2,3) ) gbr = true; |
|
108 |
if( pieceEqual3(vertex[i],1,2,3) ) ybr = true; |
|
109 |
} |
|
110 |
|
|
111 |
if( !ybr ) return ERROR_VERTEX_YBR_MISSING; |
|
112 |
if( !gbr ) return ERROR_VERTEX_GBR_MISSING; |
|
113 |
if( !gyr ) return ERROR_VERTEX_GYR_MISSING; |
|
114 |
if( !gyb ) return ERROR_VERTEX_GYB_MISSING; |
|
115 |
|
|
116 |
return 0; |
|
117 |
} |
|
118 |
|
|
119 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
120 |
|
|
121 |
private int checkAllEdgesPresent(int[][] edges) |
|
122 |
{ |
|
123 |
boolean rb = false; |
|
124 |
boolean ry = false; |
|
125 |
boolean rg = false; |
|
126 |
boolean yb = false; |
|
127 |
boolean gb = false; |
|
128 |
boolean gy = false; |
|
129 |
|
|
130 |
for(int i=0; i<6; i++) |
|
131 |
{ |
|
132 |
if( pieceEqual2(edges[i],3,2) ) rb = true; |
|
133 |
if( pieceEqual2(edges[i],3,1) ) ry = true; |
|
134 |
if( pieceEqual2(edges[i],3,0) ) rg = true; |
|
135 |
if( pieceEqual2(edges[i],2,1) ) yb = true; |
|
136 |
if( pieceEqual2(edges[i],2,0) ) gb = true; |
|
137 |
if( pieceEqual2(edges[i],1,0) ) gy = true; |
|
138 |
} |
|
139 |
|
|
140 |
if( !rb ) return ERROR_EDGE_RB_MISSING; |
|
141 |
if( !ry ) return ERROR_EDGE_RY_MISSING; |
|
142 |
if( !rg ) return ERROR_EDGE_RG_MISSING; |
|
143 |
if( !yb ) return ERROR_EDGE_YB_MISSING; |
|
144 |
if( !gb ) return ERROR_EDGE_GB_MISSING; |
|
145 |
if( !gy ) return ERROR_EDGE_GY_MISSING; |
|
146 |
|
|
147 |
return 0; |
|
148 |
} |
|
149 |
|
|
150 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
151 |
|
|
152 |
private int[] computeFaceColors(int[][] corners) |
|
153 |
{ |
|
154 |
int[] ret = new int[4]; |
|
155 |
|
|
156 |
for(int i=0; i<4; i++) |
|
157 |
for(int j=0; j<4; j++) |
|
158 |
if( corners[i][0]!=j && corners[i][1]!=j && corners[i][2]!=j ) ret[i]=j; |
|
159 |
|
|
160 |
return ret; |
|
161 |
} |
|
162 |
|
|
163 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
164 |
|
|
165 |
private int checkAgreement(int[] faces1, int[] faces2) |
|
166 |
{ |
|
167 |
for(int i=0; i<4; i++) |
|
168 |
if( faces1[i]!=faces2[i] ) return ERROR_C_V_DONT_MATCH; |
|
169 |
|
|
170 |
return 0; |
|
171 |
} |
|
172 |
|
|
173 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
174 |
|
|
175 |
private int computePieceTwist(int index, int[] corner, int[] faceColor) |
|
176 |
{ |
|
177 |
int twist1=0, twist2=0, twist3=0; |
|
178 |
|
|
179 |
switch(index) |
|
180 |
{ |
|
181 |
case 0: if( corner[1]==faceColor[1] ) twist1=1; |
|
182 |
if( corner[2]==faceColor[1] ) twist1=2; |
|
183 |
if( corner[0]==faceColor[2] ) twist2=2; |
|
184 |
if( corner[2]==faceColor[2] ) twist2=1; |
|
185 |
if( corner[0]==faceColor[3] ) twist3=1; |
|
186 |
if( corner[1]==faceColor[3] ) twist3=2; |
|
187 |
break; |
|
188 |
case 1: if( corner[1]==faceColor[0] ) twist1=1; |
|
189 |
if( corner[2]==faceColor[0] ) twist1=2; |
|
190 |
if( corner[0]==faceColor[2] ) twist2=1; |
|
191 |
if( corner[1]==faceColor[2] ) twist2=2; |
|
192 |
if( corner[0]==faceColor[3] ) twist3=2; |
|
193 |
if( corner[2]==faceColor[3] ) twist3=1; |
|
194 |
break; |
|
195 |
case 2: if( corner[1]==faceColor[0] ) twist1=1; |
|
196 |
if( corner[2]==faceColor[0] ) twist1=2; |
|
197 |
if( corner[0]==faceColor[1] ) twist2=2; |
|
198 |
if( corner[2]==faceColor[1] ) twist2=1; |
|
199 |
if( corner[0]==faceColor[3] ) twist3=1; |
|
200 |
if( corner[1]==faceColor[3] ) twist3=2; |
|
201 |
break; |
|
202 |
case 3: if( corner[1]==faceColor[0] ) twist1=1; |
|
203 |
if( corner[2]==faceColor[0] ) twist1=2; |
|
204 |
if( corner[0]==faceColor[1] ) twist2=1; |
|
205 |
if( corner[1]==faceColor[1] ) twist2=2; |
|
206 |
if( corner[0]==faceColor[2] ) twist3=2; |
|
207 |
if( corner[2]==faceColor[2] ) twist3=1; |
|
208 |
break; |
|
209 |
} |
|
210 |
|
|
211 |
return ( twist1!=twist2 || twist1!=twist3 ) ? -1 : twist1; |
|
212 |
} |
|
213 |
|
|
214 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
215 |
|
|
216 |
public SolverPyraminx(Resources res, TwistyObject object) |
|
217 |
{ |
|
218 |
super(res,object); |
|
219 |
} |
|
220 |
|
|
221 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
222 |
|
|
223 |
private void getCorners(TwistyObject object, int[][] corners) |
|
224 |
{ |
|
225 |
corners[0][0] = object.getCubitFaceStickerIndex(6,3); // R |
|
226 |
corners[0][1] = object.getCubitFaceStickerIndex(6,2); // B |
|
227 |
corners[0][2] = object.getCubitFaceStickerIndex(6,1); // Y |
|
228 |
|
|
229 |
corners[1][0] = object.getCubitFaceStickerIndex(4,3); // R |
|
230 |
corners[1][1] = object.getCubitFaceStickerIndex(4,0); // G |
|
231 |
corners[1][2] = object.getCubitFaceStickerIndex(4,2); // B |
|
232 |
|
|
233 |
corners[2][0] = object.getCubitFaceStickerIndex(13,3); // R |
|
234 |
corners[2][1] = object.getCubitFaceStickerIndex(13,1); // Y |
|
235 |
corners[2][2] = object.getCubitFaceStickerIndex(13,0); // G |
|
236 |
|
|
237 |
corners[3][0] = object.getCubitFaceStickerIndex(11,0); // G |
|
238 |
corners[3][1] = object.getCubitFaceStickerIndex(11,1); // Y |
|
239 |
corners[3][2] = object.getCubitFaceStickerIndex(11,2); // B |
|
240 |
} |
|
241 |
|
|
242 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
243 |
|
|
244 |
private void getVertices(TwistyObject object, int[][] vertex) |
|
245 |
{ |
|
246 |
vertex[0][0] = object.getCubitFaceStickerIndex(1,5); // R |
|
247 |
vertex[0][1] = object.getCubitFaceStickerIndex(1,7); // B |
|
248 |
vertex[0][2] = object.getCubitFaceStickerIndex(1,2); // Y |
|
249 |
|
|
250 |
vertex[1][0] = object.getCubitFaceStickerIndex(0,5); // R |
|
251 |
vertex[1][1] = object.getCubitFaceStickerIndex(0,0); // G |
|
252 |
vertex[1][2] = object.getCubitFaceStickerIndex(0,7); // B |
|
253 |
|
|
254 |
vertex[2][0] = object.getCubitFaceStickerIndex(3,5); // R |
|
255 |
vertex[2][1] = object.getCubitFaceStickerIndex(3,2); // Y |
|
256 |
vertex[2][2] = object.getCubitFaceStickerIndex(3,0); // G |
|
257 |
|
|
258 |
vertex[3][0] = object.getCubitFaceStickerIndex(2,0); // G |
|
259 |
vertex[3][1] = object.getCubitFaceStickerIndex(2,2); // Y |
|
260 |
vertex[3][2] = object.getCubitFaceStickerIndex(2,7); // B |
|
261 |
} |
|
262 |
|
|
263 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
264 |
|
|
265 |
private void getEdges(TwistyObject object, int[][] edges) |
|
266 |
{ |
|
267 |
edges[0][0] = object.getCubitFaceStickerIndex(5,3); // R |
|
268 |
edges[0][1] = object.getCubitFaceStickerIndex(5,2); // B |
|
269 |
|
|
270 |
edges[1][0] = object.getCubitFaceStickerIndex(10,3); // R |
|
271 |
edges[1][1] = object.getCubitFaceStickerIndex(10,1); // Y |
|
272 |
|
|
273 |
edges[2][0] = object.getCubitFaceStickerIndex(9,3); // R |
|
274 |
edges[2][1] = object.getCubitFaceStickerIndex(9,0); // G |
|
275 |
|
|
276 |
edges[3][0] = object.getCubitFaceStickerIndex(8,1); // Y |
|
277 |
edges[3][1] = object.getCubitFaceStickerIndex(8,2); // B |
|
278 |
|
|
279 |
edges[4][0] = object.getCubitFaceStickerIndex(7,0); // G |
|
280 |
edges[4][1] = object.getCubitFaceStickerIndex(7,2); // B |
|
281 |
|
|
282 |
edges[5][0] = object.getCubitFaceStickerIndex(12,0); // G |
|
283 |
edges[5][1] = object.getCubitFaceStickerIndex(12,1); // Y |
|
284 |
} |
|
285 |
|
|
286 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
287 |
|
|
288 |
public int tablebaseIndex(TwistyObject object) |
|
289 |
{ |
|
290 |
int[][] corners = new int[4][3]; |
|
291 |
int[][] edges = new int[6][2]; |
|
292 |
int[][] vertices= new int[4][3]; |
|
293 |
int[] corner_twist = new int[4]; |
|
294 |
int[] vertex_twist = new int[4]; |
|
295 |
|
|
296 |
getCorners(object,corners); |
|
297 |
getVertices(object,vertices); |
|
298 |
getEdges(object,edges); |
|
299 |
|
|
300 |
int result1 = checkAllCornersPresent(corners); |
|
301 |
if( result1<0 ) return result1; |
|
302 |
|
|
303 |
int result2 = checkAllVerticesPresent(vertices); |
|
304 |
if( result2<0 ) return result2; |
|
305 |
|
|
306 |
int result3 = checkAllEdgesPresent(edges); |
|
307 |
if( result3<0 ) return result3; |
|
308 |
|
|
309 |
int[] faces1 = computeFaceColors(corners); |
|
310 |
int[] faces2 = computeFaceColors(vertices); |
|
311 |
|
|
312 |
int result4 = checkAgreement(faces1,faces2); |
|
313 |
if( result4<0 ) return result4; |
|
314 |
|
|
315 |
for(int i=0; i<4; i++) |
|
316 |
{ |
|
317 |
corner_twist[i] = computePieceTwist(i,corners[i],faces1); |
|
318 |
if( corner_twist[i]<0 ) return ERROR_CORNERS_CANNOT; |
|
319 |
} |
|
320 |
|
|
321 |
for(int i=0; i<4; i++) |
|
322 |
{ |
|
323 |
vertex_twist[i] = computePieceTwist(i,vertices[i],faces1); |
|
324 |
if( vertex_twist[i]<0 ) return ERROR_VERTICES_CANNOT; |
|
325 |
} |
|
326 |
|
|
327 |
return 0; |
|
328 |
} |
|
329 |
|
|
330 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
331 |
|
|
332 |
private int getColorIndex3(int color) |
|
333 |
{ |
|
334 |
switch(color) |
|
335 |
{ |
|
336 |
case 0: return R.string.color_green3; |
|
337 |
case 1: return R.string.color_yellow3; |
|
338 |
case 2: return R.string.color_blue3; |
|
339 |
case 3: return R.string.color_red3; |
|
340 |
} |
|
341 |
|
|
342 |
return -1; |
|
343 |
} |
|
344 |
|
|
345 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
346 |
|
|
347 |
private int getColorIndex4(int color) |
|
348 |
{ |
|
349 |
switch(color) |
|
350 |
{ |
|
351 |
case 0: return R.string.color_green4; |
|
352 |
case 1: return R.string.color_yellow4; |
|
353 |
case 2: return R.string.color_blue4; |
|
354 |
case 3: return R.string.color_red4; |
|
355 |
} |
|
356 |
|
|
357 |
return -1; |
|
358 |
} |
|
359 |
|
|
360 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
361 |
|
|
362 |
private int getColorIndex6(int color) |
|
363 |
{ |
|
364 |
switch(color) |
|
365 |
{ |
|
366 |
case 0: return R.string.color_green6; |
|
367 |
case 1: return R.string.color_yellow6; |
|
368 |
case 2: return R.string.color_blue6; |
|
369 |
case 3: return R.string.color_red6; |
|
370 |
} |
|
371 |
|
|
372 |
return -1; |
|
373 |
} |
|
374 |
|
|
375 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
376 |
|
|
377 |
private String cornerError(Resources res, int color0, int color1, int color2) |
|
378 |
{ |
|
379 |
int j0 = getColorIndex3(color0); |
|
380 |
int j1 = getColorIndex3(color1); |
|
381 |
int j2 = getColorIndex4(color2); |
|
382 |
|
|
383 |
String c0 = res.getString(j0); |
|
384 |
String c1 = res.getString(j1); |
|
385 |
String c2 = res.getString(j2); |
|
386 |
|
|
387 |
return res.getString(R.string.solver_generic_missing_corner,c0,c1,c2); |
|
388 |
} |
|
389 |
|
|
390 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
391 |
|
|
392 |
private String vertexError(Resources res, int color0, int color1, int color2) |
|
393 |
{ |
|
394 |
int j0 = getColorIndex3(color0); |
|
395 |
int j1 = getColorIndex3(color1); |
|
396 |
int j2 = getColorIndex4(color2); |
|
397 |
|
|
398 |
String c0 = res.getString(j0); |
|
399 |
String c1 = res.getString(j1); |
|
400 |
String c2 = res.getString(j2); |
|
401 |
|
|
402 |
return res.getString(R.string.solver_generic_missing_vertex,c0,c1,c2); |
|
403 |
} |
|
404 |
|
|
405 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
406 |
|
|
407 |
private String edgeError(Resources res, int color0, int color1) |
|
408 |
{ |
|
409 |
int j0 = getColorIndex3(color0); |
|
410 |
int j1 = getColorIndex6(color1); |
|
411 |
|
|
412 |
String c0 = res.getString(j0); |
|
413 |
String c1 = res.getString(j1); |
|
414 |
|
|
415 |
return res.getString(R.string.solver_generic_missing_edge,c0,c1); |
|
416 |
} |
|
417 |
|
|
418 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
419 |
|
|
420 |
public String error(int index, Resources res) |
|
421 |
{ |
|
422 |
switch(index) |
|
423 |
{ |
|
424 |
case ERROR_CORNER_YBR_MISSING: return cornerError(res,3,2,1); |
|
425 |
case ERROR_CORNER_GBR_MISSING: return cornerError(res,3,2,0); |
|
426 |
case ERROR_CORNER_GYR_MISSING: return cornerError(res,3,1,0); |
|
427 |
case ERROR_CORNER_GYB_MISSING: return cornerError(res,2,1,0); |
|
428 |
case ERROR_VERTEX_YBR_MISSING: return vertexError(res,3,2,1); |
|
429 |
case ERROR_VERTEX_GBR_MISSING: return vertexError(res,3,2,0); |
|
430 |
case ERROR_VERTEX_GYR_MISSING: return vertexError(res,3,1,0); |
|
431 |
case ERROR_VERTEX_GYB_MISSING: return vertexError(res,2,1,0); |
|
432 |
case ERROR_EDGE_RB_MISSING : return edgeError(res,3,2); |
|
433 |
case ERROR_EDGE_RY_MISSING : return edgeError(res,3,1); |
|
434 |
case ERROR_EDGE_RG_MISSING : return edgeError(res,3,0); |
|
435 |
case ERROR_EDGE_YB_MISSING : return edgeError(res,2,1); |
|
436 |
case ERROR_EDGE_GB_MISSING : return edgeError(res,2,0); |
|
437 |
case ERROR_EDGE_GY_MISSING : return edgeError(res,1,0); |
|
438 |
case ERROR_CORNER_TWISTED : return res.getString(R.string.solver_generic_corner_twist); |
|
439 |
case ERROR_EDGE_TWISTED : return res.getString(R.string.solver_generic_edge_twist); |
|
440 |
case ERROR_CORNERS_CANNOT : return res.getString(R.string.solver_generic_corners_cannot); |
|
441 |
case ERROR_VERTICES_CANNOT : return res.getString(R.string.solver_generic_vertices_cannot); |
|
442 |
case ERROR_C_V_DONT_MATCH : return res.getString(R.string.solver_generic_c_v_dont_match); |
|
443 |
|
|
444 |
} |
|
445 |
|
|
446 |
return null; |
|
447 |
} |
|
448 |
|
|
449 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
450 |
|
|
451 |
public int[][] solution(int index, Resources res) |
|
452 |
{ |
|
453 |
if( mSolver==null ) |
|
454 |
{ |
|
455 |
//mSolver = ImplementedTablebasesList.createPacked(res,ObjectType.PYRA_3); |
|
456 |
mSolver = ImplementedTablebasesList.createUnpacked(ObjectType.PYRA_3); |
|
457 |
if( mSolver!=null ) mSolver.createTablebase(); |
|
458 |
} |
|
459 |
|
|
460 |
return mSolver!=null ? mSolver.solution(index) : null; |
|
461 |
} |
|
462 |
} |
|
463 |
|
src/main/res/values-de/strings.xml | ||
---|---|---|
85 | 85 |
<string name="solver_generic_two_centers">Zwei Zentren müssen ausgetauscht werden!</string> |
86 | 86 |
<string name="solver_generic_missing_center">Die %1$s Mitte fehlt!</string> |
87 | 87 |
<string name="solver_generic_missing_corner">Die %1$s-%2$s-%3$s Ecke fehlt!</string> |
88 |
<string name="solver_generic_missing_vertex">Der %1$s-%2$s-%3$s Oktaeder fehlt!</string> |
|
88 | 89 |
<string name="solver_generic_missing_edge">Die %1$s-%2$s Kante fehlt!</string> |
89 |
<string name="solver_generic_corners_cannot">Ecken können nicht verdreht werden, sodass alle Flächen einfarbig sind!</string> |
|
90 |
<string name="solver_generic_corners_cannot">Ecken können nicht verdreht werden, sodass alle Seiten einfarbig sind!</string> |
|
91 |
<string name="solver_generic_vertices_cannot">Oktaederstücke können nicht so verdreht werden, sodass alle Seiten einfarbig sind!</string> |
|
90 | 92 |
|
91 | 93 |
<string name="solver_cube3_error1">Es gibt nur %1$d %2$s Facelets.</string> |
92 | 94 |
<string name="solver_cube3_error2">Nicht alle 12 Kanten gibt es genau einmal!</string> |
93 |
<string name="solver_cube3_error3">Eine Kante muss umgedreht werden!</string> |
|
94 | 95 |
<string name="solver_cube3_error4">Nicht alle 8 Ecken gibt es genau einmal!</string> |
95 | 96 |
<string name="solver_cube3_error6">Zwei Ecken oder zwei Kanten müssen ausgetauscht werden!</string> |
96 | 97 |
<string name="solver_cube3_error7">Für die angegebene maximale Zugzahl gibt es keine Lösung!</string> |
src/main/res/values-es/strings.xml | ||
---|---|---|
85 | 85 |
<string name="solver_generic_two_centers">¡Hay que cambiar dos centros!</string> |
86 | 86 |
<string name="solver_generic_missing_center">¡Falta el centro %1$s!</string> |
87 | 87 |
<string name="solver_generic_missing_corner">¡Falta la esquina %1$s-%2$s-%3$s!</string> |
88 |
<string name="solver_generic_missing_vertex">¡Falta el octaedro %1$s-%2$s-%3$s!</string> |
|
88 | 89 |
<string name="solver_generic_missing_edge">¡Falta la pieza del borde %1$s-%2$s!</string> |
89 | 90 |
<string name="solver_generic_corners_cannot">¡Las esquinas no se pueden torcer para que todos los lados sean monocromáticos!</string> |
91 |
<string name="solver_generic_vertices_cannot">¡Las piezas del octaedro no se pueden torcer para que todos los lados sean monocromáticos!</string> |
|
90 | 92 |
|
91 | 93 |
<string name="solver_cube3_error1">Solo hay %1$d facetas %2$s.</string> |
92 | 94 |
<string name="solver_cube3_error2">¡No todos los 12 bordes existen exactamente una vez!</string> |
93 |
<string name="solver_cube3_error3">¡Un borde tiene que voltearse!</string> |
|
94 | 95 |
<string name="solver_cube3_error4">¡No todas las 8 esquinas existen exactamente una vez!</string> |
95 | 96 |
<string name="solver_cube3_error6">¡Hay que cambiar dos esquinas o dos bordes!</string> |
96 | 97 |
<string name="solver_cube3_error7">¡No existe una solución para el número de movimientos máximos dado!</string> |
src/main/res/values-fr/strings.xml | ||
---|---|---|
85 | 85 |
<string name="solver_generic_two_centers">Deux centres doivent être échangés !</string> |
86 | 86 |
<string name="solver_generic_missing_center">Centre %1$s manquant !</string> |
87 | 87 |
<string name="solver_generic_missing_corner">Coin %1$s-%2$s-%3$s manquant !</string> |
88 |
<string name="solver_generic_missing_vertex">L\'octaèdre %1$s-%2$s-%3$s manque !</string> |
|
88 | 89 |
<string name="solver_generic_missing_edge">La pièce de bordure %1$s-%2$s manque!</string> |
89 | 90 |
<string name="solver_generic_corners_cannot">Les coins ne peuvent pas être tordus afin que tous les côtés soient monochromes !</string> |
91 |
<string name="solver_generic_vertices_cannot">Les pièces d\'octaèdre ne peuvent pas être tordues afin que tous les côtés soient monochromes !</string> |
|
90 | 92 |
|
91 | 93 |
<string name="solver_cube3_error1">Il n\'y a que %1$d facettes %2$s.</string> |
92 | 94 |
<string name="solver_cube3_error2">Les 12 arêtes n\'existent pas exactement une fois !</string> |
93 |
<string name="solver_cube3_error3">Une arête doit être inversée !</string> |
|
94 | 95 |
<string name="solver_cube3_error4">Les 8 coins n\'existent pas tous une seule fois !</string> |
95 | 96 |
<string name="solver_cube3_error6">Deux coins ou deux arêtes doivent être échangés !</string> |
96 | 97 |
<string name="solver_cube3_error7">Aucune solution n\'existe pour le nombre maximum de coups donné !</string> |
src/main/res/values-ja/strings.xml | ||
---|---|---|
85 | 85 |
<string name="solver_generic_edge_twist">片方の端をひねる必要がある!</string> |
86 | 86 |
<string name="solver_generic_two_centers">2つのセンターを交換しなければならない!</string> |
87 | 87 |
<string name="solver_generic_missing_center">%1$sのセンターが欠けてる!</string> |
88 |
<string name="solver_generic_missing_corner">%1$s%2$s%3$sのコーナーがない!</string> |
|
88 |
<string name="solver_generic_missing_corner">%1$s%2$s%3$sのコーナーがない!</string> |
|
89 |
<string name="solver_generic_missing_vertex">%1$s-%2$s-%3$s八面体がありません!</string> |
|
89 | 90 |
<string name="solver_generic_missing_edge">%1$s%2$sボーダーピースはありません!</string> |
90 | 91 |
<string name="solver_generic_corners_cannot">すべての面がモノクロになるようにコーナーをねじることはできません。</string> |
92 |
<string name="solver_generic_vertices_cannot">すべての面が単色になるように、八面体のピースをねじることはできません。</string> |
|
91 | 93 |
|
92 | 94 |
<string name="solver_cube3_error1">%2$s小顔は%1$dつだけ</string> |
93 | 95 |
<string name="solver_cube3_error2">12 のエッジすべてが 存在するわけではありません。</string> |
94 |
<string name="solver_cube3_error3">1 つのエッジを反転する必要があります!</string> |
|
95 | 96 |
<string name="solver_cube3_error4">8 つのコーナーすべてが存在するわけではありません!</string> |
96 | 97 |
<string name="solver_cube3_error6">2 つのコーナーまたは 2 つのエッジを交換する必要があります!</string> |
97 | 98 |
<string name="solver_cube3_error7">指定された最大移動数の解答はありません!</string> |
src/main/res/values-ko/strings.xml | ||
---|---|---|
85 | 85 |
<string name="solver_generic_two_centers">두 개의 센터를 교환해야 합니다!</string> |
86 | 86 |
<string name="solver_generic_missing_center">%1$s 중앙이 사라졌습니다!</string> |
87 | 87 |
<string name="solver_generic_missing_corner">%1$s-%2$s-%3$s 모서리 금지!</string> |
88 |
<string name="solver_generic_missing_vertex">%1$s-%2$s-%3$s 팔면체가 없습니다!</string> |
|
88 | 89 |
<string name="solver_generic_missing_edge">%1$s%2$s테두리 조각이 없습니다!</string> |
89 | 90 |
<string name="solver_generic_corners_cannot">모든면이 단색이되도록 모서리를 비틀 수 없습니다!</string> |
91 |
<string name="solver_generic_vertices_cannot">정팔면체 조각은 뒤틀릴 수 없어 모든 면이 단색입니다!</string> |
|
90 | 92 |
|
91 | 93 |
<string name="solver_cube3_error1">%2$s작은 얼굴은 %1$d개뿐입니다.</string> |
92 | 94 |
<string name="solver_cube3_error2">12개의 가장자리 모두가 정확하게 한 번 존재하지 않습니다!</string> |
93 |
<string name="solver_cube3_error3">한쪽 가장자리를 뒤집어야 합니다!</string> |
|
94 | 95 |
<string name="solver_cube3_error4">8개의 모서리 모두가 정확하게 한 번 존재하지 않습니다!</string> |
95 | 96 |
<string name="solver_cube3_error6">두 모서리 또는 두 가장자리를 교환해야합니다!</string> |
96 | 97 |
<string name="solver_cube3_error7">지정된 최대 이동 수에 대한 해답이 없습니다!</string> |
src/main/res/values-pl/strings.xml | ||
---|---|---|
85 | 85 |
<string name="solver_generic_two_centers">Dwa środki muszą być wymienione!</string> |
86 | 86 |
<string name="solver_generic_missing_center">Brakuje %1$s środka!</string> |
87 | 87 |
<string name="solver_generic_missing_corner">Brakuje %1$s-%2$s-%3$s rogu!</string> |
88 |
<string name="solver_generic_missing_vertex">Brakuje %1$s-%2$s-%3$s ośmiokątu!</string> |
|
88 | 89 |
<string name="solver_generic_missing_edge">Brakuje %1$s-%2$s krawędzi!</string> |
89 | 90 |
<string name="solver_generic_corners_cannot">Narożników nie można skręcić tak, aby wszystkie boki były monochromatyczne!</string> |
91 |
<string name="solver_generic_vertices_cannot">Części ośmiościennych nie można skręcić tak, aby wszystkie boki były monochromatyczne!</string> |
|
90 | 92 |
|
91 | 93 |
<string name="solver_cube3_error1">Jest tylko %1$d %2$s ścian.</string> |
92 | 94 |
<string name="solver_cube3_error2">Któraś z 12 krawędzi nie istnieje!</string> |
93 |
<string name="solver_cube3_error3">Jedna z krawędzi musi być odwrócona!</string> |
|
94 | 95 |
<string name="solver_cube3_error4">Jeden z 8 rogów nie istnieje!</string> |
95 | 96 |
<string name="solver_cube3_error6">Dwa rogi albo dwie krawędzie muszą byc obrócone!</string> |
96 | 97 |
<string name="solver_cube3_error7">Rozwiązanie nie zostało znalezione!</string> |
src/main/res/values-ru/strings.xml | ||
---|---|---|
85 | 85 |
<string name="solver_generic_two_centers">Два центра должны быть обменены!</string> |
86 | 86 |
<string name="solver_generic_missing_center">Нет %1$s центра!</string> |
87 | 87 |
<string name="solver_generic_missing_corner">Нет %1$s-%2$s-%3$s угла!</string> |
88 |
<string name="solver_generic_missing_vertex">Нет %1$s-%2$s-%3$s октаэдра!</string> |
|
88 | 89 |
<string name="solver_generic_missing_edge">Нет %1$s-%2$s края!</string> |
89 | 90 |
<string name="solver_generic_corners_cannot">Углы нельзя скручивать так, чтобы все стороны были однотонными!</string> |
91 |
<string name="solver_generic_vertices_cannot">Кусочки октаэдра нельзя скрутить так, чтобы все стороны были одноцветными!</string> |
|
90 | 92 |
|
91 | 93 |
<string name="solver_cube3_error1">Всего %1$d %2$s граней!</string> |
92 | 94 |
<string name="solver_cube3_error2">Не все 12 ребер существуют в единичном экземпляре!</string> |
93 |
<string name="solver_cube3_error3">Надо перевернуть одно ребро!</string> |
|
94 | 95 |
<string name="solver_cube3_error4">Не все 8 углов существуют в единичном экземпляре!</string> |
95 | 96 |
<string name="solver_cube3_error6">Надо поменять местами два угла или два ребра!</string> |
96 | 97 |
<string name="solver_cube3_error7">Не существует решения для данного максимального числа ходов!</string> |
src/main/res/values-zh-rCN/strings.xml | ||
---|---|---|
91 | 91 |
<string name="solver_generic_two_centers">必须要交换两个中心!</string> |
92 | 92 |
<string name="solver_generic_missing_center">%1$s中心不見了!</string> |
93 | 93 |
<string name="solver_generic_missing_corner">没有%1$s-%2$s-%3$s的角落!</string> |
94 |
<string name="solver_generic_missing_vertex">没有%1$s-%2$s-%3$s八面体!</string> |
|
94 | 95 |
<string name="solver_generic_missing_edge">没有1$s-%2$s边!</string> |
95 | 96 |
<string name="solver_generic_corners_cannot">角不能扭曲,这样所有的面都是单色的!</string> |
97 |
<string name="solver_generic_vertices_cannot">八面体块不能扭曲,所以所有面都是单色的!</string> |
|
96 | 98 |
|
97 | 99 |
<string name="solver_cube3_error1">只有%1$d个%2$s小面</string> |
98 | 100 |
<string name="solver_cube3_error2">并非所有12条边都只存在一次!</string> |
99 |
<string name="solver_cube3_error3">一条边需要翻转!</string> |
|
100 | 101 |
<string name="solver_cube3_error4">并非所有8个角都只存在一次!</string> |
101 | 102 |
<string name="solver_cube3_error6">两个角或两条边需要交换!</string> |
102 | 103 |
<string name="solver_cube3_error7">对于给定的最大移动数,没有解决方案!</string> |
src/main/res/values-zh-rTW/strings.xml | ||
---|---|---|
85 | 85 |
<string name="solver_generic_two_centers">兩個中鋒要互換!</string> |
86 | 86 |
<string name="solver_generic_missing_center">%1$s的中心不见了!</string> |
87 | 87 |
<string name="solver_generic_missing_corner">沒有%1$s-%2$s-%3$s的角落!</string> |
88 |
<string name="solver_generic_missing_vertex">沒有%1$s-%2$s-%3$s八面體!</string> |
|
88 | 89 |
<string name="solver_generic_missing_edge">沒有1$s-%2$s邊!</string> |
89 | 90 |
<string name="solver_generic_corners_cannot">角不能扭曲,這樣所有的面都是單色的!</string> |
91 |
<string name="solver_generic_vertices_cannot">八面體塊不能扭曲,所以所有面都是單色的!</string> |
|
90 | 92 |
|
91 | 93 |
<string name="solver_cube3_error1">只有%1$d個%2$s小臉</string> |
92 | 94 |
<string name="solver_cube3_error2">並非所有12條邊都只存在一次!</string> |
93 |
<string name="solver_cube3_error3">一條邊需要翻轉!</string> |
|
94 | 95 |
<string name="solver_cube3_error4">並非所有8個角都只存在一次!</string> |
95 | 96 |
<string name="solver_cube3_error6">兩個角或兩條邊需要交换!</string> |
96 | 97 |
<string name="solver_cube3_error7">對於给定的最大移動數,没有解决方案!</string> |
src/main/res/values/strings.xml | ||
---|---|---|
105 | 105 |
<string name="solver_generic_two_centers">Two centers have to be exchanged!</string> |
106 | 106 |
<string name="solver_generic_missing_center">The %1$s center is missing!</string> |
107 | 107 |
<string name="solver_generic_missing_corner">The %1$s-%2$s-%3$s corner is missing!</string> |
108 |
<string name="solver_generic_missing_vertex">The %1$s-%2$s-%3$s octahedron piece is missing!</string> |
|
108 | 109 |
<string name="solver_generic_missing_edge">The %1$s-%2$s edge is missing!</string> |
109 | 110 |
<string name="solver_generic_corners_cannot">Corners cannot be twisted so that all faces are monochromatic!</string> |
111 |
<string name="solver_generic_vertices_cannot">Octahedron pieces cannot be twisted so that all faces are monochromatic!</string> |
|
110 | 112 |
|
111 | 113 |
<string name="solver_cube3_error1">There are only %1$d %2$s facelets.</string> |
112 | 114 |
<string name="solver_cube3_error2">Not all 12 edges exist exactly once!</string> |
113 |
<string name="solver_cube3_error3">One edge has to be flipped!</string> |
|
114 | 115 |
<string name="solver_cube3_error4">Not all 8 corners exist exactly once!</string> |
115 | 116 |
<string name="solver_cube3_error6">Two corners or two edges have to be exchanged!</string> |
116 | 117 |
<string name="solver_cube3_error7">No solution exists for the given maximum move number!</string> |
Also available in: Unified diff
Pyraminx solver: error messages