1 |
0c52af30
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
2 |
|
|
// Copyright 2019 Leszek Koltunski //
|
3 |
|
|
// //
|
4 |
fdec60a3
|
Leszek Koltunski
|
// This file is part of Magic Cube. //
|
5 |
0c52af30
|
Leszek Koltunski
|
// //
|
6 |
fdec60a3
|
Leszek Koltunski
|
// Magic Cube is free software: you can redistribute it and/or modify //
|
7 |
0c52af30
|
Leszek Koltunski
|
// it under the terms of the GNU General Public License as published by //
|
8 |
|
|
// the Free Software Foundation, either version 2 of the License, or //
|
9 |
|
|
// (at your option) any later version. //
|
10 |
|
|
// //
|
11 |
fdec60a3
|
Leszek Koltunski
|
// Magic Cube is distributed in the hope that it will be useful, //
|
12 |
0c52af30
|
Leszek Koltunski
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
13 |
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
14 |
|
|
// GNU General Public License for more details. //
|
15 |
|
|
// //
|
16 |
|
|
// You should have received a copy of the GNU General Public License //
|
17 |
fdec60a3
|
Leszek Koltunski
|
// along with Magic Cube. If not, see <http://www.gnu.org/licenses/>. //
|
18 |
0c52af30
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
19 |
|
|
|
20 |
1f9772f3
|
Leszek Koltunski
|
package org.distorted.objects;
|
21 |
0c52af30
|
Leszek Koltunski
|
|
22 |
588ace55
|
Leszek Koltunski
|
import static org.distorted.objectlib.Movement.TYPE_NOT_SPLIT;
|
23 |
967c1d17
|
Leszek Koltunski
|
|
24 |
ccf9fec5
|
Leszek Koltunski
|
import android.content.res.Resources;
|
25 |
0c52af30
|
Leszek Koltunski
|
|
26 |
588ace55
|
Leszek Koltunski
|
import org.distorted.objectlib.ObjectShape;
|
27 |
|
|
import org.distorted.objectlib.ObjectSticker;
|
28 |
|
|
import org.distorted.objectlib.ScrambleState;
|
29 |
0c52af30
|
Leszek Koltunski
|
import org.distorted.library.main.DistortedEffects;
|
30 |
|
|
import org.distorted.library.main.DistortedTexture;
|
31 |
efa8aa48
|
Leszek Koltunski
|
import org.distorted.library.mesh.MeshSquare;
|
32 |
0c52af30
|
Leszek Koltunski
|
import org.distorted.library.type.Static3D;
|
33 |
|
|
import org.distorted.library.type.Static4D;
|
34 |
6fd4a72c
|
Leszek Koltunski
|
import org.distorted.main.R;
|
35 |
588ace55
|
Leszek Koltunski
|
import org.distorted.objectlib.Movement;
|
36 |
|
|
import org.distorted.objectlib.Movement6;
|
37 |
|
|
import org.distorted.objectlib.ObjectList;
|
38 |
|
|
import org.distorted.objectlib.Twisty6;
|
39 |
0c52af30
|
Leszek Koltunski
|
|
40 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
41 |
|
|
|
42 |
bdbbb4c5
|
Leszek Koltunski
|
public class TwistyCube extends Twisty6
|
43 |
0c52af30
|
Leszek Koltunski
|
{
|
44 |
ad38d800
|
Leszek Koltunski
|
static final Static3D[] ROT_AXIS = new Static3D[]
|
45 |
efef689c
|
Leszek Koltunski
|
{
|
46 |
|
|
new Static3D(1,0,0),
|
47 |
|
|
new Static3D(0,1,0),
|
48 |
|
|
new Static3D(0,0,1)
|
49 |
|
|
};
|
50 |
|
|
|
51 |
967c1d17
|
Leszek Koltunski
|
private static final int[][][] ENABLED = new int[][][]
|
52 |
|
|
{
|
53 |
|
|
{{1,2}},{{1,2}},{{0,2}},{{0,2}},{{0,1}},{{0,1}},
|
54 |
|
|
};
|
55 |
|
|
|
56 |
91792184
|
Leszek Koltunski
|
private ScrambleState[] mStates;
|
57 |
7ff38997
|
Leszek Koltunski
|
private Static4D[] mQuats;
|
58 |
ef018c1b
|
Leszek Koltunski
|
private float[][] mCuts;
|
59 |
|
|
private boolean[][] mLayerRotatable;
|
60 |
7ff38997
|
Leszek Koltunski
|
private int[] mBasicAngle;
|
61 |
|
|
private ObjectSticker[] mStickers;
|
62 |
e9a87113
|
Leszek Koltunski
|
private Movement mMovement;
|
63 |
caccea6e
|
Leszek Koltunski
|
|
64 |
411c6285
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
65 |
|
|
|
66 |
bdbbb4c5
|
Leszek Koltunski
|
public TwistyCube(int size, Static4D quat, DistortedTexture texture, MeshSquare mesh,
|
67 |
|
|
DistortedEffects effects, int[][] moves, Resources res, int scrWidth)
|
68 |
411c6285
|
Leszek Koltunski
|
{
|
69 |
db875721
|
Leszek Koltunski
|
super(size, size, quat, texture, mesh, effects, moves, ObjectList.CUBE, res, scrWidth);
|
70 |
91792184
|
Leszek Koltunski
|
}
|
71 |
caccea6e
|
Leszek Koltunski
|
|
72 |
91792184
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
73 |
caccea6e
|
Leszek Koltunski
|
|
74 |
bdbbb4c5
|
Leszek Koltunski
|
protected ScrambleState[] getScrambleStates()
|
75 |
91792184
|
Leszek Koltunski
|
{
|
76 |
|
|
if( mStates==null )
|
77 |
caccea6e
|
Leszek Koltunski
|
{
|
78 |
91792184
|
Leszek Koltunski
|
int size = getNumLayers();
|
79 |
|
|
int[][] m = new int[16][];
|
80 |
|
|
for(int i=1; i<16; i++) m[i] = createEdges(size,i);
|
81 |
|
|
|
82 |
|
|
mStates = new ScrambleState[]
|
83 |
|
|
{
|
84 |
|
|
new ScrambleState( new int[][] { m[ 1], m[ 2], m[ 3] } ), // 0
|
85 |
|
|
new ScrambleState( new int[][] { null, m[ 4], m[ 5] } ), // x
|
86 |
|
|
new ScrambleState( new int[][] { m[ 6], null, m[ 7] } ), // y
|
87 |
|
|
new ScrambleState( new int[][] { m[ 8], m[ 8], null } ), // z
|
88 |
|
|
new ScrambleState( new int[][] { m[10], null, m[ 7] } ), // xy
|
89 |
|
|
new ScrambleState( new int[][] { m[11], m[ 9], null } ), // xz
|
90 |
|
|
new ScrambleState( new int[][] { null, m[12], m[ 5] } ), // yx
|
91 |
|
|
new ScrambleState( new int[][] { m[ 8], m[13], null } ), // yz
|
92 |
|
|
new ScrambleState( new int[][] { null, m[ 4], m[14] } ), // zx
|
93 |
|
|
new ScrambleState( new int[][] { m[ 6], null, m[15] } ), // zy
|
94 |
|
|
new ScrambleState( new int[][] { null, null, m[ 5] } ), // xyx
|
95 |
|
|
new ScrambleState( new int[][] { null, m[ 4], null } ), // xzx
|
96 |
|
|
new ScrambleState( new int[][] { null, null, m[ 7] } ), // yxy
|
97 |
|
|
new ScrambleState( new int[][] { m[ 6], null, null } ), // yzy
|
98 |
|
|
new ScrambleState( new int[][] { null, m[ 9], null } ), // zxz
|
99 |
|
|
new ScrambleState( new int[][] { m[ 8], null, null } ), // zyz
|
100 |
|
|
};
|
101 |
|
|
}
|
102 |
|
|
|
103 |
|
|
return mStates;
|
104 |
caccea6e
|
Leszek Koltunski
|
}
|
105 |
|
|
|
106 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
107 |
|
|
|
108 |
|
|
private int[] createEdges(int size, int vertex)
|
109 |
|
|
{
|
110 |
|
|
int[] ret = new int[9*size];
|
111 |
|
|
|
112 |
|
|
for(int l=0; l<size; l++)
|
113 |
|
|
{
|
114 |
|
|
ret[9*l ] = l;
|
115 |
|
|
ret[9*l+1] =-1;
|
116 |
|
|
ret[9*l+2] = vertex;
|
117 |
|
|
ret[9*l+3] = l;
|
118 |
|
|
ret[9*l+4] = 1;
|
119 |
|
|
ret[9*l+5] = vertex;
|
120 |
|
|
ret[9*l+6] = l;
|
121 |
|
|
ret[9*l+7] = 2;
|
122 |
|
|
ret[9*l+8] = vertex;
|
123 |
|
|
}
|
124 |
|
|
|
125 |
|
|
return ret;
|
126 |
411c6285
|
Leszek Koltunski
|
}
|
127 |
|
|
|
128 |
7ff38997
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
129 |
|
|
|
130 |
|
|
private void initializeQuats()
|
131 |
|
|
{
|
132 |
|
|
mQuats = new Static4D[]
|
133 |
|
|
{
|
134 |
|
|
new Static4D( 0.0f, 0.0f, 0.0f, 1.0f),
|
135 |
|
|
new Static4D( 1.0f, 0.0f, 0.0f, 0.0f),
|
136 |
|
|
new Static4D( 0.0f, 1.0f, 0.0f, 0.0f),
|
137 |
|
|
new Static4D( 0.0f, 0.0f, 1.0f, 0.0f),
|
138 |
|
|
|
139 |
|
|
new Static4D( SQ2/2, SQ2/2, 0.0f , 0.0f),
|
140 |
|
|
new Static4D( SQ2/2, -SQ2/2, 0.0f , 0.0f),
|
141 |
|
|
new Static4D( SQ2/2, 0.0f, SQ2/2, 0.0f),
|
142 |
|
|
new Static4D(-SQ2/2, 0.0f, SQ2/2, 0.0f),
|
143 |
|
|
new Static4D( SQ2/2, 0.0f, 0.0f, SQ2/2),
|
144 |
|
|
new Static4D( SQ2/2, 0.0f, 0.0f, -SQ2/2),
|
145 |
|
|
new Static4D( 0.0f, SQ2/2, SQ2/2, 0.0f),
|
146 |
|
|
new Static4D( 0.0f, SQ2/2, -SQ2/2, 0.0f),
|
147 |
|
|
new Static4D( 0.0f, SQ2/2, 0.0f, SQ2/2),
|
148 |
|
|
new Static4D( 0.0f, SQ2/2, 0.0f, -SQ2/2),
|
149 |
|
|
new Static4D( 0.0f, 0.0f, SQ2/2, SQ2/2),
|
150 |
|
|
new Static4D( 0.0f, 0.0f, SQ2/2, -SQ2/2),
|
151 |
|
|
|
152 |
|
|
new Static4D( 0.5f, 0.5f, 0.5f, 0.5f),
|
153 |
|
|
new Static4D( 0.5f, 0.5f, -0.5f, 0.5f),
|
154 |
|
|
new Static4D( 0.5f, 0.5f, -0.5f, -0.5f),
|
155 |
|
|
new Static4D( 0.5f, -0.5f, 0.5f, -0.5f),
|
156 |
|
|
new Static4D( -0.5f, -0.5f, -0.5f, 0.5f),
|
157 |
|
|
new Static4D( -0.5f, 0.5f, -0.5f, -0.5f),
|
158 |
|
|
new Static4D( -0.5f, 0.5f, 0.5f, -0.5f),
|
159 |
|
|
new Static4D( -0.5f, 0.5f, 0.5f, 0.5f)
|
160 |
|
|
};
|
161 |
|
|
}
|
162 |
|
|
|
163 |
a480ee80
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
164 |
|
|
|
165 |
bdbbb4c5
|
Leszek Koltunski
|
protected int[] getSolvedQuats(int cubit, int numLayers)
|
166 |
a480ee80
|
Leszek Koltunski
|
{
|
167 |
7ff38997
|
Leszek Koltunski
|
if( mQuats ==null ) initializeQuats();
|
168 |
a480ee80
|
Leszek Koltunski
|
int status = retCubitSolvedStatus(cubit,numLayers);
|
169 |
967c1d17
|
Leszek Koltunski
|
return status<0 ? null : buildSolvedQuats(Movement6.FACE_AXIS[status], mQuats);
|
170 |
a480ee80
|
Leszek Koltunski
|
}
|
171 |
|
|
|
172 |
f10a88a8
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
173 |
|
|
|
174 |
bdbbb4c5
|
Leszek Koltunski
|
protected ObjectShape getObjectShape(int cubit, int numLayers)
|
175 |
f10a88a8
|
Leszek Koltunski
|
{
|
176 |
|
|
int extraI, extraV, num;
|
177 |
|
|
float height;
|
178 |
|
|
|
179 |
|
|
switch(numLayers)
|
180 |
|
|
{
|
181 |
|
|
case 2 : num = 6; extraI = 2; extraV = 2; height = 0.045f; break;
|
182 |
|
|
case 3 : num = 5; extraI = 2; extraV = 2; height = 0.045f; break;
|
183 |
|
|
case 4 : num = 5; extraI = 1; extraV = 1; height = 0.045f; break;
|
184 |
|
|
default: num = 5; extraI = 0; extraV = 0; height = 0.045f; break;
|
185 |
|
|
}
|
186 |
|
|
|
187 |
7ff38997
|
Leszek Koltunski
|
double[][] vertices = new double[][]
|
188 |
|
|
{
|
189 |
|
|
{ 0.5, 0.5, 0.5 },
|
190 |
|
|
{ 0.5, 0.5,-0.5 },
|
191 |
|
|
{ 0.5,-0.5, 0.5 },
|
192 |
|
|
{ 0.5,-0.5,-0.5 },
|
193 |
|
|
{-0.5, 0.5, 0.5 },
|
194 |
|
|
{-0.5, 0.5,-0.5 },
|
195 |
|
|
{-0.5,-0.5, 0.5 },
|
196 |
|
|
{-0.5,-0.5,-0.5 },
|
197 |
|
|
};
|
198 |
|
|
|
199 |
|
|
int[][] vert_indices = new int[][]
|
200 |
|
|
{
|
201 |
d90c55cc
|
Leszek Koltunski
|
{2,3,1,0},
|
202 |
7ff38997
|
Leszek Koltunski
|
{7,6,4,5},
|
203 |
|
|
{4,0,1,5},
|
204 |
|
|
{7,3,2,6},
|
205 |
|
|
{6,2,0,4},
|
206 |
|
|
{3,7,5,1}
|
207 |
|
|
};
|
208 |
|
|
|
209 |
f10a88a8
|
Leszek Koltunski
|
float[][] bands = new float[][] { {height,35,0.5f,0.7f,num,extraI,extraV} };
|
210 |
|
|
int[] bandIndices = new int[] { 0,0,0,0,0,0};
|
211 |
|
|
float[][] corners = new float[][] { {0.036f,0.12f} };
|
212 |
|
|
int[] cornerIndices = new int[] { 0,0,0,0,0,0,0,0 };
|
213 |
|
|
float[][] centers = new float[][] { {0.0f, 0.0f, 0.0f} };
|
214 |
|
|
int[] centerIndices = new int[] { 0,0,0,0,0,0,0,0 };
|
215 |
|
|
|
216 |
7ff38997
|
Leszek Koltunski
|
return new ObjectShape(vertices,vert_indices,bands,bandIndices,corners,cornerIndices,centers,centerIndices,getNumCubitFaces(), null);
|
217 |
f10a88a8
|
Leszek Koltunski
|
}
|
218 |
|
|
|
219 |
ac940e24
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
220 |
|
|
|
221 |
bdbbb4c5
|
Leszek Koltunski
|
protected Static4D getQuat(int cubit, int numLayers)
|
222 |
ac940e24
|
Leszek Koltunski
|
{
|
223 |
7ff38997
|
Leszek Koltunski
|
if( mQuats ==null ) initializeQuats();
|
224 |
|
|
return mQuats[0];
|
225 |
3e605536
|
Leszek Koltunski
|
}
|
226 |
f10a88a8
|
Leszek Koltunski
|
|
227 |
3e605536
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
228 |
ac940e24
|
Leszek Koltunski
|
|
229 |
bdbbb4c5
|
Leszek Koltunski
|
protected int getNumCubitVariants(int numLayers)
|
230 |
3e605536
|
Leszek Koltunski
|
{
|
231 |
|
|
return 1;
|
232 |
|
|
}
|
233 |
ac940e24
|
Leszek Koltunski
|
|
234 |
3e605536
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
235 |
f10a88a8
|
Leszek Koltunski
|
|
236 |
bdbbb4c5
|
Leszek Koltunski
|
protected int getCubitVariant(int cubit, int numLayers)
|
237 |
3e605536
|
Leszek Koltunski
|
{
|
238 |
|
|
return 0;
|
239 |
ac940e24
|
Leszek Koltunski
|
}
|
240 |
|
|
|
241 |
9c06394a
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
242 |
7289fd6c
|
Leszek Koltunski
|
|
243 |
bdbbb4c5
|
Leszek Koltunski
|
protected ObjectSticker retSticker(int face)
|
244 |
9c06394a
|
Leszek Koltunski
|
{
|
245 |
7ff38997
|
Leszek Koltunski
|
if( mStickers==null )
|
246 |
|
|
{
|
247 |
|
|
final float[][] STICKERS = new float[][] { { -0.5f, -0.5f, 0.5f, -0.5f, 0.5f, 0.5f, -0.5f, 0.5f } };
|
248 |
|
|
final float radius = 0.10f;
|
249 |
|
|
final float stroke = 0.08f;
|
250 |
|
|
final float[] radii = {radius,radius,radius,radius};
|
251 |
|
|
mStickers = new ObjectSticker[STICKERS.length];
|
252 |
|
|
mStickers[0] = new ObjectSticker(STICKERS[0],null,radii,stroke );
|
253 |
|
|
}
|
254 |
|
|
|
255 |
abf36986
|
Leszek Koltunski
|
return mStickers[face/NUM_FACE_COLORS];
|
256 |
7289fd6c
|
Leszek Koltunski
|
}
|
257 |
|
|
|
258 |
411c6285
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
259 |
|
|
|
260 |
bdbbb4c5
|
Leszek Koltunski
|
protected float[][] getCubitPositions(int numLayers)
|
261 |
a10ada2a
|
Leszek Koltunski
|
{
|
262 |
b1f2ccf5
|
Leszek Koltunski
|
int numCubits = numLayers>1 ? 6*numLayers*numLayers - 12*numLayers + 8 : 1;
|
263 |
e6cf7283
|
Leszek Koltunski
|
float[][] tmp = new float[numCubits][];
|
264 |
beb325a0
|
Leszek Koltunski
|
|
265 |
b1f2ccf5
|
Leszek Koltunski
|
float diff = 0.5f*(numLayers-1);
|
266 |
a10ada2a
|
Leszek Koltunski
|
int currentPosition = 0;
|
267 |
beb325a0
|
Leszek Koltunski
|
|
268 |
b1f2ccf5
|
Leszek Koltunski
|
for(int x = 0; x<numLayers; x++)
|
269 |
|
|
for(int y = 0; y<numLayers; y++)
|
270 |
|
|
for(int z = 0; z<numLayers; z++)
|
271 |
|
|
if( x==0 || x==numLayers-1 || y==0 || y==numLayers-1 || z==0 || z==numLayers-1 )
|
272 |
beb325a0
|
Leszek Koltunski
|
{
|
273 |
e6cf7283
|
Leszek Koltunski
|
tmp[currentPosition++] = new float[] {x-diff,y-diff,z-diff};
|
274 |
a10ada2a
|
Leszek Koltunski
|
}
|
275 |
47ba5ddc
|
Leszek Koltunski
|
|
276 |
a10ada2a
|
Leszek Koltunski
|
return tmp;
|
277 |
|
|
}
|
278 |
47ba5ddc
|
Leszek Koltunski
|
|
279 |
beb325a0
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
280 |
|
|
|
281 |
bdbbb4c5
|
Leszek Koltunski
|
protected Static4D[] getQuats()
|
282 |
a10ada2a
|
Leszek Koltunski
|
{
|
283 |
7ff38997
|
Leszek Koltunski
|
if( mQuats ==null ) initializeQuats();
|
284 |
|
|
return mQuats;
|
285 |
a10ada2a
|
Leszek Koltunski
|
}
|
286 |
47ba5ddc
|
Leszek Koltunski
|
|
287 |
7403cdfa
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
288 |
|
|
|
289 |
bdbbb4c5
|
Leszek Koltunski
|
protected float[][] getCuts(int numLayers)
|
290 |
7403cdfa
|
Leszek Koltunski
|
{
|
291 |
ef018c1b
|
Leszek Koltunski
|
if( numLayers<2 ) return null;
|
292 |
a97e02b7
|
Leszek Koltunski
|
|
293 |
ef018c1b
|
Leszek Koltunski
|
if( mCuts==null )
|
294 |
a97e02b7
|
Leszek Koltunski
|
{
|
295 |
ef018c1b
|
Leszek Koltunski
|
mCuts = new float[3][numLayers-1];
|
296 |
|
|
|
297 |
|
|
for(int i=0; i<numLayers-1; i++)
|
298 |
|
|
{
|
299 |
|
|
float cut = (2-numLayers)*0.5f + i;
|
300 |
|
|
mCuts[0][i] = cut;
|
301 |
|
|
mCuts[1][i] = cut;
|
302 |
|
|
mCuts[2][i] = cut;
|
303 |
|
|
}
|
304 |
a97e02b7
|
Leszek Koltunski
|
}
|
305 |
|
|
|
306 |
ef018c1b
|
Leszek Koltunski
|
return mCuts;
|
307 |
|
|
}
|
308 |
|
|
|
309 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
310 |
|
|
|
311 |
|
|
private void getLayerRotatable(int numLayers)
|
312 |
|
|
{
|
313 |
|
|
if( mLayerRotatable==null )
|
314 |
|
|
{
|
315 |
|
|
int numAxis = ROT_AXIS.length;
|
316 |
|
|
boolean[] tmp = new boolean[numLayers];
|
317 |
|
|
for(int i=0; i<numLayers; i++) tmp[i] = true;
|
318 |
|
|
mLayerRotatable = new boolean[numAxis][];
|
319 |
|
|
for(int i=0; i<numAxis; i++) mLayerRotatable[i] = tmp;
|
320 |
|
|
}
|
321 |
7403cdfa
|
Leszek Koltunski
|
}
|
322 |
|
|
|
323 |
169219a7
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
324 |
|
|
|
325 |
bdbbb4c5
|
Leszek Koltunski
|
protected int getSolvedFunctionIndex()
|
326 |
169219a7
|
Leszek Koltunski
|
{
|
327 |
|
|
return 0;
|
328 |
|
|
}
|
329 |
|
|
|
330 |
eab9d8f8
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
331 |
|
|
|
332 |
bdbbb4c5
|
Leszek Koltunski
|
protected int getNumStickerTypes(int numLayers)
|
333 |
eab9d8f8
|
Leszek Koltunski
|
{
|
334 |
7ff38997
|
Leszek Koltunski
|
return 1;
|
335 |
eab9d8f8
|
Leszek Koltunski
|
}
|
336 |
|
|
|
337 |
8f53e513
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
338 |
|
|
|
339 |
bdbbb4c5
|
Leszek Koltunski
|
protected int getNumCubitFaces()
|
340 |
8f53e513
|
Leszek Koltunski
|
{
|
341 |
efa81f0c
|
Leszek Koltunski
|
return 6;
|
342 |
f0fa83ae
|
Leszek Koltunski
|
}
|
343 |
|
|
|
344 |
f6d06256
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
345 |
|
|
|
346 |
bdbbb4c5
|
Leszek Koltunski
|
protected int getFaceColor(int cubit, int cubitface, int numLayers)
|
347 |
f6d06256
|
Leszek Koltunski
|
{
|
348 |
bdbbb4c5
|
Leszek Koltunski
|
return CUBITS[cubit].getRotRow(cubitface/2) == (cubitface%2==0 ? (1<<(numLayers-1)):1) ? cubitface : NUM_TEXTURES;
|
349 |
f6d06256
|
Leszek Koltunski
|
}
|
350 |
|
|
|
351 |
e844c116
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
352 |
|
|
// PUBLIC API
|
353 |
|
|
|
354 |
12ad3fca
|
Leszek Koltunski
|
public Static3D[] getRotationAxis()
|
355 |
|
|
{
|
356 |
ad38d800
|
Leszek Koltunski
|
return ROT_AXIS;
|
357 |
12ad3fca
|
Leszek Koltunski
|
}
|
358 |
|
|
|
359 |
e9a87113
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
360 |
|
|
|
361 |
|
|
public Movement getMovement()
|
362 |
|
|
{
|
363 |
ef018c1b
|
Leszek Koltunski
|
if( mMovement==null )
|
364 |
|
|
{
|
365 |
|
|
int numLayers = getNumLayers();
|
366 |
|
|
if( mCuts==null ) getCuts(numLayers);
|
367 |
|
|
getLayerRotatable(numLayers);
|
368 |
7ee89540
|
Leszek Koltunski
|
mMovement = new Movement6(ROT_AXIS,mCuts,mLayerRotatable,numLayers,TYPE_NOT_SPLIT,ENABLED);
|
369 |
ef018c1b
|
Leszek Koltunski
|
}
|
370 |
e9a87113
|
Leszek Koltunski
|
return mMovement;
|
371 |
|
|
}
|
372 |
|
|
|
373 |
12ad3fca
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
374 |
|
|
|
375 |
925ed78f
|
Leszek Koltunski
|
public int[] getBasicAngle()
|
376 |
e844c116
|
Leszek Koltunski
|
{
|
377 |
d90c55cc
|
Leszek Koltunski
|
if( mBasicAngle==null ) mBasicAngle = new int[] { 4,4,4 };
|
378 |
7ff38997
|
Leszek Koltunski
|
return mBasicAngle;
|
379 |
e844c116
|
Leszek Koltunski
|
}
|
380 |
39e74052
|
Leszek Koltunski
|
|
381 |
f0336037
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
382 |
6fd4a72c
|
Leszek Koltunski
|
|
383 |
|
|
public int getObjectName(int numLayers)
|
384 |
|
|
{
|
385 |
|
|
switch(numLayers)
|
386 |
|
|
{
|
387 |
|
|
case 2: return R.string.cube2;
|
388 |
|
|
case 3: return R.string.cube3;
|
389 |
|
|
case 4: return R.string.cube4;
|
390 |
|
|
case 5: return R.string.cube5;
|
391 |
|
|
}
|
392 |
|
|
return R.string.cube3;
|
393 |
|
|
}
|
394 |
|
|
|
395 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
396 |
|
|
|
397 |
|
|
public int getInventor(int numLayers)
|
398 |
|
|
{
|
399 |
|
|
switch(numLayers)
|
400 |
|
|
{
|
401 |
|
|
case 2: return R.string.cube2_inventor;
|
402 |
|
|
case 3: return R.string.cube3_inventor;
|
403 |
|
|
case 4: return R.string.cube4_inventor;
|
404 |
|
|
case 5: return R.string.cube5_inventor;
|
405 |
|
|
}
|
406 |
|
|
return R.string.cube3_inventor;
|
407 |
|
|
}
|
408 |
|
|
|
409 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
410 |
|
|
|
411 |
|
|
public int getComplexity(int numLayers)
|
412 |
|
|
{
|
413 |
|
|
switch(numLayers)
|
414 |
|
|
{
|
415 |
|
|
case 2: return 4;
|
416 |
|
|
case 3: return 6;
|
417 |
|
|
case 4: return 8;
|
418 |
|
|
case 5: return 10;
|
419 |
|
|
}
|
420 |
|
|
return 6;
|
421 |
|
|
}
|
422 |
0c52af30
|
Leszek Koltunski
|
}
|