Revision 2067efd8
Added by Leszek Koltunski about 5 years ago
| src/main/java/org/distorted/objects/RubikDino.java | ||
|---|---|---|
| 411 | 411 |
} |
| 412 | 412 |
} |
| 413 | 413 |
|
| 414 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 415 |
|
|
| 416 |
public int randomizeNewRow(Random rnd, int oldRotAxis, int oldRow, int newRotAxis) |
|
| 417 |
{
|
|
| 418 |
float rowFloat = rnd.nextFloat(); |
|
| 419 |
|
|
| 420 |
switch(oldRotAxis) |
|
| 421 |
{
|
|
| 422 |
case 0 : switch(newRotAxis) |
|
| 423 |
{
|
|
| 424 |
case 1: |
|
| 425 |
case 2: return oldRow; |
|
| 426 |
case 3: return 2-oldRow; |
|
| 427 |
default: android.util.Log.e("dino", "error: oldRotAxis="+oldRotAxis+" newRotAxis:"+newRotAxis);
|
|
| 428 |
} |
|
| 429 |
case 1 : switch(newRotAxis) |
|
| 430 |
{
|
|
| 431 |
case 0: |
|
| 432 |
case 3: return oldRow; |
|
| 433 |
case 2: return 2-oldRow; |
|
| 434 |
default: android.util.Log.e("dino", "error: oldRotAxis="+oldRotAxis+" newRotAxis:"+newRotAxis);
|
|
| 435 |
} |
|
| 436 |
case 2 : switch(newRotAxis) |
|
| 437 |
{
|
|
| 438 |
case 0: |
|
| 439 |
case 3: return oldRow; |
|
| 440 |
case 1: return 2-oldRow; |
|
| 441 |
default: android.util.Log.e("dino", "error: oldRotAxis="+oldRotAxis+" newRotAxis:"+newRotAxis);
|
|
| 442 |
} |
|
| 443 |
case 3 : switch(newRotAxis) |
|
| 444 |
{
|
|
| 445 |
case 1: |
|
| 446 |
case 2: return oldRow; |
|
| 447 |
case 0: return 2-oldRow; |
|
| 448 |
default: android.util.Log.e("dino", "error: oldRotAxis="+oldRotAxis+" newRotAxis:"+newRotAxis);
|
|
| 449 |
} |
|
| 450 |
default: return rowFloat<=0.5f ? 0:2; |
|
| 451 |
} |
|
| 452 |
} |
|
| 453 |
|
|
| 454 | 414 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 455 | 415 |
// only needed for solvers - there are no Dino solvers ATM) |
| 456 | 416 |
|
| src/main/java/org/distorted/objects/RubikDino4.java | ||
|---|---|---|
| 25 | 25 |
import org.distorted.library.main.DistortedTexture; |
| 26 | 26 |
import org.distorted.library.mesh.MeshSquare; |
| 27 | 27 |
import org.distorted.library.type.Static4D; |
| 28 |
import org.distorted.main.RubikSurfaceView; |
|
| 28 |
|
|
| 29 |
import java.util.Random; |
|
| 30 |
|
|
| 31 |
import static org.distorted.effects.scramble.ScrambleEffect.START_AXIS; |
|
| 29 | 32 |
|
| 30 | 33 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 31 | 34 |
|
| ... | ... | |
| 62 | 65 |
return true; |
| 63 | 66 |
} |
| 64 | 67 |
|
| 68 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 69 |
|
|
| 70 |
public int randomizeNewRow(Random rnd, int oldRotAxis, int oldRow, int newRotAxis) |
|
| 71 |
{
|
|
| 72 |
return (oldRotAxis==START_AXIS) ? ((newRotAxis==1 || newRotAxis==2) ? 0:2) : (oldRotAxis+newRotAxis==3 ? 2-oldRow : oldRow); |
|
| 73 |
} |
|
| 74 |
|
|
| 65 | 75 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 66 | 76 |
// Dino4 is solved if and only if the four groups of three same-colored cubits each are rotate with |
| 67 | 77 |
// the same quaternion (actually we need to check only 3 first groups - if those are correct, the |
| src/main/java/org/distorted/objects/RubikDino6.java | ||
|---|---|---|
| 27 | 27 |
import org.distorted.library.type.Static4D; |
| 28 | 28 |
import org.distorted.main.RubikSurfaceView; |
| 29 | 29 |
|
| 30 |
import java.util.Random; |
|
| 31 |
|
|
| 32 |
import static org.distorted.effects.scramble.ScrambleEffect.START_AXIS; |
|
| 33 |
|
|
| 30 | 34 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 31 | 35 |
|
| 32 | 36 |
public class RubikDino6 extends RubikDino |
| ... | ... | |
| 102 | 106 |
return false; |
| 103 | 107 |
} |
| 104 | 108 |
|
| 109 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 110 |
|
|
| 111 |
public int randomizeNewRow(Random rnd, int oldRotAxis, int oldRow, int newRotAxis) |
|
| 112 |
{
|
|
| 113 |
return (oldRotAxis==START_AXIS) ? (rnd.nextFloat()<=0.5f ? 0:2) : (oldRotAxis+newRotAxis==3 ? 2-oldRow : oldRow); |
|
| 114 |
} |
|
| 115 |
|
|
| 105 | 116 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 106 | 117 |
// Dino6 is solved if and only if: |
| 107 | 118 |
// |
Also available in: Unified diff
Fully support the 4-color Dino.