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 |
}
|
Finish implementing Jing's 'isSolved'