Revision bbc6471c
Added by Leszek Koltunski about 3 years ago
src/main/java/org/distorted/objects/TwistyBandaged3Plate.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 TwistyBandaged3Plate extends TwistyBandagedAbstract |
... | ... | |
108 | 106 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
109 | 107 |
// PUBLIC API |
110 | 108 |
// TODO |
111 |
public int randomizeNewRotAxis(Random rnd, int oldRotAxis) |
|
112 |
{ |
|
113 |
int numAxis = ROTATION_AXIS.length; |
|
114 | 109 |
|
115 |
if( oldRotAxis == START_AXIS ) |
|
110 |
public void randomizeNewScramble(int[] scramble, Random rnd, int oldRotAxis, int oldRow, |
|
111 |
int numScramble, int remScrambles, int remDoubleScrambles) |
|
112 |
{ |
|
113 |
if( numScramble==1 ) |
|
116 | 114 |
{ |
117 |
return rnd.nextInt(numAxis);
|
|
115 |
scramble[0] = rnd.nextInt(ROTATION_AXIS.length);
|
|
118 | 116 |
} |
119 | 117 |
else |
120 | 118 |
{ |
121 |
int newVector = rnd.nextInt(numAxis-1);
|
|
122 |
return (newVector>=oldRotAxis ? newVector+1 : newVector);
|
|
119 |
int newVector = rnd.nextInt(ROTATION_AXIS.length-1);
|
|
120 |
scramble[0] = (newVector>=oldRotAxis ? newVector+1 : newVector);
|
|
123 | 121 |
} |
124 |
} |
|
125 |
|
|
126 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
127 |
// TODO |
|
128 | 122 |
|
129 |
public int randomizeNewRow(Random rnd, int oldRotAxis, int oldRow, int newRotAxis) |
|
130 |
{ |
|
131 | 123 |
float rowFloat = rnd.nextFloat(); |
132 | 124 |
|
133 | 125 |
for(int row=0; row<mRowChances.length; row++) |
134 | 126 |
{ |
135 |
if( rowFloat<=mRowChances[row] ) return row; |
|
127 |
if( rowFloat<=mRowChances[row] ) |
|
128 |
{ |
|
129 |
scramble[1] = row; |
|
130 |
break; |
|
131 |
} |
|
136 | 132 |
} |
137 | 133 |
|
138 |
return 0; |
|
134 |
int random = rnd.nextInt(remScrambles); |
|
135 |
int result = random<remDoubleScrambles ? 2:1; |
|
136 |
int sign = rnd.nextInt(2); |
|
137 |
|
|
138 |
scramble[2] = sign==0 ? result : -result; |
|
139 | 139 |
} |
140 | 140 |
|
141 | 141 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
Also available in: Unified diff
Change the automatic scramble API in the TwistyObject - in preparation for automatic scrambles in the Bandaged Objects.