Revision 53a38b07
Added by Leszek Koltunski over 2 years ago
| src/main/java/org/distorted/solvers/SolverCuboid323.java | ||
|---|---|---|
| 16 | 16 |
import org.distorted.objectlib.main.ObjectSignatures; |
| 17 | 17 |
import org.distorted.objectlib.main.TwistyObject; |
| 18 | 18 |
import org.distorted.objectlib.tablebases.ImplementedTablebasesList; |
| 19 |
import org.distorted.objectlib.tablebases.TBCuboid323; |
|
| 19 | 20 |
import org.distorted.objectlib.tablebases.TablebaseHelpers; |
| 20 | 21 |
import org.distorted.objectlib.tablebases.TablebasesAbstract; |
| 21 | 22 |
|
| ... | ... | |
| 35 | 36 |
private boolean mUpper; |
| 36 | 37 |
|
| 37 | 38 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 38 |
// if mUpper==true, then the edge3 is the 'half-fixed' front edge. Remove it from the permutation. |
|
| 39 |
// Otherwise edge1 is the one; remove it. |
|
| 40 |
|
|
| 41 |
private int[] correctEdgePerm(int[] perm) |
|
| 42 |
{
|
|
| 43 |
int val; |
|
| 44 |
int[] ret = new int[7]; |
|
| 45 |
|
|
| 46 |
if( mUpper ) |
|
| 47 |
{
|
|
| 48 |
ret[0] = perm[0]; |
|
| 49 |
ret[1] = perm[1]; |
|
| 50 |
ret[2] = perm[2]; |
|
| 51 |
ret[3] = perm[4]; |
|
| 52 |
ret[4] = perm[5]; |
|
| 53 |
ret[5] = perm[6]; |
|
| 54 |
ret[6] = perm[7]; |
|
| 55 |
|
|
| 56 |
val = perm[3]; |
|
| 57 |
} |
|
| 58 |
else |
|
| 59 |
{
|
|
| 60 |
ret[0] = perm[0]; |
|
| 61 |
ret[1] = perm[2]; |
|
| 62 |
ret[2] = perm[3]; |
|
| 63 |
ret[3] = perm[4]; |
|
| 64 |
ret[4] = perm[5]; |
|
| 65 |
ret[5] = perm[6]; |
|
| 66 |
ret[6] = perm[7]; |
|
| 67 |
|
|
| 68 |
val = perm[1]; |
|
| 69 |
} |
|
| 70 |
|
|
| 71 |
for(int i=0; i<7; i++) |
|
| 72 |
if( ret[i]>val ) ret[i]--; |
|
| 73 |
|
|
| 74 |
return ret; |
|
| 75 |
} |
|
| 76 |
|
|
| 77 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 78 |
// 0 or 1, depending on if the 'half-fixed' front edge is in its place or not. |
|
| 79 |
// if the 'half-fixed' edge is the upped front one ( i.e. mUpper==true) than it can be in its |
|
| 39 |
// true or false, depending on if the 'half-fixed' front edge is in its place or not. |
|
| 40 |
// if the 'half-fixed' edge is the upped front one (i.e. mUpper==true) than it can be in its |
|
| 80 | 41 |
// place or not; if mUpper==false it always must be in its place. |
| 81 | 42 |
|
| 82 | 43 |
private boolean isFrontEdgeInItsPlace(int[][] edges) |
| ... | ... | |
| 347 | 308 |
TablebaseHelpers.displayTable(corner_perm, "CORNER PERM"); |
| 348 | 309 |
TablebaseHelpers.displayTable(edge_perm, "EDGE PERM"); |
| 349 | 310 |
|
| 350 |
int[] edge_perm2 = correctEdgePerm(edge_perm); // edge1 (lower) or edge3 (upper) is fixed!
|
|
| 311 |
int[] edge_perm2 = TBCuboid323.edgePermTo7(edge_perm,mUpper); // edge1 (lower) or edge3 (upper) is fixed!
|
|
| 351 | 312 |
|
| 352 | 313 |
int corner_perm_num = TablebaseHelpers.computePermutationNum(corner_perm); |
| 353 | 314 |
int edge_perm_num = TablebaseHelpers.computePermutationNum(edge_perm2); |
| ... | ... | |
| 355 | 316 |
|
| 356 | 317 |
android.util.Log.e("D", "corner_perm_num: "+corner_perm_num+" edge_perm_num: "+edge_perm_num+" inPlace: "+inPlace);
|
| 357 | 318 |
|
| 319 |
TBCuboid323.setUpper(mUpper); |
|
| 320 |
|
|
| 358 | 321 |
return corner_perm_num + 20160*( (inPlace?0:1) + 2*edge_perm_num); |
| 359 | 322 |
} |
| 360 | 323 |
|
Also available in: Unified diff
CU_323 solver: theoretically complete.