Project

General

Profile

« Previous | Next » 

Revision 94ad5a8f

Added by Leszek Koltunski about 4 years ago

Fix the way we detect if an Object is solved.
Previous way would not detect situations when the object looks solved, but one of the cubits inside its faces - a non-corner and non-edge - is rotated and ends up on the same face.

View differences:

src/main/java/org/distorted/object/RubikObject.java
377 377
    {
378 378
    Static4D q = mCubits[0].mQuatScramble;
379 379

  
380
    float x = q.get0();
381
    float y = q.get1();
382
    float z = q.get2();
383
    float w = q.get3();
384

  
385
    for(int i=0; i<NUM_CUBITS; i++)
380
    for(int i=1; i<NUM_CUBITS; i++)
386 381
      {
387
      q = mCubits[i].mQuatScramble;
388

  
389
      if( q.get0()!=x || q.get1()!=y || q.get2()!=z || q.get3()!=w ) return false;
382
      if( !mCubits[i].thereIsNoVisibleDifference(q) ) return false;
390 383
      }
391 384

  
392 385
    return true;
......
407 400
      return;
408 401
      }
409 402

  
410
    //android.util.Log.e("object", "beginning new rotation: axis: "+axis+" row: "+row);
411

  
412 403
    mRotAxis = axis;
413 404
    mRotRow  = row;
414 405

  

Also available in: Unified diff