23 |
23 |
import android.graphics.Canvas;
|
24 |
24 |
import android.graphics.Paint;
|
25 |
25 |
|
|
26 |
import org.distorted.library.effect.MatrixEffect;
|
26 |
27 |
import org.distorted.library.effect.MatrixEffectQuaternion;
|
|
28 |
import org.distorted.library.effect.MatrixEffectScale;
|
27 |
29 |
import org.distorted.library.main.DistortedEffects;
|
28 |
30 |
import org.distorted.library.main.DistortedTexture;
|
29 |
31 |
import org.distorted.library.mesh.MeshBase;
|
... | ... | |
40 |
42 |
|
41 |
43 |
public class TwistySkewb extends TwistyObject
|
42 |
44 |
{
|
43 |
|
private static final float SQ2 = (float)Math.sqrt(2);
|
44 |
|
private static final float SQ3 = (float)Math.sqrt(3);
|
45 |
|
|
46 |
45 |
private static final int FACES_PER_CUBIT =6;
|
47 |
46 |
|
48 |
47 |
// the four rotation axis of a RubikSkewb. Must be normalized.
|
... | ... | |
79 |
78 |
new Static4D( 0.5f, -0.5f, -0.5f, -0.5f )
|
80 |
79 |
};
|
81 |
80 |
|
82 |
|
private static final float DIST_CORNER = 0.50f;
|
83 |
|
private static final float DIST_CENTER = 0.49f;
|
|
81 |
private static final int[][] mCornerMap =
|
|
82 |
{
|
|
83 |
{ 4, 2, 0, 18,18,18 },
|
|
84 |
{ 2, 5, 0, 18,18,18 },
|
|
85 |
{ 3, 4, 0, 18,18,18 },
|
|
86 |
{ 5, 3, 0, 18,18,18 },
|
|
87 |
{ 1, 2, 4, 18,18,18 },
|
|
88 |
{ 5, 2, 1, 18,18,18 },
|
|
89 |
{ 4, 3, 1, 18,18,18 },
|
|
90 |
{ 1, 3, 5, 18,18,18 },
|
|
91 |
};
|
84 |
92 |
|
85 |
|
// centers of the 8 corners + 6 sides ( i.e. of the all 14 cubits)
|
86 |
|
private static final Static3D[] CENTERS = new Static3D[]
|
|
93 |
private static final int[][] mEdgeMap =
|
87 |
94 |
{
|
88 |
|
new Static3D( DIST_CORNER, DIST_CORNER, DIST_CORNER ),
|
89 |
|
new Static3D( DIST_CORNER, DIST_CORNER,-DIST_CORNER ),
|
90 |
|
new Static3D( DIST_CORNER,-DIST_CORNER, DIST_CORNER ),
|
91 |
|
new Static3D( DIST_CORNER,-DIST_CORNER,-DIST_CORNER ),
|
92 |
|
new Static3D(-DIST_CORNER, DIST_CORNER, DIST_CORNER ),
|
93 |
|
new Static3D(-DIST_CORNER, DIST_CORNER,-DIST_CORNER ),
|
94 |
|
new Static3D(-DIST_CORNER,-DIST_CORNER, DIST_CORNER ),
|
95 |
|
new Static3D(-DIST_CORNER,-DIST_CORNER,-DIST_CORNER ),
|
96 |
|
|
97 |
|
new Static3D( DIST_CENTER, 0.0f, 0.0f ),
|
98 |
|
new Static3D(-DIST_CENTER, 0.0f, 0.0f ),
|
99 |
|
new Static3D( 0.0f, DIST_CENTER, 0.0f ),
|
100 |
|
new Static3D( 0.0f,-DIST_CENTER, 0.0f ),
|
101 |
|
new Static3D( 0.0f, 0.0f, DIST_CENTER ),
|
102 |
|
new Static3D( 0.0f, 0.0f,-DIST_CENTER ),
|
|
95 |
{ 10, 8, 18,18,18,18 },
|
|
96 |
{ 6,10, 18,18,18,18 },
|
|
97 |
{ 10, 9, 18,18,18,18 },
|
|
98 |
{ 7,10, 18,18,18,18 },
|
|
99 |
{ 8, 6, 18,18,18,18 },
|
|
100 |
{ 9, 6, 18,18,18,18 },
|
|
101 |
{ 9, 7, 18,18,18,18 },
|
|
102 |
{ 8, 7, 18,18,18,18 },
|
|
103 |
{ 11, 8, 18,18,18,18 },
|
|
104 |
{ 6,11, 18,18,18,18 },
|
|
105 |
{ 11, 9, 18,18,18,18 },
|
|
106 |
{ 7,11, 18,18,18,18 }
|
103 |
107 |
};
|
104 |
108 |
|
105 |
|
// Colors of the faces of cubits. Each cubit, even the face pyramid, has 6 faces
|
106 |
|
// (the face has one extra 'fake' face so that everything would have the same number)
|
107 |
|
private static final int[][] mFaceMap = new int[][]
|
|
109 |
private static final int[][] mCenterMap =
|
108 |
110 |
{
|
109 |
|
{ 4,2,0, 12,12,12 },
|
110 |
|
{ 2,5,0, 12,12,12 },
|
111 |
|
{ 3,4,0, 12,12,12 },
|
112 |
|
{ 5,3,0, 12,12,12 },
|
113 |
|
{ 1,2,4, 12,12,12 },
|
114 |
|
{ 5,2,1, 12,12,12 },
|
115 |
|
{ 4,3,1, 12,12,12 },
|
116 |
|
{ 1,3,5, 12,12,12 },
|
117 |
|
|
118 |
|
{ 6 , 12,12,12,12,12 },
|
119 |
|
{ 7 , 12,12,12,12,12 },
|
120 |
|
{ 8 , 12,12,12,12,12 },
|
121 |
|
{ 9 , 12,12,12,12,12 },
|
122 |
|
{ 10, 12,12,12,12,12 },
|
123 |
|
{ 11, 12,12,12,12,12 },
|
|
111 |
{ 12, 18,18,18,18,18 },
|
|
112 |
{ 13, 18,18,18,18,18 },
|
|
113 |
{ 14, 18,18,18,18,18 },
|
|
114 |
{ 15, 18,18,18,18,18 },
|
|
115 |
{ 16, 18,18,18,18,18 },
|
|
116 |
{ 17, 18,18,18,18,18 },
|
124 |
117 |
};
|
125 |
118 |
|
126 |
|
private static MeshBase mCornerMesh, mFaceMesh;
|
|
119 |
private static MeshBase mCornerMesh, mFaceMesh, mEdgeMesh;
|
127 |
120 |
|
128 |
121 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
129 |
122 |
|
... | ... | |
133 |
126 |
super(size, 60, quat, texture, mesh, effects, moves, ObjectList.SKEW, res, scrWidth);
|
134 |
127 |
}
|
135 |
128 |
|
|
129 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
130 |
|
|
131 |
private int getNumCorners(int size)
|
|
132 |
{
|
|
133 |
return 8;
|
|
134 |
}
|
|
135 |
|
|
136 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
137 |
|
|
138 |
private int getNumEdges(int size)
|
|
139 |
{
|
|
140 |
return (size-2)*12;
|
|
141 |
}
|
|
142 |
|
|
143 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
144 |
|
|
145 |
private int getNumCenters(int size)
|
|
146 |
{
|
|
147 |
return ((size-2)*(size-2) + (size-1)*(size-1))*6;
|
|
148 |
}
|
|
149 |
|
136 |
150 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
137 |
151 |
|
138 |
152 |
float getScreenRatio()
|
139 |
153 |
{
|
140 |
|
return 1.0f;
|
|
154 |
int size = getSize();
|
|
155 |
return size/ (2.0f*(size-1));
|
141 |
156 |
}
|
142 |
157 |
|
143 |
158 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
... | ... | |
162 |
177 |
}
|
163 |
178 |
|
164 |
179 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
165 |
|
// Each face has two types of a texture: the central square and the triangle in the corner.
|
166 |
180 |
|
167 |
181 |
int getNumStickerTypes()
|
168 |
182 |
{
|
169 |
|
return 2;
|
|
183 |
return 3;
|
170 |
184 |
}
|
171 |
185 |
|
172 |
186 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
... | ... | |
187 |
201 |
|
188 |
202 |
Static3D[] getCubitPositions(int size)
|
189 |
203 |
{
|
|
204 |
final float DIST_CORNER = (size-1)*0.50f;
|
|
205 |
final float DIST_EDGE = (size-1)*0.50f;
|
|
206 |
final float DIST_CENTER = (size-1)*0.50f;
|
|
207 |
|
|
208 |
final int numCorners = getNumCorners(size);
|
|
209 |
final int numEdges = getNumEdges(size);
|
|
210 |
final int numCenters = getNumCenters(size);
|
|
211 |
|
|
212 |
final Static3D[] CENTERS = new Static3D[numCorners+numEdges+numCenters];
|
|
213 |
|
|
214 |
/// CORNERS //////////////////////////////////////////////
|
|
215 |
|
|
216 |
CENTERS[0] = new Static3D( DIST_CORNER, DIST_CORNER, DIST_CORNER );
|
|
217 |
CENTERS[1] = new Static3D( DIST_CORNER, DIST_CORNER,-DIST_CORNER );
|
|
218 |
CENTERS[2] = new Static3D( DIST_CORNER,-DIST_CORNER, DIST_CORNER );
|
|
219 |
CENTERS[3] = new Static3D( DIST_CORNER,-DIST_CORNER,-DIST_CORNER );
|
|
220 |
CENTERS[4] = new Static3D(-DIST_CORNER, DIST_CORNER, DIST_CORNER );
|
|
221 |
CENTERS[5] = new Static3D(-DIST_CORNER, DIST_CORNER,-DIST_CORNER );
|
|
222 |
CENTERS[6] = new Static3D(-DIST_CORNER,-DIST_CORNER, DIST_CORNER );
|
|
223 |
CENTERS[7] = new Static3D(-DIST_CORNER,-DIST_CORNER,-DIST_CORNER );
|
|
224 |
|
|
225 |
/// EDGES ///////////////////////////////////////////////
|
|
226 |
|
|
227 |
final float[][] edgeTable =
|
|
228 |
{
|
|
229 |
{0,+DIST_EDGE,+DIST_EDGE},
|
|
230 |
{+DIST_EDGE,0,+DIST_EDGE},
|
|
231 |
{0,-DIST_EDGE,+DIST_EDGE},
|
|
232 |
{-DIST_EDGE,0,+DIST_EDGE},
|
|
233 |
{+DIST_EDGE,+DIST_EDGE,0},
|
|
234 |
{+DIST_EDGE,-DIST_EDGE,0},
|
|
235 |
{-DIST_EDGE,-DIST_EDGE,0},
|
|
236 |
{-DIST_EDGE,+DIST_EDGE,0},
|
|
237 |
{0,+DIST_EDGE,-DIST_EDGE},
|
|
238 |
{+DIST_EDGE,0,-DIST_EDGE},
|
|
239 |
{0,-DIST_EDGE,-DIST_EDGE},
|
|
240 |
{-DIST_EDGE,0,-DIST_EDGE}
|
|
241 |
};
|
|
242 |
|
|
243 |
int index=8;
|
|
244 |
|
|
245 |
for (float[] edges : edgeTable)
|
|
246 |
{
|
|
247 |
float c = (3-size)*0.5f;
|
|
248 |
|
|
249 |
for (int j=0; j<size-2; j++, c+=1.0f, index++)
|
|
250 |
{
|
|
251 |
CENTERS[index] = new Static3D( edges[0]==0 ? c : edges[0] ,
|
|
252 |
edges[1]==0 ? c : edges[1] ,
|
|
253 |
edges[2]==0 ? c : edges[2] );
|
|
254 |
}
|
|
255 |
}
|
|
256 |
|
|
257 |
/// CENTERS //////////////////////////////////////////////
|
|
258 |
|
|
259 |
final float X= -1000.0f;
|
|
260 |
final float Y= -1001.0f;
|
|
261 |
|
|
262 |
final float[][] centerTable =
|
|
263 |
{
|
|
264 |
{+DIST_CENTER,X,Y},
|
|
265 |
{-DIST_CENTER,X,Y},
|
|
266 |
{X,+DIST_CENTER,Y},
|
|
267 |
{X,-DIST_CENTER,Y},
|
|
268 |
{X,Y,+DIST_CENTER},
|
|
269 |
{X,Y,-DIST_CENTER}
|
|
270 |
};
|
|
271 |
|
|
272 |
float x,y, cen0, cen1, cen2;
|
|
273 |
|
|
274 |
for( float[] centers : centerTable )
|
|
275 |
{
|
|
276 |
x = (2-size)*0.5f;
|
|
277 |
|
|
278 |
for(int i=0; i<size-1; i++, x+=1.0f)
|
|
279 |
{
|
|
280 |
y = (2-size)*0.5f;
|
|
281 |
|
|
282 |
for(int j=0; j<size-1; j++, y+=1.0f, index++)
|
|
283 |
{
|
|
284 |
if( centers[0]==Y ) cen0 = y;
|
|
285 |
else if( centers[0]==X ) cen0 = x;
|
|
286 |
else cen0 = centers[0];
|
|
287 |
|
|
288 |
if( centers[1]==Y ) cen1 = y;
|
|
289 |
else if( centers[1]==X ) cen1 = x;
|
|
290 |
else cen1 = centers[1];
|
|
291 |
|
|
292 |
if( centers[2]==Y ) cen2 = y;
|
|
293 |
else if( centers[2]==X ) cen2 = x;
|
|
294 |
else cen2 = centers[2];
|
|
295 |
|
|
296 |
CENTERS[index] = new Static3D(cen0,cen1,cen2);
|
|
297 |
}
|
|
298 |
}
|
|
299 |
|
|
300 |
x = (3-size)*0.5f;
|
|
301 |
|
|
302 |
for(int i=0; i<size-2; i++, x+=1.0f)
|
|
303 |
{
|
|
304 |
y = (3-size)*0.5f;
|
|
305 |
|
|
306 |
for(int j=0; j<size-2; j++, y+=1.0f, index++)
|
|
307 |
{
|
|
308 |
if( centers[0]==Y ) cen0 = y;
|
|
309 |
else if( centers[0]==X ) cen0 = x;
|
|
310 |
else cen0 = centers[0];
|
|
311 |
|
|
312 |
if( centers[1]==Y ) cen1 = y;
|
|
313 |
else if( centers[1]==X ) cen1 = x;
|
|
314 |
else cen1 = centers[1];
|
|
315 |
|
|
316 |
if( centers[2]==Y ) cen2 = y;
|
|
317 |
else if( centers[2]==X ) cen2 = x;
|
|
318 |
else cen2 = centers[2];
|
|
319 |
|
|
320 |
CENTERS[index] = new Static3D(cen0,cen1,cen2);
|
|
321 |
}
|
|
322 |
}
|
|
323 |
}
|
|
324 |
|
190 |
325 |
return CENTERS;
|
191 |
326 |
}
|
192 |
327 |
|
193 |
328 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
194 |
329 |
|
195 |
|
private Static4D getQuat(int cubit)
|
|
330 |
private Static4D getQuat(int cubit, int size)
|
196 |
331 |
{
|
197 |
|
switch(cubit)
|
|
332 |
int numCorners = getNumCorners(size);
|
|
333 |
int numEdges = getNumEdges(size);
|
|
334 |
|
|
335 |
if( cubit<numCorners )
|
|
336 |
{
|
|
337 |
switch(cubit)
|
|
338 |
{
|
|
339 |
case 0: return QUATS[0]; // unit quat
|
|
340 |
case 1: return new Static4D( SQ2/2,0,0,SQ2/2); // 90 along X
|
|
341 |
case 2: return new Static4D(-SQ2/2,0,0,SQ2/2); // -90 along X
|
|
342 |
case 3: return QUATS[1]; // 180 along X
|
|
343 |
case 4: return new Static4D(0, SQ2/2,0,SQ2/2); // 90 along Y
|
|
344 |
case 5: return QUATS[2]; // 180 along Y
|
|
345 |
case 6: return QUATS[3]; // 180 along Z
|
|
346 |
case 7: return new Static4D(SQ2/2,0,-SQ2/2,0); // 180 along (SQ2/2,0,-SQ2/2)
|
|
347 |
}
|
|
348 |
}
|
|
349 |
else if( cubit<numCorners+numEdges )
|
|
350 |
{
|
|
351 |
int edge = (cubit-numCorners)/(size-2);
|
|
352 |
|
|
353 |
switch(edge)
|
|
354 |
{
|
|
355 |
case 0: return QUATS[ 0];
|
|
356 |
case 1: return QUATS[ 5];
|
|
357 |
case 2: return QUATS[ 3];
|
|
358 |
case 3: return QUATS[11];
|
|
359 |
case 4: return QUATS[ 4];
|
|
360 |
case 5: return QUATS[ 7];
|
|
361 |
case 6: return QUATS[ 9];
|
|
362 |
case 7: return QUATS[10];
|
|
363 |
case 8: return QUATS[ 2];
|
|
364 |
case 9: return QUATS[ 8];
|
|
365 |
case 10: return QUATS[ 1];
|
|
366 |
case 11: return QUATS[ 6];
|
|
367 |
}
|
|
368 |
}
|
|
369 |
else
|
198 |
370 |
{
|
199 |
|
case 0: return QUATS[0]; // unit quat
|
200 |
|
case 1: return new Static4D( SQ2/2,0,0,SQ2/2); // 90 along X
|
201 |
|
case 2: return new Static4D(-SQ2/2,0,0,SQ2/2); // -90 along X
|
202 |
|
case 3: return QUATS[1]; // 180 along X
|
203 |
|
case 4: return new Static4D(0, SQ2/2,0,SQ2/2); // 90 along Y
|
204 |
|
case 5: return QUATS[2]; // 180 along Y
|
205 |
|
case 6: return QUATS[3]; // 180 along Z
|
206 |
|
case 7: return new Static4D(SQ2/2,0,-SQ2/2,0); // 180 along (SQ2/2,0,-SQ2/2)
|
207 |
|
case 8: return new Static4D(0,-SQ2/2,0,SQ2/2); // -90 along Y
|
208 |
|
case 9: return new Static4D(0, SQ2/2,0,SQ2/2); // 90 along Y
|
209 |
|
case 10: return new Static4D( SQ2/2,0,0,SQ2/2); // 90 along X
|
210 |
|
case 11: return new Static4D(-SQ2/2,0,0,SQ2/2); // -90 along X
|
211 |
|
case 12: return QUATS[0]; // unit quaternion
|
212 |
|
case 13: return QUATS[1]; // 180 along X
|
|
371 |
int center = (cubit-numCorners-numEdges)/((size-2)*(size-2)+(size-1)*(size-1));
|
|
372 |
|
|
373 |
switch(center)
|
|
374 |
{
|
|
375 |
case 0: return new Static4D(0,-SQ2/2,0,SQ2/2); // -90 along Y
|
|
376 |
case 1: return new Static4D(0, SQ2/2,0,SQ2/2); // 90 along Y
|
|
377 |
case 2: return new Static4D( SQ2/2,0,0,SQ2/2); // 90 along X
|
|
378 |
case 3: return new Static4D(-SQ2/2,0,0,SQ2/2); // -90 along X
|
|
379 |
case 4: return QUATS[0]; // unit quaternion
|
|
380 |
case 5: return QUATS[1]; // 180 along X
|
|
381 |
}
|
213 |
382 |
}
|
214 |
383 |
|
215 |
384 |
return null;
|
... | ... | |
221 |
390 |
{
|
222 |
391 |
MeshBase mesh;
|
223 |
392 |
|
224 |
|
if( cubit<8 )
|
|
393 |
int size = getSize();
|
|
394 |
int numCorners = getNumCorners(size);
|
|
395 |
int numEdges = getNumEdges(size);
|
|
396 |
|
|
397 |
if( cubit<numCorners )
|
225 |
398 |
{
|
226 |
399 |
if( mCornerMesh==null ) mCornerMesh = CubitFactory.getInstance().createSkewbCornerMesh();
|
227 |
400 |
mesh = mCornerMesh.copy(true);
|
228 |
401 |
}
|
|
402 |
else if( cubit<numCorners+numEdges )
|
|
403 |
{
|
|
404 |
if( mEdgeMesh==null )
|
|
405 |
{
|
|
406 |
mEdgeMesh = CubitFactory.getInstance().createDinoMesh();
|
|
407 |
MatrixEffect effect = new MatrixEffectScale(1.0f/3);
|
|
408 |
mEdgeMesh.apply(effect,-1,0);
|
|
409 |
mEdgeMesh.addEmptyTexComponent();
|
|
410 |
mEdgeMesh.addEmptyTexComponent();
|
|
411 |
}
|
|
412 |
mesh = mEdgeMesh.copy(true);
|
|
413 |
}
|
229 |
414 |
else
|
230 |
415 |
{
|
231 |
416 |
if( mFaceMesh==null ) mFaceMesh = CubitFactory.getInstance().createSkewbFaceMesh();
|
232 |
417 |
mesh = mFaceMesh.copy(true);
|
233 |
418 |
}
|
234 |
419 |
|
235 |
|
MatrixEffectQuaternion quat = new MatrixEffectQuaternion( getQuat(cubit), new Static3D(0,0,0) );
|
|
420 |
MatrixEffectQuaternion quat = new MatrixEffectQuaternion( getQuat(cubit,size), new Static3D(0,0,0) );
|
236 |
421 |
mesh.apply(quat,0xffffffff,0);
|
237 |
422 |
|
238 |
423 |
return mesh;
|
... | ... | |
242 |
427 |
|
243 |
428 |
int getFaceColor(int cubit, int cubitface, int size)
|
244 |
429 |
{
|
245 |
|
return mFaceMap[cubit][cubitface];
|
|
430 |
int numCorners = getNumCorners(size);
|
|
431 |
int numEdges = getNumEdges(size);
|
|
432 |
|
|
433 |
if( cubit<numCorners )
|
|
434 |
{
|
|
435 |
return mCornerMap[cubit][cubitface];
|
|
436 |
}
|
|
437 |
else if( cubit<numCorners+numEdges )
|
|
438 |
{
|
|
439 |
int edge = (cubit-numCorners)/(size-2);
|
|
440 |
return mEdgeMap[edge][cubitface];
|
|
441 |
}
|
|
442 |
else
|
|
443 |
{
|
|
444 |
int center = (cubit-numCorners-numEdges)/((size-2)*(size-2)+(size-1)*(size-1));
|
|
445 |
return mCenterMap[center][cubitface];
|
|
446 |
}
|
246 |
447 |
}
|
247 |
448 |
|
248 |
449 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
... | ... | |
259 |
460 |
float[] vertices = { -E+E/4,E/4, E/4,-E+E/4, E/4,E/4};
|
260 |
461 |
drawRoundedPolygon(canvas, paint, left, vertices, S, FACE_COLORS[face], R);
|
261 |
462 |
}
|
|
463 |
else if( face<2*COLORS )
|
|
464 |
{
|
|
465 |
float F = 0.5f;
|
|
466 |
float R = 0.025f;
|
|
467 |
float S = 0.05f;
|
|
468 |
float[] vertices = { -F,F/3, 0,-2*F/3, +F,F/3 };
|
|
469 |
|
|
470 |
drawRoundedPolygon(canvas, paint, left, vertices, S, FACE_COLORS[face-COLORS], R);
|
|
471 |
}
|
262 |
472 |
else
|
263 |
473 |
{
|
264 |
474 |
float R = 0.055f;
|
265 |
475 |
float S = 0.035f;
|
266 |
476 |
float E = SQ2/4;
|
267 |
477 |
float[] vertices = { -E,-E, +E,-E, +E,+E, -E,+E };
|
268 |
|
drawRoundedPolygon(canvas, paint, left, vertices, S, FACE_COLORS[face-COLORS], R);
|
|
478 |
drawRoundedPolygon(canvas, paint, left, vertices, S, FACE_COLORS[face-2*COLORS], R);
|
269 |
479 |
}
|
270 |
480 |
}
|
271 |
481 |
|
... | ... | |
280 |
490 |
|
281 |
491 |
float[] getRowChances()
|
282 |
492 |
{
|
283 |
|
float[] chances = new float[2];
|
|
493 |
int size = getSize();
|
|
494 |
float[] chances = new float[size];
|
284 |
495 |
|
285 |
|
chances[0] = 0.5f;
|
286 |
|
chances[1] = 1.0f;
|
|
496 |
for(int i=0; i<size; i++)
|
|
497 |
{
|
|
498 |
chances[i] = (float)(i+1)/size;
|
|
499 |
}
|
287 |
500 |
|
288 |
501 |
return chances;
|
289 |
502 |
}
|
... | ... | |
378 |
591 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
379 |
592 |
// The Skewb is solved if and only if:
|
380 |
593 |
//
|
381 |
|
// 1) all of its corner cubits are rotated with the same quat
|
|
594 |
// 1) all of its corner and edge cubits are rotated with the same quat
|
382 |
595 |
// 2) all its face cubits are rotated with the same quat like the corner ones,
|
383 |
596 |
// and optionally they also might be upside down.
|
384 |
597 |
//
|
Beginnings of support for any-sized Skewb.