Project

General

Profile

« Previous | Next » 

Revision d5ca9927

Added by Leszek Koltunski over 3 years ago

Finish implementing Jing's 'isSolved'

View differences:

src/main/java/org/distorted/objects/ObjectList.java
51 51

  
52 52
  JING (
53 53
         new int[][] {
54
                       {2 , 10, 10, R.raw.jing, R.drawable.ui_small_jing2, R.drawable.ui_medium_jing2, R.drawable.ui_big_jing2, R.drawable.ui_huge_jing2} ,
54
                       {2 , 11, 11, R.raw.jing, R.drawable.ui_small_jing2, R.drawable.ui_medium_jing2, R.drawable.ui_big_jing2, R.drawable.ui_huge_jing2} ,
55 55
                     },
56 56
         TwistyJing.class,
57 57
         new MovementJing(),
src/main/java/org/distorted/objects/TwistyJing.java
437 437
// b) its 4 face cubits might also be rotated along the axis perpendicular to the face.
438 438
//
439 439
// So:
440
// [10] might be extra QUAT[] or QUAT[]
441
// [11] might be extra QUAT[] or QUAT[]
442
// [12] might be extra QUAT[] or QUAT[]
443
// [13] might be extra QUAT[] or QUAT[]
440
// [10] might be extra QUAT[4] or QUAT[8]
441
// [11] might be extra QUAT[5] or QUAT[9]
442
// [12] might be extra QUAT[2] or QUAT[6]
443
// [13] might be extra QUAT[3] or QUAT[7]
444 444

  
445 445
  public boolean isSolved()
446 446
    {
447
    int index = CUBITS[0].mQuatIndex;
448

  
449
    if( CUBITS[1].mQuatIndex != index ) return false;
450
    if( CUBITS[2].mQuatIndex != index ) return false;
451
    if( CUBITS[3].mQuatIndex != index ) return false;
452
    if( CUBITS[4].mQuatIndex != index ) return false;
453
    if( CUBITS[5].mQuatIndex != index ) return false;
454
    if( CUBITS[6].mQuatIndex != index ) return false;
455
    if( CUBITS[7].mQuatIndex != index ) return false;
456
    if( CUBITS[8].mQuatIndex != index ) return false;
457
    if( CUBITS[9].mQuatIndex != index ) return false;
458

  
459
    // TODO: face cubits
447
    int q1, q = CUBITS[0].mQuatIndex;
448

  
449
    if( CUBITS[1].mQuatIndex != q ) return false;
450
    if( CUBITS[2].mQuatIndex != q ) return false;
451
    if( CUBITS[3].mQuatIndex != q ) return false;
452
    if( CUBITS[4].mQuatIndex != q ) return false;
453
    if( CUBITS[5].mQuatIndex != q ) return false;
454
    if( CUBITS[6].mQuatIndex != q ) return false;
455
    if( CUBITS[7].mQuatIndex != q ) return false;
456
    if( CUBITS[8].mQuatIndex != q ) return false;
457
    if( CUBITS[9].mQuatIndex != q ) return false;
458

  
459
    q1 = CUBITS[10].mQuatIndex;
460
    if( q1!=q && q1!=mulQuat(q,4) && q1!=mulQuat(q,8) ) return false;
461
    q1 = CUBITS[11].mQuatIndex;
462
    if( q1!=q && q1!=mulQuat(q,5) && q1!=mulQuat(q,9) ) return false;
463
    q1 = CUBITS[12].mQuatIndex;
464
    if( q1!=q && q1!=mulQuat(q,2) && q1!=mulQuat(q,6) ) return false;
465
    q1 = CUBITS[13].mQuatIndex;
466
    if( q1!=q && q1!=mulQuat(q,3) && q1!=mulQuat(q,7) ) return false;
460 467

  
461 468
    return true;
462 469
    }
......
487 494

  
488 495
  public int getComplexity(int numLayers)
489 496
    {
490
    return 3;
497
    return 4;
491 498
    }
492 499
}
src/main/java/org/distorted/objects/TwistySkewb.java
714 714
    {
715 715
    switch(numLayers)
716 716
      {
717
      case 2: return 5;
718
      case 3: return 9;
717
      case 2: return 4;
718
      case 3: return 8;
719 719
      }
720 720
    return 5;
721 721
    }

Also available in: Unified diff