Revision 95123ad0
Added by Leszek Koltunski about 2 years ago
src/main/java/org/distorted/objectlib/scrambling/ObjectScrambler.java | ||
---|---|---|
51 | 51 |
private int mLastRot; |
52 | 52 |
private int[][] mQuatMult; |
53 | 53 |
|
54 |
// type=2 , i.e. locally created bandaged 3x3s
|
|
54 |
// type=2 , i.e. locally created bandaged cuboids
|
|
55 | 55 |
private static long mSignature; |
56 |
private ArrayList<ScrambleStateBandaged3x3> mBandagedStates;
|
|
56 |
private ArrayList<ScrambleStateBandagedCuboid> mBandagedStates;
|
|
57 | 57 |
|
58 | 58 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
59 | 59 |
|
... | ... | |
410 | 410 |
|
411 | 411 |
private void buildMoveForced(int[][] scramble, Random rnd, int curr) |
412 | 412 |
{ |
413 |
ScrambleStateBandaged3x3 currState = mBandagedStates.get(curr);
|
|
414 |
int indexExcluded = curr>0 ? scramble[curr-1][0] : ScrambleStateBandaged3x3.AXIS_NONE;
|
|
413 |
ScrambleStateBandagedCuboid currState = mBandagedStates.get(curr);
|
|
414 |
int indexExcluded = curr>0 ? scramble[curr-1][0] : ScrambleStateBandagedCuboid.AXIS_NONE;
|
|
415 | 415 |
int numMoves = currState.numMoves(indexExcluded); |
416 | 416 |
|
417 | 417 |
if( numMoves==0 ) |
418 | 418 |
{ |
419 |
indexExcluded = ScrambleStateBandaged3x3.AXIS_NONE;
|
|
419 |
indexExcluded = ScrambleStateBandagedCuboid.AXIS_NONE;
|
|
420 | 420 |
numMoves = currState.numMoves(indexExcluded); |
421 | 421 |
} |
422 | 422 |
|
... | ... | |
443 | 443 |
} |
444 | 444 |
} |
445 | 445 |
|
446 |
ScrambleStateBandaged3x3 nextState = new ScrambleStateBandaged3x3(mSignature);
|
|
446 |
ScrambleStateBandagedCuboid nextState = new ScrambleStateBandagedCuboid(mSignature);
|
|
447 | 447 |
mBandagedStates.add(nextState); |
448 | 448 |
} |
449 | 449 |
|
... | ... | |
452 | 452 |
|
453 | 453 |
private boolean buildMove(int[][] scramble, Random rnd, int curr) |
454 | 454 |
{ |
455 |
ScrambleStateBandaged3x3 currState = mBandagedStates.get(curr);
|
|
456 |
int indexExcluded = curr>0 ? scramble[curr-1][0] : ScrambleStateBandaged3x3.AXIS_NONE;
|
|
455 |
ScrambleStateBandagedCuboid currState = mBandagedStates.get(curr);
|
|
456 |
int indexExcluded = curr>0 ? scramble[curr-1][0] : ScrambleStateBandagedCuboid.AXIS_NONE;
|
|
457 | 457 |
int numMoves = currState.numMoves(indexExcluded); |
458 | 458 |
|
459 | 459 |
while( numMoves==0 ) |
... | ... | |
461 | 461 |
if( curr>0 ) |
462 | 462 |
{ |
463 | 463 |
mBandagedStates.remove(curr); |
464 |
ScrambleStateBandaged3x3 prevState = mBandagedStates.get(curr-1);
|
|
464 |
ScrambleStateBandagedCuboid prevState = mBandagedStates.get(curr-1);
|
|
465 | 465 |
long signature = currState.getID(); |
466 | 466 |
prevState.removeMoves(signature); |
467 | 467 |
boolean result = buildMove(scramble,rnd,curr-1); |
... | ... | |
490 | 490 |
case 2: scramble[curr][2] = 1; break; |
491 | 491 |
} |
492 | 492 |
|
493 |
ScrambleStateBandaged3x3 nextState = new ScrambleStateBandaged3x3(mSignature);
|
|
493 |
ScrambleStateBandagedCuboid nextState = new ScrambleStateBandagedCuboid(mSignature);
|
|
494 | 494 |
mBandagedStates.add(nextState); |
495 | 495 |
|
496 | 496 |
return true; |
... | ... | |
504 | 504 |
if( mBandagedStates==null ) mBandagedStates = new ArrayList<>(); |
505 | 505 |
else mBandagedStates.clear(); |
506 | 506 |
|
507 |
ScrambleStateBandaged3x3 state = new ScrambleStateBandaged3x3(mSignature);
|
|
507 |
ScrambleStateBandagedCuboid state = new ScrambleStateBandagedCuboid(mSignature);
|
|
508 | 508 |
mBandagedStates.add(state); |
509 | 509 |
boolean success = true; |
510 | 510 |
|
... | ... | |
521 | 521 |
if( !success ) |
522 | 522 |
{ |
523 | 523 |
mBandagedStates.clear(); |
524 |
state = new ScrambleStateBandaged3x3(mSignature);
|
|
524 |
state = new ScrambleStateBandagedCuboid(mSignature);
|
|
525 | 525 |
mBandagedStates.add(state); |
526 | 526 |
|
527 | 527 |
for(int curr=0; curr<total; curr++) |
... | ... | |
540 | 540 |
} |
541 | 541 |
|
542 | 542 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
543 |
// TYPE 2 (locally-created bandaged 3x3s)
|
|
543 |
// TYPE 2 (locally-created bandaged cuboids)
|
|
544 | 544 |
|
545 | 545 |
private void randomizeNewScramble2(int[][] scramble, Random rnd, int curr, int total) |
546 | 546 |
{ |
Also available in: Unified diff
Bandaged: progress with creating the object.