Revision eff371f4
Added by Leszek Koltunski over 4 years ago
| src/main/java/org/distorted/objects/TwistyBandaged2Bar.java | ||
|---|---|---|
| 27 | 27 |
import org.distorted.library.type.Static4D; |
| 28 | 28 |
import org.distorted.main.R; |
| 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 |
class TwistyBandaged2Bar extends TwistyBandagedAbstract |
| ... | ... | |
| 97 | 101 |
|
| 98 | 102 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 99 | 103 |
// PUBLIC API |
| 104 |
// TODO |
|
| 105 |
public int randomizeNewRotAxis(Random rnd, int oldRotAxis) |
|
| 106 |
{
|
|
| 107 |
int numAxis = ROTATION_AXIS.length; |
|
| 108 |
|
|
| 109 |
if( oldRotAxis == START_AXIS ) |
|
| 110 |
{
|
|
| 111 |
return rnd.nextInt(numAxis); |
|
| 112 |
} |
|
| 113 |
else |
|
| 114 |
{
|
|
| 115 |
int newVector = rnd.nextInt(numAxis-1); |
|
| 116 |
return (newVector>=oldRotAxis ? newVector+1 : newVector); |
|
| 117 |
} |
|
| 118 |
} |
|
| 119 |
|
|
| 120 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 121 |
// TODO |
|
| 122 |
|
|
| 123 |
public int randomizeNewRow(Random rnd, int oldRotAxis, int oldRow, int newRotAxis) |
|
| 124 |
{
|
|
| 125 |
float rowFloat = rnd.nextFloat(); |
|
| 126 |
|
|
| 127 |
for(int row=0; row<mRowChances.length; row++) |
|
| 128 |
{
|
|
| 129 |
if( rowFloat<=mRowChances[row] ) return row; |
|
| 130 |
} |
|
| 131 |
|
|
| 132 |
return 0; |
|
| 133 |
} |
|
| 134 |
|
|
| 135 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 100 | 136 |
|
| 101 | 137 |
public int getObjectName(int numLayers) |
| 102 | 138 |
{
|
| src/main/java/org/distorted/objects/TwistyBandaged3Plate.java | ||
|---|---|---|
| 27 | 27 |
import org.distorted.library.type.Static4D; |
| 28 | 28 |
import org.distorted.main.R; |
| 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 |
class TwistyBandaged3Plate extends TwistyBandagedAbstract |
| ... | ... | |
| 103 | 107 |
|
| 104 | 108 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 105 | 109 |
// PUBLIC API |
| 110 |
// TODO |
|
| 111 |
public int randomizeNewRotAxis(Random rnd, int oldRotAxis) |
|
| 112 |
{
|
|
| 113 |
int numAxis = ROTATION_AXIS.length; |
|
| 114 |
|
|
| 115 |
if( oldRotAxis == START_AXIS ) |
|
| 116 |
{
|
|
| 117 |
return rnd.nextInt(numAxis); |
|
| 118 |
} |
|
| 119 |
else |
|
| 120 |
{
|
|
| 121 |
int newVector = rnd.nextInt(numAxis-1); |
|
| 122 |
return (newVector>=oldRotAxis ? newVector+1 : newVector); |
|
| 123 |
} |
|
| 124 |
} |
|
| 125 |
|
|
| 126 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 127 |
// TODO |
|
| 128 |
|
|
| 129 |
public int randomizeNewRow(Random rnd, int oldRotAxis, int oldRow, int newRotAxis) |
|
| 130 |
{
|
|
| 131 |
float rowFloat = rnd.nextFloat(); |
|
| 132 |
|
|
| 133 |
for(int row=0; row<mRowChances.length; row++) |
|
| 134 |
{
|
|
| 135 |
if( rowFloat<=mRowChances[row] ) return row; |
|
| 136 |
} |
|
| 137 |
|
|
| 138 |
return 0; |
|
| 139 |
} |
|
| 140 |
|
|
| 141 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 106 | 142 |
|
| 107 | 143 |
public int getObjectName(int numLayers) |
| 108 | 144 |
{
|
| src/main/java/org/distorted/objects/TwistyBandagedAbstract.java | ||
|---|---|---|
| 371 | 371 |
} |
| 372 | 372 |
|
| 373 | 373 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 374 |
// TODO |
|
| 375 |
|
|
| 376 |
public int randomizeNewRotAxis(Random rnd, int oldRotAxis) |
|
| 377 |
{
|
|
| 378 |
int numAxis = ROTATION_AXIS.length; |
|
| 379 |
|
|
| 380 |
if( oldRotAxis == START_AXIS ) |
|
| 381 |
{
|
|
| 382 |
return rnd.nextInt(numAxis); |
|
| 383 |
} |
|
| 384 |
else |
|
| 385 |
{
|
|
| 386 |
int newVector = rnd.nextInt(numAxis-1); |
|
| 387 |
return (newVector>=oldRotAxis ? newVector+1 : newVector); |
|
| 388 |
} |
|
| 389 |
} |
|
| 390 |
|
|
| 391 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 392 |
// TODO |
|
| 393 |
|
|
| 394 |
public int randomizeNewRow(Random rnd, int oldRotAxis, int oldRow, int newRotAxis) |
|
| 395 |
{
|
|
| 396 |
float rowFloat = rnd.nextFloat(); |
|
| 397 |
|
|
| 398 |
for(int row=0; row<mRowChances.length; row++) |
|
| 399 |
{
|
|
| 400 |
if( rowFloat<=mRowChances[row] ) return row; |
|
| 401 |
} |
|
| 402 |
|
|
| 403 |
return 0; |
|
| 404 |
} |
|
| 405 |
|
|
| 406 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 407 |
// TODO |
|
| 408 | 374 |
|
| 409 | 375 |
public boolean isSolved() |
| 410 | 376 |
{
|
| src/main/java/org/distorted/objects/TwistyBandagedEvil.java | ||
|---|---|---|
| 27 | 27 |
import org.distorted.library.type.Static4D; |
| 28 | 28 |
import org.distorted.main.R; |
| 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 |
class TwistyBandagedEvil extends TwistyBandagedAbstract |
| ... | ... | |
| 115 | 119 |
|
| 116 | 120 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 117 | 121 |
// PUBLIC API |
| 122 |
// TODO |
|
| 123 |
public int randomizeNewRotAxis(Random rnd, int oldRotAxis) |
|
| 124 |
{
|
|
| 125 |
int numAxis = ROTATION_AXIS.length; |
|
| 126 |
|
|
| 127 |
if( oldRotAxis == START_AXIS ) |
|
| 128 |
{
|
|
| 129 |
return rnd.nextInt(numAxis); |
|
| 130 |
} |
|
| 131 |
else |
|
| 132 |
{
|
|
| 133 |
int newVector = rnd.nextInt(numAxis-1); |
|
| 134 |
return (newVector>=oldRotAxis ? newVector+1 : newVector); |
|
| 135 |
} |
|
| 136 |
} |
|
| 137 |
|
|
| 138 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 139 |
// TODO |
|
| 140 |
|
|
| 141 |
public int randomizeNewRow(Random rnd, int oldRotAxis, int oldRow, int newRotAxis) |
|
| 142 |
{
|
|
| 143 |
float rowFloat = rnd.nextFloat(); |
|
| 144 |
|
|
| 145 |
for(int row=0; row<mRowChances.length; row++) |
|
| 146 |
{
|
|
| 147 |
if( rowFloat<=mRowChances[row] ) return row; |
|
| 148 |
} |
|
| 149 |
|
|
| 150 |
return 0; |
|
| 151 |
} |
|
| 152 |
|
|
| 153 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 118 | 154 |
|
| 119 | 155 |
public int getObjectName(int numLayers) |
| 120 | 156 |
{
|
| src/main/java/org/distorted/objects/TwistyBandagedFused.java | ||
|---|---|---|
| 27 | 27 |
import org.distorted.library.type.Static4D; |
| 28 | 28 |
import org.distorted.main.R; |
| 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 |
class TwistyBandagedFused extends TwistyBandagedAbstract |
| ... | ... | |
| 99 | 103 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 100 | 104 |
// PUBLIC API |
| 101 | 105 |
|
| 106 |
public int randomizeNewRotAxis(Random rnd, int oldRotAxis) |
|
| 107 |
{
|
|
| 108 |
int numAxis = ROTATION_AXIS.length; |
|
| 109 |
|
|
| 110 |
if( oldRotAxis == START_AXIS ) |
|
| 111 |
{
|
|
| 112 |
return rnd.nextInt(numAxis); |
|
| 113 |
} |
|
| 114 |
else |
|
| 115 |
{
|
|
| 116 |
int newVector = rnd.nextInt(numAxis-1); |
|
| 117 |
return (newVector>=oldRotAxis ? newVector+1 : newVector); |
|
| 118 |
} |
|
| 119 |
} |
|
| 120 |
|
|
| 121 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 122 |
|
|
| 123 |
public int randomizeNewRow(Random rnd, int oldRotAxis, int oldRow, int newRotAxis) |
|
| 124 |
{
|
|
| 125 |
float rowFloat = rnd.nextFloat(); |
|
| 126 |
|
|
| 127 |
for(int row=0; row<mRowChances.length; row++) |
|
| 128 |
{
|
|
| 129 |
if( rowFloat<=mRowChances[row] ) return row; |
|
| 130 |
} |
|
| 131 |
|
|
| 132 |
return 0; |
|
| 133 |
} |
|
| 134 |
|
|
| 135 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 136 |
|
|
| 102 | 137 |
public int getObjectName(int numLayers) |
| 103 | 138 |
{
|
| 104 | 139 |
return R.string.bandaged_fused; |
Also available in: Unified diff
Bandaged objects: first step making automatic scrambling work.