Project

General

Profile

« Previous | Next » 

Revision 6cf89a3e

Added by Leszek Koltunski over 2 years ago

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.

View differences:

src/main/java/org/distorted/objects/TwistyObject.java
453 453
    {
454 454
    if( mSolvedFunctionIndex==0 ) return isSolved0();
455 455
    if( mSolvedFunctionIndex==1 ) return isSolved1();
456
    if( mSolvedFunctionIndex==2 ) return isSolved2();
456 457

  
457 458
    return false;
458 459
    }
......
555 556
    return false;
556 557
    }
557 558

  
559
///////////////////////////////////////////////////////////////////////////////////////////////////
560
// Dino6 uses this. It is solved if and only if:
561
//
562
// All four 'X' cubits (i.e. those whose longest edge goes along the X axis) are rotated
563
// by the same quaternion qX, similarly all four 'Y' cubits by the same qY and all four 'Z'
564
// by the same qZ, and then either:
565
//
566
// a) qX = qY = qZ
567
// b) qY = qX*Q2 and qZ = qX*Q8  (i.e. swap of WHITE and YELLOW faces)
568
// c) qX = qY*Q2 and qZ = qY*Q10 (i.e. swap of BLUE and GREEN faces)
569
// d) qX = qZ*Q8 and qY = qZ*Q10 (i.e. swap of RED and BROWN faces)
570
//
571
// BUT: cases b), c) and d) are really the same - it's all just a mirror image of the original.
572
//
573
// X cubits: 0, 2, 8, 10
574
// Y cubits: 1, 3, 9, 11
575
// Z cubits: 4, 5, 6, 7
576

  
577
  public boolean isSolved2()
578
    {
579
    int qX = CUBITS[0].mQuatIndex;
580
    int qY = CUBITS[1].mQuatIndex;
581
    int qZ = CUBITS[4].mQuatIndex;
582

  
583
    if( CUBITS[2].mQuatIndex != qX || CUBITS[8].mQuatIndex != qX || CUBITS[10].mQuatIndex != qX ||
584
        CUBITS[3].mQuatIndex != qY || CUBITS[9].mQuatIndex != qY || CUBITS[11].mQuatIndex != qY ||
585
        CUBITS[5].mQuatIndex != qZ || CUBITS[6].mQuatIndex != qZ || CUBITS[ 7].mQuatIndex != qZ  )
586
      {
587
      return false;
588
      }
589

  
590
    return ( qX==qY && qX==qZ ) || ( qY==mulQuat(qX,2) && qZ==mulQuat(qX,8) );
591

  
592
    }
593

  
558 594
///////////////////////////////////////////////////////////////////////////////////////////////////
559 595

  
560 596
  public void setObjectRatio(float sizeChange)

Also available in: Unified diff