Project

General

Profile

« Previous | Next » 

Revision a480ee80

Added by Leszek Koltunski over 2 years ago

Standarize the 'isSolved()' method: now all objects, except one (Dino4) have a standard isSolved().
This incidentally also fixes detection of the solved state in case of Diamond4, i.e. a Master FTO.

View differences:

src/main/java/org/distorted/objects/TwistyRedi.java
213 213
    super(size, size, quat, texture, mesh, effects, moves, ObjectList.REDI, res, scrWidth);
214 214
    }
215 215

  
216
///////////////////////////////////////////////////////////////////////////////////////////////////
217

  
218
  int[] getSolvedQuats(int cubit, int numLayers)
219
    {
220
    int status = retCubitSolvedStatus(cubit,numLayers);
221
    return status<0 ? null : buildSolvedQuats(MovementRedi.FACE_AXIS[status],QUATS);
222
    }
223

  
216 224
///////////////////////////////////////////////////////////////////////////////////////////////////
217 225

  
218 226
  float getScreenRatio()
......
478 486
      }
479 487
    }
480 488

  
481
///////////////////////////////////////////////////////////////////////////////////////////////////
482
// The Redi is solved if and only if all cubits are rotated with the same quat.
483

  
484
  public boolean isSolved()
485
    {
486
    int q = CUBITS[0].mQuatIndex;
487

  
488
    return ( CUBITS[ 1].mQuatIndex == q &&
489
             CUBITS[ 2].mQuatIndex == q &&
490
             CUBITS[ 3].mQuatIndex == q &&
491
             CUBITS[ 4].mQuatIndex == q &&
492
             CUBITS[ 5].mQuatIndex == q &&
493
             CUBITS[ 6].mQuatIndex == q &&
494
             CUBITS[ 7].mQuatIndex == q &&
495
             CUBITS[ 8].mQuatIndex == q &&
496
             CUBITS[ 9].mQuatIndex == q &&
497
             CUBITS[10].mQuatIndex == q &&
498
             CUBITS[11].mQuatIndex == q &&
499
             CUBITS[12].mQuatIndex == q &&
500
             CUBITS[13].mQuatIndex == q &&
501
             CUBITS[14].mQuatIndex == q &&
502
             CUBITS[15].mQuatIndex == q &&
503
             CUBITS[16].mQuatIndex == q &&
504
             CUBITS[17].mQuatIndex == q &&
505
             CUBITS[18].mQuatIndex == q &&
506
             CUBITS[19].mQuatIndex == q  );
507
    }
508

  
509 489
///////////////////////////////////////////////////////////////////////////////////////////////////
510 490

  
511 491
  public int getObjectName(int numLayers)

Also available in: Unified diff