|
1 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
2 |
// Copyright 2021 Leszek Koltunski //
|
|
3 |
// //
|
|
4 |
// This file is part of Magic Cube. //
|
|
5 |
// //
|
|
6 |
// Magic Cube is free software: you can redistribute it and/or modify //
|
|
7 |
// 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 |
// Magic Cube is distributed in the hope that it will be useful, //
|
|
12 |
// 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 |
// along with Magic Cube. If not, see <http://www.gnu.org/licenses/>. //
|
|
18 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
19 |
|
|
20 |
package org.distorted.objects;
|
|
21 |
|
|
22 |
import android.content.res.Resources;
|
|
23 |
import android.graphics.Canvas;
|
|
24 |
import android.graphics.Paint;
|
|
25 |
|
|
26 |
import org.distorted.helpers.FactoryCubit;
|
|
27 |
import org.distorted.helpers.FactorySticker;
|
|
28 |
import org.distorted.library.effect.MatrixEffectQuaternion;
|
|
29 |
import org.distorted.library.main.DistortedEffects;
|
|
30 |
import org.distorted.library.main.DistortedTexture;
|
|
31 |
import org.distorted.library.mesh.MeshBase;
|
|
32 |
import org.distorted.library.mesh.MeshSquare;
|
|
33 |
import org.distorted.library.type.Static3D;
|
|
34 |
import org.distorted.library.type.Static4D;
|
|
35 |
import org.distorted.main.R;
|
|
36 |
|
|
37 |
import java.util.Random;
|
|
38 |
|
|
39 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
40 |
|
|
41 |
public class TwistyJing extends TwistyObject
|
|
42 |
{
|
|
43 |
static final float F = 0.24f;
|
|
44 |
|
|
45 |
static final Static3D[] ROT_AXIS = new Static3D[]
|
|
46 |
{
|
|
47 |
new Static3D( 0,-SQ3/3,-SQ6/3),
|
|
48 |
new Static3D( 0,-SQ3/3,+SQ6/3),
|
|
49 |
new Static3D(+SQ6/3,+SQ3/3, 0),
|
|
50 |
new Static3D(-SQ6/3,+SQ3/3, 0),
|
|
51 |
};
|
|
52 |
|
|
53 |
private static final int[] BASIC_ANGLE = new int[] { 3,3,3,3 };
|
|
54 |
|
|
55 |
private static final int[] FACE_COLORS = new int[]
|
|
56 |
{
|
|
57 |
COLOR_GREEN , COLOR_YELLOW,
|
|
58 |
COLOR_BLUE , COLOR_RED
|
|
59 |
};
|
|
60 |
|
|
61 |
// computed with res/raw/compute_quats.c
|
|
62 |
private static final Static4D[] QUATS = new Static4D[]
|
|
63 |
{
|
|
64 |
new Static4D( 0.0f, 0.0f, 0.0f, 1.0f),
|
|
65 |
new Static4D( 0.0f, 1.0f, 0.0f, 0.0f),
|
|
66 |
new Static4D( SQ2/2, 0.5f, 0.0f, 0.5f),
|
|
67 |
new Static4D(-SQ2/2, 0.5f, 0.0f, 0.5f),
|
|
68 |
new Static4D( 0.0f, -0.5f, -SQ2/2, 0.5f),
|
|
69 |
new Static4D( 0.0f, -0.5f, SQ2/2, 0.5f),
|
|
70 |
new Static4D( SQ2/2, 0.5f, 0.0f, -0.5f),
|
|
71 |
new Static4D(-SQ2/2, 0.5f, 0.0f, -0.5f),
|
|
72 |
new Static4D( 0.0f, -0.5f, -SQ2/2, -0.5f),
|
|
73 |
new Static4D( 0.0f, -0.5f, SQ2/2, -0.5f),
|
|
74 |
new Static4D( SQ2/2, 0.0f, SQ2/2, 0.0f),
|
|
75 |
new Static4D(-SQ2/2, 0.0f, SQ2/2, 0.0f)
|
|
76 |
};
|
|
77 |
|
|
78 |
|
|
79 |
static float H = 0.120f;
|
|
80 |
|
|
81 |
static final float[][] CENTERS = new float[][]
|
|
82 |
{
|
|
83 |
{ 0.000f, -SQ2/4, 0.500f },
|
|
84 |
{ 0.000f, -SQ2/4, -0.500f },
|
|
85 |
{-0.500f, SQ2/4, 0.000f },
|
|
86 |
{ 0.500f, SQ2/4, 0.000f },
|
|
87 |
|
|
88 |
{ 0.000f, -SQ2/4, 0.000f },
|
|
89 |
{-0.250f, 0.000f, 0.250f },
|
|
90 |
{ 0.250f, 0.000f, 0.250f },
|
|
91 |
{-0.250f, 0.000f,-0.250f },
|
|
92 |
{ 0.250f, 0.000f,-0.250f },
|
|
93 |
{ 0.000f, SQ2/4, 0.000f },
|
|
94 |
|
|
95 |
{ 0.000f, H, 1.0f/6 },
|
|
96 |
{ 0.000f, H,-1.0f/6 },
|
|
97 |
{-1.0f/6,-H, 0.000f },
|
|
98 |
{ 1.0f/6,-H, 0.000f },
|
|
99 |
};
|
|
100 |
|
|
101 |
// Colors of the faces of cubits.
|
|
102 |
// GREEN 0 YELLOW 1 BLUE 2 RED 3
|
|
103 |
// GREEN 4 YELLOW 5 BLUE 6 RED 7
|
|
104 |
// GREEN 8 YELLOW 9 BLUE 10 RED 11
|
|
105 |
private static final int[][] mFaceMap = new int[][]
|
|
106 |
{
|
|
107 |
{ 2, 3, 1, 12, 12, 12 },
|
|
108 |
{ 0, 1, 3, 12, 12, 12 },
|
|
109 |
{ 0, 2, 1, 12, 12, 12 },
|
|
110 |
{ 0, 3, 2, 12, 12, 12 },
|
|
111 |
|
|
112 |
{ 7, 5, 12, 12, 12, 12 },
|
|
113 |
{ 6, 5, 12, 12, 12, 12 },
|
|
114 |
{ 7, 6, 12, 12, 12, 12 },
|
|
115 |
{ 4, 5, 12, 12, 12, 12 },
|
|
116 |
{ 7, 4, 12, 12, 12, 12 },
|
|
117 |
{ 6, 4, 12, 12, 12, 12 },
|
|
118 |
|
|
119 |
{ 10, 12, 12, 12, 12, 12 },
|
|
120 |
{ 8, 12, 12, 12, 12, 12 },
|
|
121 |
{ 9, 12, 12, 12, 12, 12 },
|
|
122 |
{ 11, 12, 12, 12, 12, 12 },
|
|
123 |
};
|
|
124 |
|
|
125 |
private static final float X = F/2;
|
|
126 |
private static final float Y = F*SQ2/2;
|
|
127 |
private static final float Z =-F/2;
|
|
128 |
private static final float L = (1-3*F);
|
|
129 |
private static final float X2= L/2;
|
|
130 |
private static final float Y2= L*SQ2/2;
|
|
131 |
private static final float Z2=-L/2;
|
|
132 |
private static final float D = F/L;
|
|
133 |
|
|
134 |
private static final double[][] VERTICES_CORNER = new double[][]
|
|
135 |
{
|
|
136 |
{ 0.0, 0.0, 0.0 },
|
|
137 |
{ X, Y, Z },
|
|
138 |
{ 0.0, 2*Y, 2*Z },
|
|
139 |
{ -X, Y, Z },
|
|
140 |
{ 0.0, 0.0, -F },
|
|
141 |
{ X, Y, Z-F },
|
|
142 |
{ 0.0, 2*Y, 2*Z-F },
|
|
143 |
{ -X, Y, Z-F },
|
|
144 |
};
|
|
145 |
|
|
146 |
private static final int[][] VERT_INDEXES_CORNER = new int[][]
|
|
147 |
{
|
|
148 |
{0,1,2,3},
|
|
149 |
{1,0,4,5},
|
|
150 |
{7,4,0,3},
|
|
151 |
{1,5,6,2},
|
|
152 |
{7,3,2,6},
|
|
153 |
{4,7,6,5}
|
|
154 |
};
|
|
155 |
|
|
156 |
private static final double[][] VERTICES_EDGE = new double[][]
|
|
157 |
{
|
|
158 |
{ 0.0, 0.0, 0.5-F },
|
|
159 |
{ X, Y, Z+0.5-F },
|
|
160 |
{ 0.0, 2*Y, 2*Z+0.5-F },
|
|
161 |
{ -X, Y, Z+0.5-F },
|
|
162 |
{ 0.0, 0.0, -0.5+F },
|
|
163 |
{ X, Y, -Z-0.5+F },
|
|
164 |
{ 0.0, 2*Y,-2*Z-0.5+F },
|
|
165 |
{ -X, Y, -Z-0.5+F },
|
|
166 |
};
|
|
167 |
|
|
168 |
private static final int[][] VERT_INDEXES_EDGE = new int[][]
|
|
169 |
{
|
|
170 |
{0,4,5,1},
|
|
171 |
{3,7,4,0},
|
|
172 |
{0,1,2,3},
|
|
173 |
{4,7,6,5},
|
|
174 |
{1,5,6,2},
|
|
175 |
{2,6,7,3}
|
|
176 |
};
|
|
177 |
|
|
178 |
private static final double[][] VERTICES_FACE = new double[][]
|
|
179 |
{
|
|
180 |
{ 0.0, -2*Y2/3, -2*Z2/3 },
|
|
181 |
{ X2, Y2/3, Z2/3 },
|
|
182 |
{ -X2, Y2/3, Z2/3 },
|
|
183 |
{ 0.0, -2*Y2/3,-2*Z2/3+2*D*Z2 },
|
|
184 |
{ X2-D*X2, Y2/3-D*Y2, Z2/3+D*Z2 },
|
|
185 |
{ -X2+D*X2, Y2/3-D*Y2, Z2/3+D*Z2 },
|
|
186 |
};
|
|
187 |
|
|
188 |
private static final int[][] VERT_INDEXES_FACE = new int[][]
|
|
189 |
{
|
|
190 |
{0,1,2},
|
|
191 |
{3,5,4},
|
|
192 |
{0,3,4,1},
|
|
193 |
{5,3,0,2},
|
|
194 |
{4,5,2,1}
|
|
195 |
};
|
|
196 |
|
|
197 |
private static final float[][] STICKERS = new float[][]
|
|
198 |
{
|
|
199 |
{ 0.0f, -0.5f, 0.28867516f, 0.0f, 0.0f, 0.5f, -0.28867516f, 0.0f },
|
|
200 |
{ -0.5f, 0.11983269f, 0.27964598f, -0.43146032f, 0.3200817f, 0.007388768f, -0.09972769f, 0.30423886f },
|
|
201 |
{ 0.0f, -0.5f, 0.43301272f, 0.25f, -0.43301272f, 0.25f },
|
|
202 |
};
|
|
203 |
|
|
204 |
private static MeshBase[] mMeshes;
|
|
205 |
|
|
206 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
207 |
|
|
208 |
TwistyJing(int size, Static4D quat, DistortedTexture texture, MeshSquare mesh,
|
|
209 |
DistortedEffects effects, int[][] moves, Resources res, int scrWidth)
|
|
210 |
{
|
|
211 |
super(size, size, quat, texture, mesh, effects, moves, ObjectList.JING, res, scrWidth);
|
|
212 |
}
|
|
213 |
|
|
214 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
215 |
|
|
216 |
float[][] getCubitPositions(int size)
|
|
217 |
{
|
|
218 |
return CENTERS;
|
|
219 |
}
|
|
220 |
|
|
221 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
222 |
|
|
223 |
Static4D[] getQuats()
|
|
224 |
{
|
|
225 |
return QUATS;
|
|
226 |
}
|
|
227 |
|
|
228 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
229 |
|
|
230 |
int getNumFaces()
|
|
231 |
{
|
|
232 |
return FACE_COLORS.length;
|
|
233 |
}
|
|
234 |
|
|
235 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
236 |
|
|
237 |
int getNumStickerTypes(int numLayers)
|
|
238 |
{
|
|
239 |
return STICKERS.length;
|
|
240 |
}
|
|
241 |
|
|
242 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
243 |
|
|
244 |
float[][] getCuts(int size)
|
|
245 |
{
|
|
246 |
float[] cut = {F-0.5f};
|
|
247 |
return new float[][] { cut,cut,cut,cut };
|
|
248 |
}
|
|
249 |
|
|
250 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
251 |
|
|
252 |
int getNumCubitFaces()
|
|
253 |
{
|
|
254 |
return 6;
|
|
255 |
}
|
|
256 |
|
|
257 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
258 |
|
|
259 |
float getScreenRatio()
|
|
260 |
{
|
|
261 |
return 1.64f;
|
|
262 |
}
|
|
263 |
|
|
264 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
265 |
|
|
266 |
boolean shouldResetTextureMaps()
|
|
267 |
{
|
|
268 |
return false;
|
|
269 |
}
|
|
270 |
|
|
271 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
272 |
|
|
273 |
int getFaceColor(int cubit, int cubitface, int size)
|
|
274 |
{
|
|
275 |
return mFaceMap[cubit][cubitface];
|
|
276 |
}
|
|
277 |
|
|
278 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
279 |
|
|
280 |
private int getQuat(int cubit)
|
|
281 |
{
|
|
282 |
switch(cubit)
|
|
283 |
{
|
|
284 |
case 0: return 0;
|
|
285 |
case 1: return 1;
|
|
286 |
case 2: return 2;
|
|
287 |
case 3: return 7;
|
|
288 |
|
|
289 |
case 4: return 0;
|
|
290 |
case 5: return 2;
|
|
291 |
case 6: return 7;
|
|
292 |
case 7: return 6;
|
|
293 |
case 8: return 3;
|
|
294 |
case 9: return 10;
|
|
295 |
|
|
296 |
case 10: return 0;
|
|
297 |
case 11: return 1;
|
|
298 |
case 12: return 3;
|
|
299 |
case 13: return 5;
|
|
300 |
}
|
|
301 |
|
|
302 |
return 0;
|
|
303 |
}
|
|
304 |
|
|
305 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
306 |
|
|
307 |
MeshBase createCubitMesh(int cubit, int numLayers)
|
|
308 |
{
|
|
309 |
if( mMeshes==null )
|
|
310 |
{
|
|
311 |
FactoryCubit factory = FactoryCubit.getInstance();
|
|
312 |
factory.clear();
|
|
313 |
mMeshes = new MeshBase[3];
|
|
314 |
}
|
|
315 |
|
|
316 |
MeshBase mesh;
|
|
317 |
|
|
318 |
if( cubit<4 )
|
|
319 |
{
|
|
320 |
if( mMeshes[0]==null )
|
|
321 |
{
|
|
322 |
float[][] bands = new float[][] { {0.015f,35,0.5f*F,F,5,1,1},{0.001f,35,0.5f*F,F,5,1,1} };
|
|
323 |
int[] bandIndexes = new int[] { 0,0,0,1,1,1 };
|
|
324 |
float[][] corners = new float[][] { {0.10f,0.20f*F},{0.07f,0.20f*F} };
|
|
325 |
int[] cornerIndexes = new int[] { 0,1,1,-1,1,-1,-1,-1 };
|
|
326 |
float[][] centers = new float[][] { { 0.0f, F*SQ2/2, -F} };
|
|
327 |
int[] centerIndexes = new int[] { 0,0,0,-1,0,-1,-1,-1 };
|
|
328 |
|
|
329 |
FactoryCubit factory = FactoryCubit.getInstance();
|
|
330 |
|
|
331 |
factory.createNewFaceTransform(VERTICES_CORNER,VERT_INDEXES_CORNER);
|
|
332 |
mMeshes[0] = factory.createRoundedSolid(VERTICES_CORNER, VERT_INDEXES_CORNER,
|
|
333 |
bands, bandIndexes,
|
|
334 |
corners, cornerIndexes,
|
|
335 |
centers, centerIndexes,
|
|
336 |
getNumCubitFaces() );
|
|
337 |
}
|
|
338 |
mesh = mMeshes[0].copy(true);
|
|
339 |
}
|
|
340 |
else if( cubit<10 )
|
|
341 |
{
|
|
342 |
if( mMeshes[1]==null )
|
|
343 |
{
|
|
344 |
float[][] bands = new float[][] { {0.015f,35,0.5f*F,F,5,1,1},{0.001f,35,0.5f*F,F,5,1,1} };
|
|
345 |
int[] bandIndexes = new int[] { 0,0,1,1,1,1 };
|
|
346 |
float[][] corners = new float[][] { {0.07f,0.20f*F} };
|
|
347 |
int[] cornerIndexes = new int[] { 0,0,-1,0,0,0,-1,0 };
|
|
348 |
float[][] centers = new float[][] { { 0, F*SQ2/2, 0 } };
|
|
349 |
int[] centerIndexes = new int[] { 0,0,-1,0,0,0,-1,0 };
|
|
350 |
|
|
351 |
FactoryCubit factory = FactoryCubit.getInstance();
|
|
352 |
|
|
353 |
factory.createNewFaceTransform(VERTICES_EDGE,VERT_INDEXES_EDGE);
|
|
354 |
mMeshes[1] = factory.createRoundedSolid(VERTICES_EDGE, VERT_INDEXES_EDGE,
|
|
355 |
bands, bandIndexes,
|
|
356 |
corners, cornerIndexes,
|
|
357 |
centers, centerIndexes,
|
|
358 |
getNumCubitFaces() );
|
|
359 |
|
|
360 |
factory.printStickerCoords();
|
|
361 |
}
|
|
362 |
mesh = mMeshes[1].copy(true);
|
|
363 |
}
|
|
364 |
else
|
|
365 |
{
|
|
366 |
if( mMeshes[2]==null )
|
|
367 |
{
|
|
368 |
float[][] bands = new float[][] { {0.020f,35,0.20f*(1-3*F),0.6f*(1-3*F),5,1,1},
|
|
369 |
{0.001f,35,0.05f*(1-3*F),0.1f*(1-3*F),5,1,1} };
|
|
370 |
int[] bandIndexes = new int[] { 0,1,1,1,1,1 };
|
|
371 |
float[][] corners = new float[][] { {0.04f,0.15f} };
|
|
372 |
int[] cornerIndexes = new int[] { 0,0,0,-1,-1,-1 };
|
|
373 |
float[][] centers = new float[][] { { 0, -2*Y/3, 4*Z/3 } };
|
|
374 |
int[] centerIndexes = new int[] { 0,0,0,-1,-1,-1 };
|
|
375 |
|
|
376 |
FactoryCubit factory = FactoryCubit.getInstance();
|
|
377 |
|
|
378 |
factory.createNewFaceTransform(VERTICES_FACE,VERT_INDEXES_FACE);
|
|
379 |
mMeshes[2] = factory.createRoundedSolid(VERTICES_FACE, VERT_INDEXES_FACE,
|
|
380 |
bands, bandIndexes,
|
|
381 |
corners, cornerIndexes,
|
|
382 |
centers, centerIndexes,
|
|
383 |
getNumCubitFaces() );
|
|
384 |
|
|
385 |
factory.printStickerCoords();
|
|
386 |
}
|
|
387 |
mesh = mMeshes[2].copy(true);
|
|
388 |
}
|
|
389 |
|
|
390 |
MatrixEffectQuaternion quat = new MatrixEffectQuaternion( QUATS[getQuat(cubit)], new Static3D(0,0,0) );
|
|
391 |
mesh.apply(quat,0xffffffff,0);
|
|
392 |
|
|
393 |
return mesh;
|
|
394 |
}
|
|
395 |
|
|
396 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
397 |
|
|
398 |
void createFaceTexture(Canvas canvas, Paint paint, int face, int left, int top)
|
|
399 |
{
|
|
400 |
int COLORS = FACE_COLORS.length;
|
|
401 |
int stickerType = face/COLORS;
|
|
402 |
float R,S;
|
|
403 |
|
|
404 |
switch(stickerType)
|
|
405 |
{
|
|
406 |
case 0: R = 0.05f; S = 0.05f; break;
|
|
407 |
case 1: R = 0.03f; S = 0.03f; break;
|
|
408 |
default: R = 0.05f; S = 0.06f; break;
|
|
409 |
}
|
|
410 |
|
|
411 |
FactorySticker factory = FactorySticker.getInstance();
|
|
412 |
factory.drawRoundedPolygon(canvas, paint, left, top, STICKERS[stickerType], S, FACE_COLORS[face%COLORS], R);
|
|
413 |
}
|
|
414 |
|
|
415 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
416 |
// SQ6/3 = height of the tetrahedron
|
|
417 |
|
|
418 |
float returnMultiplier()
|
|
419 |
{
|
|
420 |
return getNumLayers()/(SQ6/3);
|
|
421 |
}
|
|
422 |
|
|
423 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
424 |
// PUBLIC API
|
|
425 |
|
|
426 |
public Static3D[] getRotationAxis()
|
|
427 |
{
|
|
428 |
return ROT_AXIS;
|
|
429 |
}
|
|
430 |
|
|
431 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
432 |
|
|
433 |
public int[] getBasicAngle()
|
|
434 |
{
|
|
435 |
return BASIC_ANGLE;
|
|
436 |
}
|
|
437 |
|
|
438 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
439 |
|
|
440 |
public void randomizeNewScramble(int[][] scramble, Random rnd, int curr, int total)
|
|
441 |
{
|
|
442 |
if( curr==0 )
|
|
443 |
{
|
|
444 |
scramble[curr][0] = rnd.nextInt(NUM_AXIS);
|
|
445 |
}
|
|
446 |
else
|
|
447 |
{
|
|
448 |
int newVector = rnd.nextInt(NUM_AXIS-1);
|
|
449 |
scramble[curr][0] = (newVector>=scramble[curr-1][0] ? newVector+1 : newVector);
|
|
450 |
}
|
|
451 |
|
|
452 |
scramble[curr][1] = rnd.nextInt(2);
|
|
453 |
|
|
454 |
switch( rnd.nextInt(2) )
|
|
455 |
{
|
|
456 |
case 0: scramble[curr][2] = -1; break;
|
|
457 |
case 1: scramble[curr][2] = 1; break;
|
|
458 |
}
|
|
459 |
}
|
|
460 |
|
|
461 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
462 |
// JingPyraminx is solved iff
|
|
463 |
// a) all of its corner and edge cubits are rotated with the same quat
|
|
464 |
// b) its 4 face cubits might also be rotated along the axis perpendicular to the face.
|
|
465 |
//
|
|
466 |
// So:
|
|
467 |
// [10] might be extra QUAT[] or QUAT[]
|
|
468 |
// [11] might be extra QUAT[] or QUAT[]
|
|
469 |
// [12] might be extra QUAT[] or QUAT[]
|
|
470 |
// [13] might be extra QUAT[] or QUAT[]
|
|
471 |
|
|
472 |
public boolean isSolved()
|
|
473 |
{
|
|
474 |
int index = CUBITS[0].mQuatIndex;
|
|
475 |
|
|
476 |
if( CUBITS[1].mQuatIndex != index ) return false;
|
|
477 |
if( CUBITS[2].mQuatIndex != index ) return false;
|
|
478 |
if( CUBITS[3].mQuatIndex != index ) return false;
|
|
479 |
if( CUBITS[4].mQuatIndex != index ) return false;
|
|
480 |
if( CUBITS[5].mQuatIndex != index ) return false;
|
|
481 |
if( CUBITS[6].mQuatIndex != index ) return false;
|
|
482 |
if( CUBITS[7].mQuatIndex != index ) return false;
|
|
483 |
if( CUBITS[8].mQuatIndex != index ) return false;
|
|
484 |
if( CUBITS[9].mQuatIndex != index ) return false;
|
|
485 |
|
|
486 |
// TODO: face cubits
|
|
487 |
|
|
488 |
return true;
|
|
489 |
}
|
|
490 |
|
|
491 |
////////////////////////////////////////////////////////////////////////
|
|
492 |
// only needed for solvers - there are no JingPyraminx solvers ATM)
|
|
493 |
|
|
494 |
public String retObjectString()
|
|
495 |
{
|
|
496 |
return "";
|
|
497 |
}
|
|
498 |
|
|
499 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
500 |
|
|
501 |
public int getObjectName(int numLayers)
|
|
502 |
{
|
|
503 |
return R.string.jing;
|
|
504 |
}
|
|
505 |
|
|
506 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
507 |
|
|
508 |
public int getInventor(int numLayers)
|
|
509 |
{
|
|
510 |
return R.string.jing_inventor;
|
|
511 |
}
|
|
512 |
|
|
513 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
514 |
|
|
515 |
public int getComplexity(int numLayers)
|
|
516 |
{
|
|
517 |
return 3;
|
|
518 |
}
|
|
519 |
}
|
New 'JingPyraminx' object.