Revision 5cf34c5f
Added by Leszek Koltunski about 4 years ago
src/main/java/org/distorted/effects/scramble/ScrambleEffect.java | ||
---|---|---|
72 | 72 |
private RubikObject mObject; |
73 | 73 |
private int mNumAxis; |
74 | 74 |
private int mBasicAngle; |
75 |
private int mSize;
|
|
75 |
private float[] mRowChances;
|
|
76 | 76 |
|
77 | 77 |
Effect[] mNodeEffects; |
78 | 78 |
int[] mNodeEffectPosition; |
... | ... | |
142 | 142 |
mLastVector = (newVector>=mLastVector ? newVector+1 : newVector); |
143 | 143 |
} |
144 | 144 |
|
145 |
int rowBitmap = (1<<mRnd.nextInt(mSize)); |
|
145 |
int row=0; |
|
146 |
float rowFloat = mRnd.nextFloat(); |
|
147 |
|
|
148 |
for(int i=0; i<mRowChances.length; i++) |
|
149 |
{ |
|
150 |
if( rowFloat<=mRowChances[i] ) |
|
151 |
{ |
|
152 |
row=i; |
|
153 |
break; |
|
154 |
} |
|
155 |
} |
|
156 |
|
|
157 |
int rowBitmap = (1<<row); |
|
146 | 158 |
int angle= randomizeAngle(); |
147 | 159 |
int absAngle = (angle<0 ? -angle : angle); |
148 |
long durationMillis = absAngle*mDurationSingleTurn;
|
|
160 |
long durationMillis = absAngle*mDurationSingleTurn; |
|
149 | 161 |
|
150 | 162 |
mNumScramblesLeft--; |
151 | 163 |
if( absAngle==2 ) mNumDoubleScramblesLeft--; |
... | ... | |
306 | 318 |
{ |
307 | 319 |
mObject = post.getObject(); |
308 | 320 |
mPostRender = post; |
321 |
mRowChances = mObject.getRowChances(); |
|
309 | 322 |
|
310 | 323 |
mObject.solve(); |
311 | 324 |
|
312 | 325 |
mNumAxis = mObject.getRotationAxis().length; |
313 | 326 |
mBasicAngle = mObject.getBasicAngle(); |
314 |
mSize = mObject.getSize(); |
|
315 | 327 |
|
316 | 328 |
int numScrambles = post.getNumScrambles(); |
317 | 329 |
int dura = (int)(duration*Math.pow(numScrambles,0.6f)); |
Also available in: Unified diff
Make chances to randimoze a given row when scrambling dependant on the type of Object.
The point: in case of the Cube, all rows should have equal chances. In case of the Pyraminx, the smaller the row, the smaller the chance should be. In particular the trivial 4 corners of the tetraherdon should have a very small chance to be selected.