Revision 27249eea
Added by Leszek Koltunski over 1 year ago
src/main/java/org/distorted/objectlib/json/JsonWriter.java | ||
---|---|---|
34 | 34 |
|
35 | 35 |
public class JsonWriter |
36 | 36 |
{ |
37 |
public static final int VERSION_OBJECT_MAJOR = 6;
|
|
37 |
public static final int VERSION_OBJECT_MAJOR = 7;
|
|
38 | 38 |
public static final int VERSION_OBJECT_MINOR = 0; |
39 | 39 |
public static final int VERSION_EXTRAS_MAJOR = 1; |
40 | 40 |
public static final int VERSION_EXTRAS_MINOR = 0; |
src/main/java/org/distorted/objectlib/main/ObjectType.java | ||
---|---|---|
101 | 101 |
|
102 | 102 |
CA_333 ( TwistyCamouflage.class , 32, R.drawable.din4_3, true, 50, new InitData(new int[] {4,4,4}, TwistyCamouflage.CAM_333)), |
103 | 103 |
|
104 |
PDUO_2 ( TwistyPyraminxDuo.class , 4, R.drawable.pduo_2, false, 0, new InitData(new int[] {2,2,2,2})),
|
|
105 |
PDIA_3 ( TwistyPyraminxDiamond.class, 12, R.drawable.pdia_3, false, 40, new InitData(new int[] {3,3,3})),
|
|
106 |
BALL_4 ( TwistyMasterball.class , 28, R.drawable.ball_4, false, 70, new InitData(new int[] {4,2,2,2,2})),
|
|
104 |
PDUO_2 ( TwistyPyraminxDuo.class , 4, R.drawable.pduo_2, true, 0, new InitData(new int[] {2,2,2,2})),
|
|
105 |
PDIA_3 ( TwistyPyraminxDiamond.class, 12, R.drawable.pdia_3, true, 40, new InitData(new int[] {3,3,3})),
|
|
106 |
BALL_4 ( TwistyMasterball.class , 28, R.drawable.ball_4, true, 70, new InitData(new int[] {4,2,2,2,2})),
|
|
107 | 107 |
; |
108 | 108 |
|
109 | 109 |
public static int NUM_OBJECTS; |
... | ... | |
186 | 186 |
|
187 | 187 |
public static TwistyObject create(int ordinal, int meshState, int iconMode, Static4D quat, Static3D move, float scale, InputStream meshStream) |
188 | 188 |
{ |
189 |
|
|
190 |
if( ordinal==CUBE_2.ordinal() )
|
|
189 |
/* |
|
190 |
if( ordinal==MORP_2.ordinal() )
|
|
191 | 191 |
{ |
192 |
return new TwistyCuboid(objects[ordinal].mInitData,meshState,iconMode,quat,move,scale,meshStream);
|
|
192 |
return new TwistyMorphix(objects[ordinal].mInitData,meshState,iconMode,quat,move,scale,meshStream);
|
|
193 | 193 |
} |
194 |
|
|
194 |
*/ |
|
195 | 195 |
Class<? extends TwistyObject> clazz = objects[ordinal].mClass; |
196 | 196 |
|
197 | 197 |
try |
src/main/java/org/distorted/objectlib/main/TwistyObject.java | ||
---|---|---|
242 | 242 |
int[][] edges = getScrambleEdges(); |
243 | 243 |
int[][] algorithms = getScrambleAlgorithms(); |
244 | 244 |
|
245 |
print_table("EDGES", edges); |
|
246 |
print_table("ALGOS", algorithms); |
|
245 |
if( edges!=null ) print_table("EDGES", edges);
|
|
246 |
if( algorithms!=null ) print_table("ALGOS", algorithms);
|
|
247 | 247 |
|
248 | 248 |
mScrambler = new ObjectScrambler(scramblingType,mNumAxis,mNumLayers,algorithms,edges); |
249 | 249 |
|
src/main/java/org/distorted/objectlib/objects/TwistyAxis.java | ||
---|---|---|
63 | 63 |
|
64 | 64 |
public int[][] getScrambleEdges() |
65 | 65 |
{ |
66 |
if( mEdges==null ) ScrambleEdgeGenerator.getScrambleEdgesCuboid(3,3,3); |
|
66 |
if( mEdges==null ) mEdges = ScrambleEdgeGenerator.getScrambleEdgesCuboid(3,3,3);
|
|
67 | 67 |
return mEdges; |
68 | 68 |
} |
69 | 69 |
|
src/main/java/org/distorted/objectlib/objects/TwistyBandagedAbstract.java | ||
---|---|---|
25 | 25 |
|
26 | 26 |
public abstract class TwistyBandagedAbstract extends ShapeHexahedron |
27 | 27 |
{ |
28 |
// the three rotation axis of a 3x3 Cube. Must be normalized. |
|
29 | 28 |
static final Static3D[] ROT_AXIS = new Static3D[] |
30 | 29 |
{ |
31 | 30 |
new Static3D(1,0,0), |
... | ... | |
165 | 164 |
|
166 | 165 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
167 | 166 |
// Computing scramble states of many a bandaged cubes takes way too long time and too much space. |
168 |
// Return null here and turn to construction of scramble tables just-in-time.
|
|
167 |
// Return null here and turn to construction of scramble tables just-in-time (scrambleType=2)
|
|
169 | 168 |
|
170 | 169 |
public int[][] getScrambleEdges() |
171 | 170 |
{ |
src/main/java/org/distorted/objectlib/objects/TwistyCrazy3x3.java | ||
---|---|---|
188 | 188 |
|
189 | 189 |
public int[][] getScrambleEdges() |
190 | 190 |
{ |
191 |
if( mEdges==null ) ScrambleEdgeGenerator.getScrambleEdgesCuboid(3,3,3); |
|
191 |
if( mEdges==null ) mEdges = ScrambleEdgeGenerator.getScrambleEdgesCuboid(3,3,3);
|
|
192 | 192 |
return mEdges; |
193 | 193 |
} |
194 | 194 |
|
src/main/java/org/distorted/objectlib/objects/TwistyDodecahedron.java | ||
---|---|---|
62 | 62 |
super(data, meshState, iconMode, data.getNumLayers()[0], quat, move, scale, stream); |
63 | 63 |
} |
64 | 64 |
|
65 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
66 |
|
|
67 |
private void fillRet(int[] table, int index, int count, int startMove, int graphVertex) |
|
68 |
{ |
|
69 |
int num = count/2; |
|
70 |
int move= startMove*num; |
|
71 |
|
|
72 |
for(int i=0; i<num; i++) |
|
73 |
{ |
|
74 |
table[index+2*i ] = move++; |
|
75 |
table[index+2*i+1] = graphVertex; |
|
76 |
} |
|
77 |
} |
|
78 |
|
|
79 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
80 |
|
|
81 |
private int[] genEdge(int numLayers, int x0, int x1, int x2, int x3, int x4, int x5, |
|
82 |
int x6, int x7, int x8, int x9, int x10,int x11) |
|
83 |
{ |
|
84 |
int layers = (numLayers-1)/2; |
|
85 |
int num = 8*layers; |
|
86 |
int size = 0; |
|
87 |
|
|
88 |
if( x0 >=0 ) size += num; |
|
89 |
if( x1 >=0 ) size += num; |
|
90 |
if( x2 >=0 ) size += num; |
|
91 |
if( x3 >=0 ) size += num; |
|
92 |
if( x4 >=0 ) size += num; |
|
93 |
if( x5 >=0 ) size += num; |
|
94 |
if( x6 >=0 ) size += num; |
|
95 |
if( x7 >=0 ) size += num; |
|
96 |
if( x8 >=0 ) size += num; |
|
97 |
if( x9 >=0 ) size += num; |
|
98 |
if( x10>=0 ) size += num; |
|
99 |
if( x11>=0 ) size += num; |
|
100 |
|
|
101 |
int[] ret = new int[size]; |
|
102 |
int index = 0; |
|
103 |
|
|
104 |
if( x0 >=0 ) { fillRet(ret,index,num,0 ,x0 ); index+=num; } |
|
105 |
if( x1 >=0 ) { fillRet(ret,index,num,1 ,x1 ); index+=num; } |
|
106 |
if( x2 >=0 ) { fillRet(ret,index,num,2 ,x2 ); index+=num; } |
|
107 |
if( x3 >=0 ) { fillRet(ret,index,num,3 ,x3 ); index+=num; } |
|
108 |
if( x4 >=0 ) { fillRet(ret,index,num,4 ,x4 ); index+=num; } |
|
109 |
if( x5 >=0 ) { fillRet(ret,index,num,5 ,x5 ); index+=num; } |
|
110 |
if( x6 >=0 ) { fillRet(ret,index,num,6 ,x6 ); index+=num; } |
|
111 |
if( x7 >=0 ) { fillRet(ret,index,num,7 ,x7 ); index+=num; } |
|
112 |
if( x8 >=0 ) { fillRet(ret,index,num,8 ,x8 ); index+=num; } |
|
113 |
if( x9 >=0 ) { fillRet(ret,index,num,9 ,x9 ); index+=num; } |
|
114 |
if( x10>=0 ) { fillRet(ret,index,num,10,x10); index+=num; } |
|
115 |
if( x11>=0 ) { fillRet(ret,index,num,11,x11); } |
|
116 |
|
|
117 |
return ret; |
|
118 |
} |
|
119 |
|
|
65 | 120 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
66 | 121 |
|
67 | 122 |
public int[][] getScrambleEdges() |
68 | 123 |
{ |
69 | 124 |
if( mEdges==null ) |
70 | 125 |
{ |
71 |
int[] numLayers = getNumLayers(); |
|
72 |
initializeScrambleEdges(numLayers[0]); |
|
126 |
int nL = getNumLayers()[0]; |
|
127 |
|
|
128 |
mEdges = new int[][] |
|
129 |
{ |
|
130 |
genEdge(nL, 1, 2, 3, 4, 5, 6, 7, 8, 9,10, 11,12), // 0 |
|
131 |
genEdge(nL,-1,-1, -1, 4, 5,-1, -1, 8, 9,-1, 11,-1), // 0L |
|
132 |
genEdge(nL,-1,-1, 3,-1, -1, 6, 7,-1, -1,10, -1,12), // 0R |
|
133 |
genEdge(nL,-1, 2, -1,-1, 5,-1, -1, 8, -1,10, -1,12), // 1L |
|
134 |
genEdge(nL, 1,-1, -1,-1, -1, 6, 7,-1, 9,-1, 11,-1), // 1R |
|
135 |
genEdge(nL, 1,-1, 3,-1, -1,-1, -1, 8, 9,-1, -1,12), // 2L |
|
136 |
genEdge(nL,-1, 2, -1, 4, -1,-1, 7,-1, -1,10, 11,-1), // 2R |
|
137 |
genEdge(nL,-1, 2, -1, 4, -1, 6, -1,-1, 9,-1, -1,12), // 3L |
|
138 |
genEdge(nL, 1,-1, 3,-1, 5,-1, -1,-1, -1,10, 11,-1), // 3R |
|
139 |
genEdge(nL, 1,-1, -1, 4, 5,-1, 7,-1, -1,-1, -1,12), // 4L |
|
140 |
genEdge(nL,-1, 2, 3,-1, 5,-1, -1, 8, -1,-1, 11,-1), // 4R |
|
141 |
genEdge(nL, 1,-1, -1, 4, -1, 6, -1, 8, -1,10, -1,-1), // 5L |
|
142 |
genEdge(nL,-1, 2, 3,-1, 5,-1, 7,-1, 9,-1, -1,-1), // 5R |
|
143 |
}; |
|
73 | 144 |
} |
74 | 145 |
|
75 | 146 |
return mEdges; |
... | ... | |
240 | 311 |
} |
241 | 312 |
} |
242 | 313 |
|
243 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
244 |
|
|
245 |
private void fillRet(int[] table, int index, int count, int startMove, int graphVertex) |
|
246 |
{ |
|
247 |
int num = count/2; |
|
248 |
int move= startMove*num; |
|
249 |
|
|
250 |
for(int i=0; i<num; i++) |
|
251 |
{ |
|
252 |
table[index+2*i ] = move++; |
|
253 |
table[index+2*i+1] = graphVertex; |
|
254 |
} |
|
255 |
} |
|
256 |
|
|
257 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
258 |
|
|
259 |
private int[] genEdge(int numLayers, int x0, int x1, int x2, int x3, int x4, int x5, |
|
260 |
int x6, int x7, int x8, int x9, int x10,int x11) |
|
261 |
{ |
|
262 |
int layers = (numLayers-1)/2; |
|
263 |
int num = 8*layers; |
|
264 |
int size = 0; |
|
265 |
|
|
266 |
if( x0 >=0 ) size += num; |
|
267 |
if( x1 >=0 ) size += num; |
|
268 |
if( x2 >=0 ) size += num; |
|
269 |
if( x3 >=0 ) size += num; |
|
270 |
if( x4 >=0 ) size += num; |
|
271 |
if( x5 >=0 ) size += num; |
|
272 |
if( x6 >=0 ) size += num; |
|
273 |
if( x7 >=0 ) size += num; |
|
274 |
if( x8 >=0 ) size += num; |
|
275 |
if( x9 >=0 ) size += num; |
|
276 |
if( x10>=0 ) size += num; |
|
277 |
if( x11>=0 ) size += num; |
|
278 |
|
|
279 |
int[] ret = new int[size]; |
|
280 |
int index = 0; |
|
281 |
|
|
282 |
if( x0 >=0 ) { fillRet(ret,index,num,0 ,x0 ); index+=num; } |
|
283 |
if( x1 >=0 ) { fillRet(ret,index,num,1 ,x1 ); index+=num; } |
|
284 |
if( x2 >=0 ) { fillRet(ret,index,num,2 ,x2 ); index+=num; } |
|
285 |
if( x3 >=0 ) { fillRet(ret,index,num,3 ,x3 ); index+=num; } |
|
286 |
if( x4 >=0 ) { fillRet(ret,index,num,4 ,x4 ); index+=num; } |
|
287 |
if( x5 >=0 ) { fillRet(ret,index,num,5 ,x5 ); index+=num; } |
|
288 |
if( x6 >=0 ) { fillRet(ret,index,num,6 ,x6 ); index+=num; } |
|
289 |
if( x7 >=0 ) { fillRet(ret,index,num,7 ,x7 ); index+=num; } |
|
290 |
if( x8 >=0 ) { fillRet(ret,index,num,8 ,x8 ); index+=num; } |
|
291 |
if( x9 >=0 ) { fillRet(ret,index,num,9 ,x9 ); index+=num; } |
|
292 |
if( x10>=0 ) { fillRet(ret,index,num,10,x10); index+=num; } |
|
293 |
if( x11>=0 ) { fillRet(ret,index,num,11,x11); } |
|
294 |
|
|
295 |
return ret; |
|
296 |
} |
|
297 |
|
|
298 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
299 |
|
|
300 |
private void initializeScrambleEdges(int numLayers) |
|
301 |
{ |
|
302 |
mEdges = new int[][] |
|
303 |
{ |
|
304 |
genEdge(numLayers, 1, 2, 3, 4, 5, 6, 7, 8, 9,10, 11,12), // 0 |
|
305 |
genEdge(numLayers,-1,-1, -1, 4, 5,-1, -1, 8, 9,-1, 11,-1), // 0L |
|
306 |
genEdge(numLayers,-1,-1, 3,-1, -1, 6, 7,-1, -1,10, -1,12), // 0R |
|
307 |
genEdge(numLayers,-1, 2, -1,-1, 5,-1, -1, 8, -1,10, -1,12), // 1L |
|
308 |
genEdge(numLayers, 1,-1, -1,-1, -1, 6, 7,-1, 9,-1, 11,-1), // 1R |
|
309 |
genEdge(numLayers, 1,-1, 3,-1, -1,-1, -1, 8, 9,-1, -1,12), // 2L |
|
310 |
genEdge(numLayers,-1, 2, -1, 4, -1,-1, 7,-1, -1,10, 11,-1), // 2R |
|
311 |
genEdge(numLayers,-1, 2, -1, 4, -1, 6, -1,-1, 9,-1, -1,12), // 3L |
|
312 |
genEdge(numLayers, 1,-1, 3,-1, 5,-1, -1,-1, -1,10, 11,-1), // 3R |
|
313 |
genEdge(numLayers, 1,-1, -1, 4, 5,-1, 7,-1, -1,-1, -1,12), // 4L |
|
314 |
genEdge(numLayers,-1, 2, 3,-1, 5,-1, -1, 8, -1,-1, 11,-1), // 4R |
|
315 |
genEdge(numLayers, 1,-1, -1, 4, -1, 6, -1, 8, -1,10, -1,-1), // 5L |
|
316 |
genEdge(numLayers,-1, 2, 3,-1, 5,-1, 7,-1, 9,-1, -1,-1), // 5R |
|
317 |
}; |
|
318 |
} |
|
319 |
|
|
320 | 314 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
321 | 315 |
|
322 | 316 |
float[][] genericGetCuts(int numLayers, float dist) |
src/main/java/org/distorted/objectlib/objects/TwistyFisher.java | ||
---|---|---|
63 | 63 |
|
64 | 64 |
public int[][] getScrambleEdges() |
65 | 65 |
{ |
66 |
if( mEdges==null ) ScrambleEdgeGenerator.getScrambleEdgesCuboid(3,3,3); |
|
66 |
if( mEdges==null ) mEdges = ScrambleEdgeGenerator.getScrambleEdgesCuboid(3,3,3);
|
|
67 | 67 |
return mEdges; |
68 | 68 |
} |
69 | 69 |
|
src/main/java/org/distorted/objectlib/objects/TwistyMasterball.java | ||
---|---|---|
116 | 116 |
if( mEdges==null ) |
117 | 117 |
{ |
118 | 118 |
mEdges = new int[][] |
119 |
{
|
|
120 |
{0,1,1,1,2,1,3,1,4,1,5,1,6,1,7,1,8,1,9,1,10,1,11,1,12,1,13,1,14,1,15,1,16,1,17,1,18,1,19,1,20,1,21,1,22,1,23,1,24,1,25,1,26,1,27,1},
|
|
121 |
{28,2,29,2,30,2,31,2,32,2,33,2,34,2,35,2 },
|
|
122 |
{0,1,1,1,2,1,3,1,4,1,5,1,6,1,7,1,8,1,9,1,10,1,11,1,12,1,13,1,14,1,15,1,16,1,17,1,18,1,19,1,20,1,21,1,22,1,23,1,24,1,25,1,26,1,27,1,
|
|
123 |
28,0,29,0,30,0,31,0,32,0,33,0,34,0,35,0 }
|
|
124 |
};
|
|
119 |
{ |
|
120 |
{0,1,1,1,2,1,3,1,4,1,5,1,6,1,7,1,8,1,9,1,10,1,11,1,12,1,13,1,14,1,15,1,16,1,17,1,18,1,19,1,20,1,21,1,22,1,23,1,24,1,25,1,26,1,27,1}, |
|
121 |
{28,2,29,2,30,2,31,2,32,2,33,2,34,2,35,2 }, |
|
122 |
{0,1,1,1,2,1,3,1,4,1,5,1,6,1,7,1,8,1,9,1,10,1,11,1,12,1,13,1,14,1,15,1,16,1,17,1,18,1,19,1,20,1,21,1,22,1,23,1,24,1,25,1,26,1,27,1, |
|
123 |
28,0,29,0,30,0,31,0,32,0,33,0,34,0,35,0 } |
|
124 |
}; |
|
125 | 125 |
} |
126 | 126 |
|
127 | 127 |
return mEdges; |
src/main/java/org/distorted/objectlib/objects/TwistyMirror.java | ||
---|---|---|
86 | 86 |
{ |
87 | 87 |
if( mEdges==null ) |
88 | 88 |
{ |
89 |
int n = getNumLayers()[0]; |
|
90 |
ScrambleEdgeGenerator.getScrambleEdgesCuboid(n,n,n);
|
|
89 |
int nL = getNumLayers()[0];
|
|
90 |
mEdges = ScrambleEdgeGenerator.getScrambleEdgesCuboid(nL,nL,nL);
|
|
91 | 91 |
} |
92 | 92 |
return mEdges; |
93 | 93 |
} |
src/main/java/org/distorted/objectlib/objects/TwistyMixup.java | ||
---|---|---|
341 | 341 |
|
342 | 342 |
int[] ret = new int[2*num]; |
343 | 343 |
|
344 |
if( stateX>=0 ) |
|
345 |
{ |
|
346 |
insertSection(ret,0,size,0,stateX); |
|
347 |
if( stateY>=0 ) |
|
348 |
{ |
|
349 |
insertSection(ret,size,size,size,stateY); |
|
350 |
if( stateZ>=0 ) insertSection(ret,2*size,size,2*size,stateZ); |
|
351 |
} |
|
352 |
else |
|
353 |
{ |
|
354 |
insertSection(ret,size,size,2*size,stateZ); |
|
355 |
} |
|
356 |
} |
|
357 |
else |
|
358 |
{ |
|
359 |
if( stateY>=0 ) |
|
360 |
{ |
|
361 |
insertSection(ret,0,size,size,stateY); |
|
362 |
if( stateZ>=0 ) insertSection(ret,size,size,2*size,stateZ); |
|
363 |
} |
|
364 |
else |
|
365 |
{ |
|
366 |
insertSection(ret,0,size,2*size,stateZ); |
|
367 |
} |
|
368 |
} |
|
344 |
int index = 0; |
|
345 |
int alg = 0; |
|
346 |
if( stateX>=0 ) { insertSection(ret,index,size,alg,stateX); index += size; } |
|
347 |
alg += size; |
|
348 |
if( stateY>=0 ) { insertSection(ret,index,size,alg,stateY); index += size; } |
|
349 |
alg += size; |
|
350 |
if( stateZ>=0 ) { insertSection(ret,index,size,alg,stateZ); } |
|
369 | 351 |
|
370 | 352 |
return ret; |
371 | 353 |
} |
src/main/java/org/distorted/objectlib/objects/TwistyMorphix.java | ||
---|---|---|
18 | 18 |
import org.distorted.objectlib.helpers.ObjectVertexEffects; |
19 | 19 |
import org.distorted.objectlib.main.InitData; |
20 | 20 |
import org.distorted.objectlib.main.ObjectType; |
21 |
import org.distorted.objectlib.scrambling.ScrambleEdgeGenerator; |
|
21 | 22 |
import org.distorted.objectlib.shape.ShapeTetrahedron; |
22 | 23 |
import org.distorted.objectlib.touchcontrol.TouchControlTetrahedron; |
23 | 24 |
|
... | ... | |
73 | 74 |
|
74 | 75 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
75 | 76 |
|
76 |
private void insertSection(int[] table, int startIndex, int size, int startAlg, int state) |
|
77 |
{ |
|
78 |
for(int i=0; i<size; i++) |
|
79 |
{ |
|
80 |
table[2*(i+startIndex) ] = startAlg +i; |
|
81 |
table[2*(i+startIndex)+1] = state; |
|
82 |
} |
|
83 |
} |
|
84 |
|
|
85 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
86 |
|
|
87 |
private int[] createEdge(int sizeX, int sizeY, int sizeZ, int stateX, int stateY, int stateZ) |
|
88 |
{ |
|
89 |
int num = 0; |
|
90 |
if( stateX>=0 ) num += (3*sizeX); |
|
91 |
if( stateY>=0 ) num += (3*sizeY); |
|
92 |
if( stateZ>=0 ) num += (3*sizeZ); |
|
93 |
|
|
94 |
int[] ret = new int[2*num]; |
|
95 |
|
|
96 |
if( stateX>=0 ) |
|
97 |
{ |
|
98 |
insertSection(ret,0,3*sizeX,0,stateX); |
|
99 |
if( stateY>=0 ) |
|
100 |
{ |
|
101 |
insertSection(ret,3*sizeX,3*sizeY,3*sizeX,stateY); |
|
102 |
if( stateZ>=0 ) insertSection(ret,3*sizeX+3*sizeY,3*sizeZ,3*sizeX+3*sizeY,stateZ); |
|
103 |
} |
|
104 |
else |
|
105 |
{ |
|
106 |
insertSection(ret,3*sizeX,3*sizeZ,3*sizeX+3*sizeY,stateZ); |
|
107 |
} |
|
108 |
} |
|
109 |
else |
|
110 |
{ |
|
111 |
if( stateY>=0 ) |
|
112 |
{ |
|
113 |
insertSection(ret,0,3*sizeY,3*sizeX,stateY); |
|
114 |
if( stateZ>=0 ) insertSection(ret,3*sizeY,3*sizeZ,3*sizeX+3*sizeY,stateZ); |
|
115 |
} |
|
116 |
else |
|
117 |
{ |
|
118 |
insertSection(ret,0,3*sizeZ,3*sizeX+3*sizeY,stateZ); |
|
119 |
} |
|
120 |
} |
|
121 |
|
|
122 |
return ret; |
|
123 |
} |
|
124 |
|
|
125 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
126 |
// same as in a non-flat cuboids |
|
127 |
|
|
128 | 77 |
public int[][] getScrambleEdges() |
129 | 78 |
{ |
130 | 79 |
if( mEdges==null ) |
131 | 80 |
{ |
132 |
int[] numLayers = getNumLayers(); |
|
133 |
|
|
134 |
int X = numLayers[0]; |
|
135 |
int Y = numLayers[1]; |
|
136 |
int Z = numLayers[2]; |
|
137 |
|
|
138 |
mEdges = new int[][] |
|
139 |
{ |
|
140 |
createEdge(X,Y,Z, 1, 2, 3), // 0 0 |
|
141 |
createEdge(X,Y,Z,-1, 4, 5), // 1 x |
|
142 |
createEdge(X,Y,Z, 6,-1, 7), // 2 y |
|
143 |
createEdge(X,Y,Z, 8, 9,-1), // 3 z |
|
144 |
createEdge(X,Y,Z,10,-1, 7), // 4 xy |
|
145 |
createEdge(X,Y,Z,11, 9,-1), // 5 xz |
|
146 |
createEdge(X,Y,Z,-1,12, 5), // 6 yx |
|
147 |
createEdge(X,Y,Z, 8,13,-1), // 7 yz |
|
148 |
createEdge(X,Y,Z,-1, 4,14), // 8 zx |
|
149 |
createEdge(X,Y,Z, 6,-1,15), // 9 zy |
|
150 |
createEdge(X,Y,Z,-1,-1, 5), // 10 xyx |
|
151 |
createEdge(X,Y,Z,-1, 4,-1), // 11 xzx |
|
152 |
createEdge(X,Y,Z,-1,-1, 7), // 12 yxy |
|
153 |
createEdge(X,Y,Z, 6,-1,-1), // 13 yzy |
|
154 |
createEdge(X,Y,Z,-1, 9,-1), // 14 zxz |
|
155 |
createEdge(X,Y,Z, 8,-1,-1), // 15 zyz |
|
156 |
}; |
|
81 |
int nL = getNumLayers()[0]; |
|
82 |
mEdges = ScrambleEdgeGenerator.getScrambleEdgesCuboid(nL,nL,nL); |
|
157 | 83 |
} |
158 | 84 |
|
159 | 85 |
return mEdges; |
160 | 86 |
} |
161 | 87 |
|
162 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
163 |
|
|
164 |
private int[] createEdges(int size, int vertex) |
|
165 |
{ |
|
166 |
int[] ret = new int[9*size]; |
|
167 |
|
|
168 |
for(int l=0; l<size; l++) |
|
169 |
{ |
|
170 |
ret[9*l ] = l; |
|
171 |
ret[9*l+1] =-1; |
|
172 |
ret[9*l+2] = vertex; |
|
173 |
ret[9*l+3] = l; |
|
174 |
ret[9*l+4] = 1; |
|
175 |
ret[9*l+5] = vertex; |
|
176 |
ret[9*l+6] = l; |
|
177 |
ret[9*l+7] = 2; |
|
178 |
ret[9*l+8] = vertex; |
|
179 |
} |
|
180 |
|
|
181 |
return ret; |
|
182 |
} |
|
183 |
|
|
184 | 88 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
185 | 89 |
|
186 | 90 |
public float[][] getCuts(int[] numLayers) |
src/main/java/org/distorted/objectlib/objects/TwistyPentultimate.java | ||
---|---|---|
18 | 18 |
import org.distorted.objectlib.helpers.ObjectVertexEffects; |
19 | 19 |
import org.distorted.objectlib.main.InitData; |
20 | 20 |
import org.distorted.objectlib.main.ObjectType; |
21 |
import org.distorted.objectlib.scrambling.ScrambleEdgeGenerator; |
|
21 | 22 |
|
22 | 23 |
import java.io.InputStream; |
23 | 24 |
|
... | ... | |
42 | 43 |
} |
43 | 44 |
|
44 | 45 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
45 |
// all moves in a single state |
|
46 | 46 |
|
47 | 47 |
public int[][] getScrambleEdges() |
48 | 48 |
{ |
49 | 49 |
if( mEdges==null ) |
50 | 50 |
{ |
51 |
int size=0; |
|
52 |
int[][] basicAngles = getBasicAngles(); |
|
53 |
|
|
54 |
for (int[] basic : basicAngles) |
|
55 |
for (int i : basic) size += (i-1); |
|
56 |
|
|
57 |
int[] edge = new int[2*size]; |
|
58 |
for(int i=0; i<size; i++) |
|
59 |
{ |
|
60 |
edge[2*i ] = i; |
|
61 |
edge[2*i+1] = 0; |
|
62 |
} |
|
63 |
|
|
64 |
mEdges = new int[][] { edge }; |
|
51 |
int[][] basicAngle = getBasicAngles(); |
|
52 |
mEdges = ScrambleEdgeGenerator.getScrambleEdgesSingle(basicAngle); |
|
65 | 53 |
} |
66 | 54 |
|
67 | 55 |
return mEdges; |
src/main/java/org/distorted/objectlib/objects/TwistyTrajber.java | ||
---|---|---|
96 | 96 |
if( mEdges==null ) |
97 | 97 |
{ |
98 | 98 |
int n = getNumLayers()[0]; |
99 |
ScrambleEdgeGenerator.getScrambleEdgesCuboid(n,n,n); |
|
99 |
mEdges = ScrambleEdgeGenerator.getScrambleEdgesCuboid(n,n,n);
|
|
100 | 100 |
} |
101 | 101 |
return mEdges; |
102 | 102 |
} |
src/main/java/org/distorted/objectlib/objects/TwistyWindmill.java | ||
---|---|---|
67 | 67 |
|
68 | 68 |
public int[][] getScrambleEdges() |
69 | 69 |
{ |
70 |
if( mEdges==null ) ScrambleEdgeGenerator.getScrambleEdgesCuboid(3,3,3); |
|
70 |
if( mEdges==null ) mEdges = ScrambleEdgeGenerator.getScrambleEdgesCuboid(3,3,3);
|
|
71 | 71 |
return mEdges; |
72 | 72 |
} |
73 | 73 |
|
src/main/java/org/distorted/objectlib/scrambling/ScrambleEdgeGenerator.java | ||
---|---|---|
21 | 21 |
{ |
22 | 22 |
table[2*(i+startIndex) ] = startAlg +i; |
23 | 23 |
|
24 |
android.util.Log.e("D", " "+(2*(i+startIndex))+" : "+(startAlg+i)); |
|
24 |
//android.util.Log.e("D", " "+(2*(i+startIndex))+" : "+(startAlg+i));
|
|
25 | 25 |
|
26 | 26 |
table[2*(i+startIndex)+1] = state; |
27 | 27 |
|
28 |
android.util.Log.e("D", " "+(2*(i+startIndex)+1)+" : "+(state)); |
|
28 |
//android.util.Log.e("D", " "+(2*(i+startIndex)+1)+" : "+(state));
|
|
29 | 29 |
} |
30 | 30 |
} |
31 | 31 |
|
... | ... | |
33 | 33 |
|
34 | 34 |
private static int[] createEdge(int sizeX, int sizeY, int sizeZ, int stateX, int stateY, int stateZ) |
35 | 35 |
{ |
36 |
android.util.Log.e("D", "creating edge"); |
|
36 |
//android.util.Log.e("D", "creating edge");
|
|
37 | 37 |
|
38 | 38 |
int num = 0; |
39 | 39 |
int consX = ((sizeY!=sizeZ) ? 2:6)*sizeX; |
Also available in: Unified diff
Produce new JSONs files (version 7, with new scrambling method)