Revision bc6b4c0b
Added by Leszek Koltunski almost 2 years ago
src/main/java/org/distorted/objectlib/helpers/ObjectSignature.java | ||
---|---|---|
456 | 456 |
|
457 | 457 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
458 | 458 |
|
459 |
public ObjectSignature turn(int axis, int layer, int turn)
|
|
459 |
public ObjectSignature turn(int ax, int layer, int turn) |
|
460 | 460 |
{ |
461 | 461 |
ObjectSignature ret = new ObjectSignature(this); |
462 | 462 |
|
463 | 463 |
// I don't understand it, but Firebase shows mCycles is occasionally null here. |
464 |
if( mCycles!=null && mCycles[axis]!=null )
|
|
464 |
if( mCycles!=null && mCycles[ax]!=null ) |
|
465 | 465 |
{ |
466 |
int[][] cycles = mCycles[axis][layer];
|
|
466 |
int[][] cycles = mCycles[ax][layer]; |
|
467 | 467 |
|
468 | 468 |
// it can happen that there are no cycles in this layer: 2x1x2 axis 0 layer 0. |
469 | 469 |
if( cycles!=null && cycles.length>0 && cycles[0]!=null ) |
... | ... | |
996 | 996 |
|
997 | 997 |
private float[] getPosition(int index, float[][][] centers, int len) |
998 | 998 |
{ |
999 |
int num = 0, i1=0, i2=0;
|
|
999 |
int num=0, i1=0, i2=0;
|
|
1000 | 1000 |
|
1001 | 1001 |
for(int i=0; i<len; i++) |
1002 | 1002 |
{ |
... | ... | |
1038 | 1038 |
int numVariants = centers.length; |
1039 | 1039 |
for(float[][] center : centers) numCubits += center.length; |
1040 | 1040 |
|
1041 |
ArrayList<float[]> mTouch = new ArrayList<>();
|
|
1041 |
ArrayList<float[]> touch = new ArrayList<>();
|
|
1042 | 1042 |
|
1043 | 1043 |
for(int i=0; i<numCubits; i++) |
1044 | 1044 |
{ |
1045 | 1045 |
float[] first = getPosition(i,centers,numVariants); |
1046 |
float ox = scale*first[0]; |
|
1047 |
float oy = scale*first[1]; |
|
1048 |
float oz = scale*first[2]; |
|
1046 | 1049 |
|
1047 | 1050 |
for(int j = i+1; j<numCubits; j++) |
1048 | 1051 |
{ |
1049 | 1052 |
float[] second = getPosition(j,centers,numVariants); |
1050 |
|
|
1051 |
float ox = scale*first[0]; |
|
1052 |
float oy = scale*first[1]; |
|
1053 |
float oz = scale*first[2]; |
|
1054 | 1053 |
float tx = scale*second[0]; |
1055 | 1054 |
float ty = scale*second[1]; |
1056 | 1055 |
float tz = scale*second[2]; |
... | ... | |
1061 | 1060 |
float yc = (ty+oy)/2; |
1062 | 1061 |
float zc = (tz+oz)/2; |
1063 | 1062 |
|
1064 |
float[] touch = new float[] {xc, yc, zc};
|
|
1065 |
mTouch.add(touch);
|
|
1063 |
float[] t = new float[] {xc, yc, zc}; |
|
1064 |
touch.add(t);
|
|
1066 | 1065 |
} |
1067 | 1066 |
} |
1068 | 1067 |
} |
1069 | 1068 |
|
1070 |
mNumCubitTouches = mTouch.size();
|
|
1069 |
mNumCubitTouches = touch.size();
|
|
1071 | 1070 |
mCubitTouch = new float[mNumCubitTouches][]; |
1072 |
for(int i=0; i<mNumCubitTouches; i++) mCubitTouch[i] = mTouch.remove(0);
|
|
1071 |
for(int i=0; i<mNumCubitTouches; i++) mCubitTouch[i] = touch.remove(0);
|
|
1073 | 1072 |
} |
1074 | 1073 |
|
1075 | 1074 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
src/main/java/org/distorted/objectlib/main/ObjectControl.java | ||
---|---|---|
15 | 15 |
import org.distorted.library.type.Static4D; |
16 | 16 |
|
17 | 17 |
import org.distorted.objectlib.effects.BaseEffect; |
18 |
import org.distorted.objectlib.helpers.BlockController; |
|
18 |
//import org.distorted.objectlib.helpers.BlockController;
|
|
19 | 19 |
import org.distorted.objectlib.helpers.MovesFinished; |
20 | 20 |
import org.distorted.objectlib.helpers.ObjectLibInterface; |
21 | 21 |
import org.distorted.objectlib.helpers.OperatingSystemInterface; |
src/main/java/org/distorted/objectlib/scrambling/ScrambleStateLocallyBandaged.java | ||
---|---|---|
230 | 230 |
ObjectSignature[] ret = new ObjectSignature[mNumMoves]; |
231 | 231 |
int index = 0; |
232 | 232 |
|
233 |
String s = mSignature.getString(); |
|
234 |
android.util.Log.e("D", "signature: "+s); |
|
235 |
|
|
236 | 233 |
for(int axis=0; axis<mNumAxis; axis++) |
237 | 234 |
for(int layer=0; layer<mLayer[axis]; layer++) |
238 | 235 |
{ |
239 | 236 |
mIsUnblocked[axis][layer] = mSignature.isUnblockedFromLeft(axis,layer); |
240 |
android.util.Log.e("D", "unblocked ax "+axis+" layer "+layer+" : "+mIsUnblocked[axis][layer]); |
|
241 | 237 |
} |
242 | 238 |
|
243 | 239 |
for(int axis=0; axis<mNumAxis; axis++) |
... | ... | |
287 | 283 |
scramble[0] = axis; |
288 | 284 |
scramble[1] = moveIndex % mSize[axis]; |
289 | 285 |
|
290 |
if( mTurns[axis]==3 ) |
|
291 |
{ |
|
292 |
switch(moveIndex/mSize[axis]) |
|
293 |
{ |
|
294 |
case 0: scramble[2] =-1; break; |
|
295 |
case 1: scramble[2] = 2; break; |
|
296 |
case 2: scramble[2] = 1; break; |
|
297 |
} |
|
298 |
} |
|
299 |
else if( mTurns[axis]==2 ) |
|
286 |
switch( mTurns[axis] ) |
|
300 | 287 |
{ |
301 |
switch(moveIndex/mSize[axis]) |
|
302 |
{ |
|
303 |
case 0: scramble[2] =-1; break; |
|
304 |
case 1: scramble[2] = 1; break; |
|
305 |
} |
|
288 |
case 2: switch(moveIndex/mSize[axis]) |
|
289 |
{ |
|
290 |
case 0: scramble[2] =-1; break; |
|
291 |
case 1: scramble[2] = 1; break; |
|
292 |
} |
|
293 |
break; |
|
294 |
case 3: switch(moveIndex/mSize[axis]) |
|
295 |
{ |
|
296 |
case 0: scramble[2] =-1; break; |
|
297 |
case 1: scramble[2] = 2; break; |
|
298 |
case 2: scramble[2] = 1; break; |
|
299 |
} |
|
300 |
break; |
|
301 |
case 4: switch(moveIndex/mSize[axis]) |
|
302 |
{ |
|
303 |
case 0: scramble[2] =-1; break; |
|
304 |
case 1: scramble[2] =-2; break; |
|
305 |
case 2: scramble[2] = 2; break; |
|
306 |
case 3: scramble[2] = 1; break; |
|
307 |
} |
|
308 |
break; |
|
309 |
default:scramble[2] = 1; |
|
310 |
android.util.Log.e("D", "ScrambleStateLocallyBandaged: unsupported turns: "+mTurns[axis]); |
|
306 | 311 |
} |
307 |
else scramble[2] = 1; |
|
312 |
|
|
308 | 313 |
return; |
309 | 314 |
} |
310 | 315 |
|
Also available in: Unified diff
fix for scrambling