Revision 0203be88
Added by Leszek Koltunski over 3 years ago
src/main/java/org/distorted/objects/TwistyBandagedAbstract.java | ||
---|---|---|
535 | 535 |
return getNumLayers(); |
536 | 536 |
} |
537 | 537 |
|
538 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
539 |
|
|
540 |
float[] getRowChances(int numLayers) |
|
541 |
{ |
|
542 |
float[] chances = new float[numLayers]; |
|
543 |
|
|
544 |
for(int i=0; i<numLayers; i++) |
|
545 |
{ |
|
546 |
chances[i] = (i+1.0f) / numLayers; |
|
547 |
} |
|
548 |
|
|
549 |
return chances; |
|
550 |
} |
|
551 |
|
|
552 | 538 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
553 | 539 |
// PUBLIC API |
554 | 540 |
|
src/main/java/org/distorted/objects/TwistyBandagedEvil.java | ||
---|---|---|
263 | 263 |
case 1: mUseX = true ; mUseY = false; mUseZ = true ; break; |
264 | 264 |
case 2: mUseX = true ; mUseY = true ; mUseZ = false; break; |
265 | 265 |
} |
266 |
|
|
267 |
//android.util.Log.e("D", (info[0]==0 ? "X" : (info[0]==1 ? "Y" : "Z")) + info[2] +" --> "+info[3]); |
|
268 | 266 |
} |
269 | 267 |
|
270 | 268 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
src/main/java/org/distorted/objects/TwistyBandagedFused.java | ||
---|---|---|
103 | 103 |
} |
104 | 104 |
|
105 | 105 |
float rowFloat = rnd.nextFloat(); |
106 |
int numLayers = getNumLayers(); |
|
106 | 107 |
|
107 |
for(int row=0; row<mRowChances.length; row++)
|
|
108 |
for(int row=0; row<numLayers; row++)
|
|
108 | 109 |
{ |
109 |
if( rowFloat<=mRowChances[row] )
|
|
110 |
if( rowFloat*numLayers <= row+1 )
|
|
110 | 111 |
{ |
111 | 112 |
scramble[num][1] = row; |
112 | 113 |
break; |
src/main/java/org/distorted/objects/TwistyCube.java | ||
---|---|---|
277 | 277 |
return getNumLayers(); |
278 | 278 |
} |
279 | 279 |
|
280 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
281 |
|
|
282 |
float[] getRowChances(int numLayers) |
|
283 |
{ |
|
284 |
float[] chances = new float[numLayers]; |
|
285 |
|
|
286 |
for(int i=0; i<numLayers; i++) |
|
287 |
{ |
|
288 |
chances[i] = (i+1.0f) / numLayers; |
|
289 |
} |
|
290 |
|
|
291 |
return chances; |
|
292 |
} |
|
293 |
|
|
294 | 280 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
295 | 281 |
// PUBLIC API |
296 | 282 |
|
... | ... | |
321 | 307 |
} |
322 | 308 |
|
323 | 309 |
float rowFloat = rnd.nextFloat(); |
310 |
int numLayers = getNumLayers(); |
|
324 | 311 |
|
325 |
for(int row=0; row<mRowChances.length; row++)
|
|
312 |
for(int row=0; row<numLayers; row++)
|
|
326 | 313 |
{ |
327 |
if( rowFloat<=mRowChances[row] )
|
|
314 |
if( rowFloat*numLayers <= row+1 )
|
|
328 | 315 |
{ |
329 | 316 |
scramble[num][1] = row; |
330 | 317 |
break; |
src/main/java/org/distorted/objects/TwistyDiamond.java | ||
---|---|---|
500 | 500 |
return 1.5f; |
501 | 501 |
} |
502 | 502 |
|
503 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
504 |
|
|
505 |
float[] getRowChances(int numLayers) |
|
506 |
{ |
|
507 |
float[] chances = new float[numLayers]; |
|
508 |
|
|
509 |
for(int i=0; i<numLayers; i++) chances[i] = ((float)(i+1))/numLayers; |
|
510 |
|
|
511 |
return chances; |
|
512 |
} |
|
513 |
|
|
514 | 503 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
515 | 504 |
// PUBLIC API |
516 | 505 |
|
... | ... | |
541 | 530 |
} |
542 | 531 |
|
543 | 532 |
float rowFloat = rnd.nextFloat(); |
533 |
int numLayers = getNumLayers(); |
|
544 | 534 |
|
545 |
for(int row=0; row<mRowChances.length; row++)
|
|
535 |
for(int row=0; row<numLayers; row++)
|
|
546 | 536 |
{ |
547 |
if( rowFloat<=mRowChances[row] )
|
|
537 |
if( rowFloat*numLayers <= row+1 )
|
|
548 | 538 |
{ |
549 | 539 |
scramble[num][1] = row; |
550 | 540 |
break; |
src/main/java/org/distorted/objects/TwistyDino.java | ||
---|---|---|
226 | 226 |
return 2.0f; |
227 | 227 |
} |
228 | 228 |
|
229 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
230 |
|
|
231 |
float[] getRowChances(int numLayers) |
|
232 |
{ |
|
233 |
float[] chances = new float[3]; |
|
234 |
|
|
235 |
chances[0] = 0.5f; |
|
236 |
chances[1] = 0.5f; |
|
237 |
chances[2] = 1.0f; |
|
238 |
|
|
239 |
return chances; |
|
240 |
} |
|
241 |
|
|
242 | 229 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
243 | 230 |
// PUBLIC API |
244 | 231 |
|
src/main/java/org/distorted/objects/TwistyHelicopter.java | ||
---|---|---|
393 | 393 |
return 2.0f; |
394 | 394 |
} |
395 | 395 |
|
396 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
397 |
|
|
398 |
float[] getRowChances(int numLayers) |
|
399 |
{ |
|
400 |
float[] chances = new float[3]; |
|
401 |
|
|
402 |
chances[0] = 0.5f; |
|
403 |
chances[1] = 0.5f; |
|
404 |
chances[2] = 1.0f; |
|
405 |
|
|
406 |
return chances; |
|
407 |
} |
|
408 |
|
|
409 | 396 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
410 | 397 |
// PUBLIC API |
411 | 398 |
|
... | ... | |
446 | 433 |
} |
447 | 434 |
} |
448 | 435 |
|
449 |
float rowFloat = rnd.nextFloat(); |
|
450 |
|
|
451 |
for(int row=0; row<mRowChances.length; row++) |
|
452 |
{ |
|
453 |
if( rowFloat<=mRowChances[row] ) |
|
454 |
{ |
|
455 |
scramble[num][1] = row; |
|
456 |
break; |
|
457 |
} |
|
458 |
} |
|
436 |
scramble[num][1] = rnd.nextFloat()<=0.5f ? 0 : 2; |
|
459 | 437 |
|
460 | 438 |
switch( rnd.nextInt(2) ) |
461 | 439 |
{ |
src/main/java/org/distorted/objects/TwistyIvy.java | ||
---|---|---|
416 | 416 |
return 2.0f; |
417 | 417 |
} |
418 | 418 |
|
419 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
420 |
|
|
421 |
float[] getRowChances(int numLayers) |
|
422 |
{ |
|
423 |
float[] chances = new float[2]; |
|
424 |
chances[0] = 0.5f; |
|
425 |
chances[1] = 1.0f; |
|
426 |
|
|
427 |
return chances; |
|
428 |
} |
|
429 |
|
|
430 | 419 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
431 | 420 |
// PUBLIC API |
432 | 421 |
|
... | ... | |
456 | 445 |
scramble[num][0] = (newVector>=scramble[num-1][0] ? newVector+1 : newVector); |
457 | 446 |
} |
458 | 447 |
|
459 |
float rowFloat = rnd.nextFloat(); |
|
460 |
|
|
461 |
for(int row=0; row<mRowChances.length; row++) |
|
462 |
{ |
|
463 |
if( rowFloat<=mRowChances[row] ) |
|
464 |
{ |
|
465 |
scramble[num][1] = row; |
|
466 |
break; |
|
467 |
} |
|
468 |
} |
|
448 |
scramble[num][1] = rnd.nextFloat()<=0.5f ? 0 : 1; |
|
469 | 449 |
|
470 | 450 |
switch( rnd.nextInt(2) ) |
471 | 451 |
{ |
src/main/java/org/distorted/objects/TwistyMinx.java | ||
---|---|---|
324 | 324 |
mBasicCornerV[2] = new Static4D( 0, -0.500f, 0.0f, 0.0f ); |
325 | 325 |
} |
326 | 326 |
|
327 |
private static float[] mRowChances; |
|
327 | 328 |
|
328 | 329 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
329 | 330 |
|
... | ... | |
333 | 334 |
super(numLayers, realSize, quat, texture, mesh, effects, moves, obj, res, scrWidth); |
334 | 335 |
} |
335 | 336 |
|
337 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
338 |
|
|
339 |
private float[] getRowChances(int numLayers) |
|
340 |
{ |
|
341 |
float[] chances = new float[numLayers]; |
|
342 |
float denom = (float)(numLayers-1); |
|
343 |
int change = (numLayers-1)/2; |
|
344 |
|
|
345 |
for(int i= 0; i<change ; i++) chances[i] = (i+1)/denom; |
|
346 |
for(int i=change; i<numLayers; i++) chances[i] = (i )/denom; |
|
347 |
|
|
348 |
return chances; |
|
349 |
} |
|
350 |
|
|
336 | 351 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
337 | 352 |
|
338 | 353 |
Static4D[] getQuats() |
... | ... | |
368 | 383 |
return 2.0f; |
369 | 384 |
} |
370 | 385 |
|
371 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
372 |
|
|
373 |
float[] getRowChances(int numLayers) |
|
374 |
{ |
|
375 |
float[] chances = new float[numLayers]; |
|
376 |
float denom = (float)(numLayers-1); |
|
377 |
int change = (numLayers-1)/2; |
|
378 |
|
|
379 |
for(int i= 0; i<change ; i++) chances[i] = (i+1)/denom; |
|
380 |
for(int i=change; i<numLayers; i++) chances[i] = (i )/denom; |
|
381 |
|
|
382 |
return chances; |
|
383 |
} |
|
384 |
|
|
385 | 386 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
386 | 387 |
|
387 | 388 |
MeshBase createCornerMesh(int numLayers, float width) |
... | ... | |
458 | 459 |
|
459 | 460 |
public void randomizeNewScramble(int[][] scramble, Random rnd, int num) |
460 | 461 |
{ |
462 |
int numLayers = getNumLayers(); |
|
463 |
|
|
464 |
if( mRowChances==null ) mRowChances = getRowChances(numLayers); |
|
465 |
|
|
461 | 466 |
if( num==0 ) |
462 | 467 |
{ |
463 | 468 |
scramble[num][0] = rnd.nextInt(ROTATION_AXIS.length); |
... | ... | |
472 | 477 |
{ |
473 | 478 |
float rowFloat = rnd.nextFloat(); |
474 | 479 |
|
475 |
for(int row=0; row<mRowChances.length; row++)
|
|
480 |
for(int row=0; row<numLayers; row++)
|
|
476 | 481 |
{ |
477 | 482 |
if( rowFloat<=mRowChances[row] ) |
478 | 483 |
{ |
... | ... | |
483 | 488 |
} |
484 | 489 |
else |
485 | 490 |
{ |
486 |
int size = mRowChances.length; |
|
487 |
int nom = (size-1)/2; |
|
491 |
int nom = (numLayers-1)/2; |
|
488 | 492 |
int row = rnd.nextInt(nom); |
489 | 493 |
boolean opposite = OPPOSITE_ROWS[scramble[num-1][0]][scramble[num][0]]; |
490 | 494 |
boolean low = opposite^(scramble[num-1][1]<nom); |
491 |
scramble[num][1] = low ? row : size-1-row;
|
|
495 |
scramble[num][1] = low ? row : numLayers-1-row;
|
|
492 | 496 |
} |
493 | 497 |
|
494 | 498 |
switch( rnd.nextInt(4) ) |
src/main/java/org/distorted/objects/TwistyObject.java | ||
---|---|---|
118 | 118 |
private int mRotAxis; |
119 | 119 |
private MeshBase mMesh; |
120 | 120 |
|
121 |
float[] mRowChances; |
|
122 | 121 |
Static1D mRotationAngleStatic, mRotationAngleMiddle, mRotationAngleFinal; |
123 | 122 |
DistortedTexture mTexture; |
124 | 123 |
MatrixEffectScale mScaleEffect; |
... | ... | |
159 | 158 |
mNodeScale= new Static3D(1,NODE_RATIO,1); |
160 | 159 |
mQuat = quat; |
161 | 160 |
|
162 |
mRowChances = getRowChances(mNumLayers); |
|
163 |
|
|
164 | 161 |
mRotationAngle= new Dynamic1D(); |
165 | 162 |
mRotationAxis = new Static3D(1,0,0); |
166 | 163 |
mRotateEffect = new VertexEffectRotate(mRotationAngle, mRotationAxis, CENTER); |
... | ... | |
965 | 962 |
abstract void createFaceTexture(Canvas canvas, Paint paint, int face, int left, int top); |
966 | 963 |
abstract int getFaceColor(int cubit, int cubitface, int numLayers); |
967 | 964 |
abstract float returnMultiplier(); |
968 |
abstract float[] getRowChances(int numLayers); |
|
969 | 965 |
abstract float[] getCuts(int numLayers); |
970 | 966 |
abstract boolean shouldResetTextureMaps(); |
971 | 967 |
|
src/main/java/org/distorted/objects/TwistyPyraminx.java | ||
---|---|---|
114 | 114 |
}; |
115 | 115 |
|
116 | 116 |
private static MeshBase[] mMeshes; |
117 |
private static float[] mRowChances; |
|
117 | 118 |
|
118 | 119 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
119 | 120 |
|
... | ... | |
123 | 124 |
super(size, size, quat, texture, mesh, effects, moves, ObjectList.PYRA, res, scrWidth); |
124 | 125 |
} |
125 | 126 |
|
127 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
128 |
|
|
129 |
private float[] getRowChances(int numLayers) |
|
130 |
{ |
|
131 |
int total = numLayers*(numLayers+1)/2; |
|
132 |
float running=0.0f; |
|
133 |
float[] chances = new float[numLayers]; |
|
134 |
|
|
135 |
for(int i=0; i<numLayers; i++) |
|
136 |
{ |
|
137 |
running += (numLayers-i); |
|
138 |
chances[i] = running / total; |
|
139 |
} |
|
140 |
|
|
141 |
return chances; |
|
142 |
} |
|
143 |
|
|
126 | 144 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
127 | 145 |
|
128 | 146 |
private void addTetrahedralLattice(int size, int index, float[][] pos) |
... | ... | |
349 | 367 |
return getNumLayers()/(SQ6/3); |
350 | 368 |
} |
351 | 369 |
|
352 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
353 |
|
|
354 |
float[] getRowChances(int numLayers) |
|
355 |
{ |
|
356 |
int total = numLayers*(numLayers+1)/2; |
|
357 |
float running=0.0f; |
|
358 |
float[] chances = new float[numLayers]; |
|
359 |
|
|
360 |
for(int i=0; i<numLayers; i++) |
|
361 |
{ |
|
362 |
running += (numLayers-i); |
|
363 |
chances[i] = running / total; |
|
364 |
} |
|
365 |
|
|
366 |
return chances; |
|
367 |
} |
|
368 |
|
|
369 | 370 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
370 | 371 |
// PUBLIC API |
371 | 372 |
|
... | ... | |
385 | 386 |
|
386 | 387 |
public void randomizeNewScramble(int[][] scramble, Random rnd, int num) |
387 | 388 |
{ |
389 |
int numLayers = getNumLayers(); |
|
390 |
|
|
391 |
if( mRowChances==null ) mRowChances = getRowChances(numLayers); |
|
392 |
|
|
388 | 393 |
if( num==0 ) |
389 | 394 |
{ |
390 | 395 |
scramble[num][0] = rnd.nextInt(ROTATION_AXIS.length); |
... | ... | |
397 | 402 |
|
398 | 403 |
float rowFloat = rnd.nextFloat(); |
399 | 404 |
|
400 |
for(int row=0; row<mRowChances.length; row++)
|
|
405 |
for(int row=0; row<numLayers; row++)
|
|
401 | 406 |
{ |
402 | 407 |
if( rowFloat<=mRowChances[row] ) |
403 | 408 |
{ |
src/main/java/org/distorted/objects/TwistyRedi.java | ||
---|---|---|
406 | 406 |
return 2.0f; |
407 | 407 |
} |
408 | 408 |
|
409 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
410 |
|
|
411 |
float[] getRowChances(int numLayers) |
|
412 |
{ |
|
413 |
float[] chances = new float[3]; |
|
414 |
|
|
415 |
chances[0] = 0.5f; |
|
416 |
chances[1] = 0.5f; |
|
417 |
chances[2] = 1.0f; |
|
418 |
|
|
419 |
return chances; |
|
420 |
} |
|
421 |
|
|
422 | 409 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
423 | 410 |
// PUBLIC API |
424 | 411 |
|
src/main/java/org/distorted/objects/TwistyRex.java | ||
---|---|---|
581 | 581 |
return 2.0f; |
582 | 582 |
} |
583 | 583 |
|
584 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
585 |
|
|
586 |
float[] getRowChances(int numLayers) |
|
587 |
{ |
|
588 |
return new float[] { 0.5f, 0.5f, 1.0f }; |
|
589 |
} |
|
590 |
|
|
591 | 584 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
592 | 585 |
// PUBLIC API |
593 | 586 |
|
... | ... | |
617 | 610 |
scramble[num][0] = (newVector>=scramble[num-1][0] ? newVector+1 : newVector); |
618 | 611 |
} |
619 | 612 |
|
620 |
float rowFloat = rnd.nextFloat(); |
|
621 |
|
|
622 |
for(int row=0; row<mRowChances.length; row++) |
|
623 |
{ |
|
624 |
if( rowFloat<=mRowChances[row] ) |
|
625 |
{ |
|
626 |
scramble[num][1] = row; |
|
627 |
break; |
|
628 |
} |
|
629 |
} |
|
613 |
scramble[num][1] = rnd.nextFloat()<=0.5f ? 0 : 2; |
|
630 | 614 |
|
631 | 615 |
switch( rnd.nextInt(2) ) |
632 | 616 |
{ |
src/main/java/org/distorted/objects/TwistySkewb.java | ||
---|---|---|
601 | 601 |
return 2.0f; |
602 | 602 |
} |
603 | 603 |
|
604 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
605 |
|
|
606 |
float[] getRowChances(int numLayers) |
|
607 |
{ |
|
608 |
float[] chances = new float[numLayers]; |
|
609 |
|
|
610 |
switch(numLayers) |
|
611 |
{ |
|
612 |
case 2: chances[0] = 0.5f; |
|
613 |
chances[1] = 1.0f; |
|
614 |
break; |
|
615 |
case 3: chances[0] = 0.5f; |
|
616 |
chances[1] = 0.5f; |
|
617 |
chances[2] = 1.0f; |
|
618 |
break; |
|
619 |
default:for(int i=0; i<numLayers; i++) |
|
620 |
{ |
|
621 |
chances[i] = (float)(i+1)/numLayers; |
|
622 |
} |
|
623 |
} |
|
624 |
|
|
625 |
return chances; |
|
626 |
} |
|
627 |
|
|
628 | 604 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
629 | 605 |
// PUBLIC API |
630 | 606 |
|
... | ... | |
654 | 630 |
scramble[num][0] = (newVector>=scramble[num-1][0] ? newVector+1 : newVector); |
655 | 631 |
} |
656 | 632 |
|
657 |
float rowFloat = rnd.nextFloat(); |
|
658 |
|
|
659 |
for(int row=0; row<mRowChances.length; row++) |
|
660 |
{ |
|
661 |
if( rowFloat<=mRowChances[row] ) |
|
662 |
{ |
|
663 |
scramble[num][1] = row; |
|
664 |
break; |
|
665 |
} |
|
666 |
} |
|
633 |
scramble[num][1] = rnd.nextFloat()<=0.5f ? 0 : getNumLayers()-1; |
|
667 | 634 |
|
668 | 635 |
switch( rnd.nextInt(2) ) |
669 | 636 |
{ |
src/main/java/org/distorted/objects/TwistySquare1.java | ||
---|---|---|
200 | 200 |
{ 5,NUM_ST,2, 2,NUM_ST,NUM_ST } |
201 | 201 |
}; |
202 | 202 |
|
203 |
// YELLOW 0 WHITE 1 BLUE 2 GREEN 3 RED 4 ORANGE 5
|
|
203 |
// YELLOW 0 WHITE 1 BLUE 2 GREEN 3 RED 4 ORANGE 5 |
|
204 | 204 |
private static final int[][] mStickerColor = new int[][] |
205 | 205 |
{ |
206 | 206 |
{ 0, 0, 4, 0, 5, 0 }, |
... | ... | |
350 | 350 |
{ |
351 | 351 |
case 0: R = 0.06f; S = 0.05f; break; |
352 | 352 |
case 1: R = 0.04f; S = 0.04f; break; |
353 |
case 2: R = 0.10f; S = 0.08f; break;
|
|
353 |
case 2: R = 0.11f; S = 0.09f; break;
|
|
354 | 354 |
case 3: R = 0.03f; S = 0.05f; break; |
355 | 355 |
case 4: R = 0.11f; S = 0.08f; break; |
356 | 356 |
case 5: R = 0.08f; S = 0.08f; break; |
... | ... | |
445 | 445 |
return 1.0f; |
446 | 446 |
} |
447 | 447 |
|
448 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
449 |
// TODO |
|
450 |
|
|
451 |
float[] getRowChances(int numLayers) |
|
452 |
{ |
|
453 |
float[] chances = new float[numLayers]; |
|
454 |
|
|
455 |
for(int i=0; i<numLayers; i++) |
|
456 |
{ |
|
457 |
chances[i] = (i+1.0f) / numLayers; |
|
458 |
} |
|
459 |
|
|
460 |
return chances; |
|
461 |
} |
|
462 |
|
|
463 | 448 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
464 | 449 |
// PUBLIC API |
465 | 450 |
|
... | ... | |
491 | 476 |
scramble[num][0] = (newVector>=scramble[num-1][0] ? newVector+1 : newVector); |
492 | 477 |
} |
493 | 478 |
|
494 |
float rowFloat = rnd.nextFloat(); |
|
495 |
|
|
496 |
for(int row=0; row<mRowChances.length; row++) |
|
497 |
{ |
|
498 |
if( rowFloat<=mRowChances[row] ) |
|
499 |
{ |
|
500 |
scramble[num][1] = row; |
|
501 |
break; |
|
502 |
} |
|
503 |
} |
|
479 |
scramble[num][1] = rnd.nextFloat()<=0.5f ? 0 : 1; |
|
504 | 480 |
|
505 | 481 |
switch( rnd.nextInt(4) ) |
506 | 482 |
{ |
src/main/java/org/distorted/objects/TwistyUltimate.java | ||
---|---|---|
424 | 424 |
return 0.67f; |
425 | 425 |
} |
426 | 426 |
|
427 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
428 |
|
|
429 |
float[] getRowChances(int numLayers) |
|
430 |
{ |
|
431 |
float[] chances = new float[2]; |
|
432 |
chances[0] = 0.5f; |
|
433 |
chances[1] = 1.0f; |
|
434 |
|
|
435 |
return chances; |
|
436 |
} |
|
437 |
|
|
438 | 427 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
439 | 428 |
// PUBLIC API |
440 | 429 |
|
... | ... | |
464 | 453 |
scramble[num][0] = (newVector>=scramble[num-1][0] ? newVector+1 : newVector); |
465 | 454 |
} |
466 | 455 |
|
467 |
float rowFloat = rnd.nextFloat(); |
|
468 |
|
|
469 |
for(int row=0; row<mRowChances.length; row++) |
|
470 |
{ |
|
471 |
if( rowFloat<=mRowChances[row] ) |
|
472 |
{ |
|
473 |
scramble[num][1] = row; |
|
474 |
break; |
|
475 |
} |
|
476 |
} |
|
456 |
scramble[num][1] = rnd.nextFloat()<=0.5f ? 0 : 1; |
|
477 | 457 |
|
478 | 458 |
switch( rnd.nextInt(2) ) |
479 | 459 |
{ |
Also available in: Unified diff
Remove the need for RowChances.