Revision 6cf89a3e
Added by Leszek Koltunski over 2 years ago
src/main/java/org/distorted/objects/TwistyDino6.java | ||
---|---|---|
21 | 21 |
|
22 | 22 |
import android.content.res.Resources; |
23 | 23 |
|
24 |
import org.distorted.helpers.ScrambleStateGraph;
|
|
24 |
import org.distorted.helpers.ScrambleState; |
|
25 | 25 |
import org.distorted.library.main.DistortedEffects; |
26 | 26 |
import org.distorted.library.main.DistortedTexture; |
27 | 27 |
import org.distorted.library.mesh.MeshSquare; |
... | ... | |
43 | 43 |
{ |
44 | 44 |
super(size, quat, texture, mesh, effects, moves, ObjectList.DINO, res, scrWidth); |
45 | 45 |
|
46 |
mStates = new ScrambleStateGraph[]
|
|
46 |
mStates = new ScrambleState[] |
|
47 | 47 |
{ |
48 |
new ScrambleStateGraph( new int[][] { {0,1,1,0,-1,1, 2,1,2,2,-1,2},{0,1,3,0,-1,3, 2,1,4,2,-1,4},{0,1,5,0,-1,5, 2,1,6,2,-1,6},{0,1,7,0,-1,7, 2,1,8,2,-1,8} } ),
|
|
49 |
new ScrambleStateGraph( new int[][] { { },{0,1,3,0,-1,3 },{0,1,5,0,-1,5, },{ 2,1,8,2,-1,8} } ),
|
|
50 |
new ScrambleStateGraph( new int[][] { { },{ 2,1,4,2,-1,4},{ 2,1,6,2,-1,6},{0,1,7,0,-1,7 } } ),
|
|
51 |
new ScrambleStateGraph( new int[][] { {0,1,1,0,-1,1 },{ },{ 2,1,6,2,-1,6},{0,1,7,0,-1,7 } } ),
|
|
52 |
new ScrambleStateGraph( new int[][] { { 2,1,2,2,-1,2},{ },{0,1,5,0,-1,5, },{ 2,1,8,2,-1,8} } ),
|
|
53 |
new ScrambleStateGraph( new int[][] { {0,1,1,0,-1,1 },{ 2,1,4,2,-1,4},{ },{0,1,7,0,-1,7 } } ),
|
|
54 |
new ScrambleStateGraph( new int[][] { { 2,1,2,2,-1,2},{0,1,3,0,-1,3 },{ },{ 2,1,8,2,-1,8} } ),
|
|
55 |
new ScrambleStateGraph( new int[][] { { 2,1,2,2,-1,2},{0,1,3,0,-1,3 },{0,1,5,0,-1,5, },{ } } ),
|
|
56 |
new ScrambleStateGraph( new int[][] { {0,1,1,0,-1,1 },{ 2,1,4,2,-1,4},{ 2,1,6,2,-1,6},{ } } ),
|
|
48 |
new ScrambleState( new int[][] { {0,1,1,0,-1,1, 2,1,2,2,-1,2},{0,1,3,0,-1,3, 2,1,4,2,-1,4},{0,1,5,0,-1,5, 2,1,6,2,-1,6},{0,1,7,0,-1,7, 2,1,8,2,-1,8} } ), |
|
49 |
new ScrambleState( new int[][] { { },{0,1,3,0,-1,3 },{0,1,5,0,-1,5, },{ 2,1,8,2,-1,8} } ), |
|
50 |
new ScrambleState( new int[][] { { },{ 2,1,4,2,-1,4},{ 2,1,6,2,-1,6},{0,1,7,0,-1,7 } } ), |
|
51 |
new ScrambleState( new int[][] { {0,1,1,0,-1,1 },{ },{ 2,1,6,2,-1,6},{0,1,7,0,-1,7 } } ), |
|
52 |
new ScrambleState( new int[][] { { 2,1,2,2,-1,2},{ },{0,1,5,0,-1,5, },{ 2,1,8,2,-1,8} } ), |
|
53 |
new ScrambleState( new int[][] { {0,1,1,0,-1,1 },{ 2,1,4,2,-1,4},{ },{0,1,7,0,-1,7 } } ), |
|
54 |
new ScrambleState( new int[][] { { 2,1,2,2,-1,2},{0,1,3,0,-1,3 },{ },{ 2,1,8,2,-1,8} } ), |
|
55 |
new ScrambleState( new int[][] { { 2,1,2,2,-1,2},{0,1,3,0,-1,3 },{0,1,5,0,-1,5, },{ } } ), |
|
56 |
new ScrambleState( new int[][] { {0,1,1,0,-1,1 },{ 2,1,4,2,-1,4},{ 2,1,6,2,-1,6},{ } } ), |
|
57 | 57 |
}; |
58 | 58 |
} |
59 | 59 |
|
60 | 60 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
61 |
// Dino6 is solved if and only if: |
|
62 |
// |
|
63 |
// All four 'X' cubits (i.e. those whose longest edge goes along the X axis) are rotated |
|
64 |
// by the same quaternion qX, similarly all four 'Y' cubits by the same qY and all four 'Z' |
|
65 |
// by the same qZ, and then either: |
|
66 |
// |
|
67 |
// a) qX = qY = qZ |
|
68 |
// b) qY = qX*Q2 and qZ = qX*Q8 (i.e. swap of WHITE and YELLOW faces) |
|
69 |
// c) qX = qY*Q2 and qZ = qY*Q10 (i.e. swap of BLUE and GREEN faces) |
|
70 |
// d) qX = qZ*Q8 and qY = qZ*Q10 (i.e. swap of RED and BROWN faces) |
|
71 |
// |
|
72 |
// BUT: cases b), c) and d) are really the same - it's all just a mirror image of the original. |
|
73 |
// |
|
74 |
// X cubits: 0, 2, 8, 10 |
|
75 |
// Y cubits: 1, 3, 9, 11 |
|
76 |
// Z cubits: 4, 5, 6, 7 |
|
77 | 61 |
|
78 | 62 |
int[] getSolvedQuats(int cubit, int numLayers) |
79 | 63 |
{ |
80 |
switch(cubit) |
|
81 |
{ |
|
82 |
case 0: case 2: case 8: case 10: return null; |
|
83 |
case 1: case 3: case 9: case 11: return new int[] {2}; |
|
84 |
case 4: case 5: case 6: case 7: return new int[] {8}; |
|
85 |
} |
|
86 |
|
|
87 | 64 |
return null; |
88 | 65 |
} |
89 | 66 |
|
... | ... | |
103 | 80 |
|
104 | 81 |
int getSolvedFunctionIndex() |
105 | 82 |
{ |
106 |
return 0;
|
|
83 |
return 2;
|
|
107 | 84 |
} |
108 | 85 |
|
109 | 86 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
Also available in: Unified diff
Introduce pseudorandom balancing into scrambling in case of the two Dinos (from now on, the more times a particular (ax,layer) combination has been chosen already in the scrambling sequence, the less likely it is to be chosen next).
Fix Dino6 - isSolved(). Sadly, it cannot be the geeneric function - it needs to be another special case.