Revision bbc6471c
Added by Leszek Koltunski about 3 years ago
src/main/java/org/distorted/objects/TwistyBandagedEvil.java | ||
---|---|---|
29 | 29 |
|
30 | 30 |
import java.util.Random; |
31 | 31 |
|
32 |
import static org.distorted.effects.scramble.ScrambleEffect.START_AXIS; |
|
33 |
|
|
34 | 32 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
35 | 33 |
|
36 | 34 |
class TwistyBandagedEvil extends TwistyBandagedAbstract |
... | ... | |
120 | 118 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
121 | 119 |
// PUBLIC API |
122 | 120 |
// TODO |
123 |
public int randomizeNewRotAxis(Random rnd, int oldRotAxis) |
|
124 |
{ |
|
125 |
int numAxis = ROTATION_AXIS.length; |
|
126 | 121 |
|
127 |
if( oldRotAxis == START_AXIS ) |
|
122 |
public void randomizeNewScramble(int[] scramble, Random rnd, int oldRotAxis, int oldRow, |
|
123 |
int numScramble, int remScrambles, int remDoubleScrambles) |
|
124 |
{ |
|
125 |
if( numScramble==1 ) |
|
128 | 126 |
{ |
129 |
return rnd.nextInt(numAxis);
|
|
127 |
scramble[0] = rnd.nextInt(ROTATION_AXIS.length);
|
|
130 | 128 |
} |
131 | 129 |
else |
132 | 130 |
{ |
133 |
int newVector = rnd.nextInt(numAxis-1);
|
|
134 |
return (newVector>=oldRotAxis ? newVector+1 : newVector);
|
|
131 |
int newVector = rnd.nextInt(ROTATION_AXIS.length-1);
|
|
132 |
scramble[0] = (newVector>=oldRotAxis ? newVector+1 : newVector);
|
|
135 | 133 |
} |
136 |
} |
|
137 | 134 |
|
138 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
139 |
// TODO |
|
140 |
|
|
141 |
public int randomizeNewRow(Random rnd, int oldRotAxis, int oldRow, int newRotAxis) |
|
142 |
{ |
|
143 | 135 |
float rowFloat = rnd.nextFloat(); |
144 | 136 |
|
145 | 137 |
for(int row=0; row<mRowChances.length; row++) |
146 | 138 |
{ |
147 |
if( rowFloat<=mRowChances[row] ) return row; |
|
139 |
if( rowFloat<=mRowChances[row] ) |
|
140 |
{ |
|
141 |
scramble[1] = row; |
|
142 |
break; |
|
143 |
} |
|
148 | 144 |
} |
149 | 145 |
|
150 |
return 0; |
|
146 |
int random = rnd.nextInt(remScrambles); |
|
147 |
int result = random<remDoubleScrambles ? 2:1; |
|
148 |
int sign = rnd.nextInt(2); |
|
149 |
|
|
150 |
scramble[2] = sign==0 ? result : -result; |
|
151 | 151 |
} |
152 | 152 |
|
153 | 153 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
Also available in: Unified diff
Change the automatic scramble API in the TwistyObject - in preparation for automatic scrambles in the Bandaged Objects.