Revision e43fd306
Added by Leszek Koltunski over 1 year ago
src/main/java/org/distorted/solvers/SolverPyraminx.java | ||
---|---|---|
347 | 347 |
|
348 | 348 |
int result4 = checkAgreement(faces1,faces2); |
349 | 349 |
if( result4<0 ) return result4; |
350 |
/* |
|
351 |
for(int i=0; i<4; i++) |
|
352 |
android.util.Log.e("D", "face "+i+" : "+faces1[i]); |
|
353 |
*/ |
|
350 |
|
|
354 | 351 |
for(int i=0; i<4; i++) |
355 | 352 |
{ |
356 | 353 |
corner_twist[i] = computePieceTwist(i,corners[i],faces1); |
357 |
|
|
358 |
//android.util.Log.e("D", "corner twist "+i+" : "+corner_twist[i]); |
|
359 |
|
|
360 | 354 |
if( corner_twist[i]<0 ) return ERROR_CORNERS_CANNOT; |
361 | 355 |
} |
362 | 356 |
|
... | ... | |
365 | 359 |
vertex_twist[i] = computePieceTwist(i,vertices[i],faces1); |
366 | 360 |
if( vertex_twist[i]<0 ) return ERROR_VERTICES_CANNOT; |
367 | 361 |
} |
368 |
/* |
|
369 |
for(int i=0; i<6; i++) |
|
370 |
android.util.Log.e("D", "edge "+i+" : "+edges[i][0]+" "+edges[i][1]); |
|
371 |
*/ |
|
372 | 362 |
|
373 | 363 |
int[] quats = computeEdgeQuats(edges); |
374 | 364 |
int[] permutation = new int[6]; |
... | ... | |
377 | 367 |
if( !even ) return ERROR_TWO_EDGES; |
378 | 368 |
int[] edge_twist = new int[6]; |
379 | 369 |
TablebasesPyraminx.getEdgeTwist(edge_twist,quats,0); |
380 |
/* |
|
381 |
for(int i=0; i<6; i++) |
|
382 |
android.util.Log.e("D", "q edge "+i+" : "+quats[i]); |
|
383 |
|
|
384 |
for(int i=0; i<6; i++) |
|
385 |
android.util.Log.e("D", "p edge "+i+" : "+permutation[i]); |
|
386 |
*/ |
|
387 |
|
|
388 |
/* |
|
389 |
for(int i=0; i<6; i++) |
|
390 |
android.util.Log.e("D", "edge twist "+i+" : "+edge_twist[i]); |
|
391 |
*/ |
|
370 |
|
|
392 | 371 |
int totalEdgeTwist=0; |
393 | 372 |
for(int i=0; i<6; i++) totalEdgeTwist += edge_twist[i]; |
394 | 373 |
if( (totalEdgeTwist%2)!=0 ) return ERROR_EDGE_TWISTED; |
... | ... | |
397 | 376 |
int edgeTwist = edge_twist[0]+ 2*(edge_twist[1]+ 2*(edge_twist[2]+ 2*(edge_twist[3]+ 2*edge_twist[4]))); |
398 | 377 |
int perm_num = TablebaseHelpers.computeEvenPermutationNum(permutation); |
399 | 378 |
|
400 |
//android.util.Log.e("D", "vertexTwist: : "+vertexTwist+" edgeTwist: "+edgeTwist+" perm_num: "+perm_num ); |
|
401 |
|
|
402 | 379 |
return vertexTwist + 81*(edgeTwist + 32*perm_num); |
403 | 380 |
} |
404 | 381 |
|
Also available in: Unified diff
Pyraminx solver: tablebase working now (tipless, tips to be added in the SolverPyraminx class)