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/RubikCube.java
394 394
    return 0;
395 395
    }
396 396

  
397
///////////////////////////////////////////////////////////////////////////////////////////////////
398

  
399
  public boolean isSolved()
400
    {
401
    int index = CUBITS[0].mQuatIndex;
402

  
403
    for(int i=1; i<NUM_CUBITS; i++)
404
      {
405
      if( !thereIsNoVisibleDifference(CUBITS[i], index) ) return false;
406
      }
407

  
408
    return true;
409
    }
410

  
397 411
///////////////////////////////////////////////////////////////////////////////////////////////////
398 412
// return if the Cubit, when rotated with its own mQuatScramble, would have looked any different
399 413
// then if it were rotated by quaternion 'quat'.
......
404 418
// a) is a corner or edge and the quaternions are the same
405 419
// b) is inside one of the faces and after rotations by both quats it ends up on the same face.
406 420

  
407
  boolean thereIsNoVisibleDifference(Cubit cubit, int quatIndex)
421
  private boolean thereIsNoVisibleDifference(Cubit cubit, int quatIndex)
408 422
    {
409 423
    if ( cubit.mQuatIndex == quatIndex ) return true;
410 424

  

Also available in: Unified diff