Project

General

Profile

« Previous | Next » 

Revision 6b6504fe

Added by Leszek Koltunski almost 4 years ago

Finally fix the Dino's 'isSolved()' - Dino can be mirrored and then it is also solved!

View differences:

src/main/java/org/distorted/objects/RubikPyraminx.java
486 486
    return 0;
487 487
    }
488 488

  
489
///////////////////////////////////////////////////////////////////////////////////////////////////
490

  
491
  public boolean isSolved()
492
    {
493
    int index = CUBITS[0].mQuatIndex;
494

  
495
    for(int i=1; i<NUM_CUBITS; i++)
496
      {
497
      if( !thereIsNoVisibleDifference(CUBITS[i], index) ) return false;
498
      }
499

  
500
    return true;
501
    }
502

  
489 503
///////////////////////////////////////////////////////////////////////////////////////////////////
490 504
// return if the Cubit, when rotated with its own mQuatScramble, would have looked any different
491 505
// then if it were rotated by quaternion 'quat'.
......
496 510
// a) is a corner or edge and the quaternions are the same
497 511
// b) is inside one of the faces and after rotations by both quats it ends up on the same face.
498 512

  
499
  boolean thereIsNoVisibleDifference(Cubit cubit, int quatIndex)
513
  private boolean thereIsNoVisibleDifference(Cubit cubit, int quatIndex)
500 514
    {
501 515
    if ( cubit.mQuatIndex == quatIndex ) return true;
502 516

  

Also available in: Unified diff