| 48 |
48 |
|
| 49 |
49 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
| 50 |
50 |
|
| 51 |
|
int getNumStickerTypes(int numLayers)
|
|
51 |
private int numCubitsPerCorner(int numLayers)
|
| 52 |
52 |
{
|
| 53 |
|
return 1;
|
|
53 |
return 3*((numLayers-3)/2)*((numLayers-5)/2) + (numLayers>=5 ? 1 : 0);
|
| 54 |
54 |
}
|
| 55 |
55 |
|
| 56 |
56 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
| 57 |
57 |
|
| 58 |
|
float[] getCuts(int numLayers)
|
|
58 |
private int numCubitsPerEdge(int numLayers)
|
| 59 |
59 |
{
|
| 60 |
|
return new float[] { -0.5f , 0.5f };
|
|
60 |
return numLayers<5 ? 0 : numLayers-4;
|
| 61 |
61 |
}
|
| 62 |
62 |
|
| 63 |
63 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
| 64 |
64 |
|
| 65 |
|
float[][] getCubitPositions(int numLayers)
|
|
65 |
int getNumStickerTypes(int numLayers)
|
| 66 |
66 |
{
|
| 67 |
|
return CORNERS;
|
|
67 |
return numLayers == 3 ? 1 : numLayers/2 + 1;
|
| 68 |
68 |
}
|
| 69 |
69 |
|
| 70 |
70 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
| ... | ... | |
| 75 |
75 |
}
|
| 76 |
76 |
|
| 77 |
77 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
78 |
// TODO
|
|
79 |
|
|
80 |
float[] getCuts(int numLayers)
|
|
81 |
{
|
|
82 |
return new float[] { -0.5f , 0.5f };
|
|
83 |
}
|
|
84 |
|
|
85 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
86 |
// TODO
|
|
87 |
|
|
88 |
float[][] getCubitPositions(int numLayers)
|
|
89 |
{
|
|
90 |
return CORNERS;
|
|
91 |
}
|
|
92 |
|
|
93 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
94 |
// TODO
|
| 78 |
95 |
|
| 79 |
96 |
private int getQuat(int cubit)
|
| 80 |
97 |
{
|
| ... | ... | |
| 82 |
99 |
}
|
| 83 |
100 |
|
| 84 |
101 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
102 |
// TODO
|
| 85 |
103 |
|
| 86 |
104 |
MeshBase createCubitMesh(int cubit, int numLayers)
|
| 87 |
105 |
{
|
| ... | ... | |
| 95 |
113 |
}
|
| 96 |
114 |
|
| 97 |
115 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
116 |
// TODO
|
| 98 |
117 |
|
| 99 |
118 |
int getFaceColor(int cubit, int cubitface, int numLayers)
|
| 100 |
119 |
{
|
| ... | ... | |
| 102 |
121 |
}
|
| 103 |
122 |
|
| 104 |
123 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
124 |
// TODO
|
| 105 |
125 |
|
| 106 |
126 |
void createFaceTexture(Canvas canvas, Paint paint, int face, int left, int top)
|
| 107 |
127 |
{
|
| ... | ... | |
| 126 |
146 |
|
| 127 |
147 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
| 128 |
148 |
// PUBLIC API
|
| 129 |
|
// The Kilominx is solved if and only if:
|
| 130 |
|
//
|
| 131 |
|
// All cubits are rotated with the same quat.
|
| 132 |
149 |
|
| 133 |
150 |
public boolean isSolved()
|
| 134 |
151 |
{
|
| 135 |
|
int q = CUBITS[0].mQuatIndex;
|
|
152 |
int index = CUBITS[0].mQuatIndex;
|
| 136 |
153 |
|
| 137 |
|
for(int i=0; i<NUM_CUBITS; i++)
|
|
154 |
for(int i=1; i<NUM_CUBITS; i++)
|
| 138 |
155 |
{
|
| 139 |
|
if( CUBITS[i].mQuatIndex != q ) return false;
|
|
156 |
if( thereIsVisibleDifference(CUBITS[i], index) ) return false;
|
| 140 |
157 |
}
|
| 141 |
158 |
|
| 142 |
159 |
return true;
|
| ... | ... | |
| 146 |
163 |
|
| 147 |
164 |
public int getObjectName(int numLayers)
|
| 148 |
165 |
{
|
| 149 |
|
return R.string.minx2;
|
|
166 |
if( numLayers==3 ) return R.string.minx2;
|
|
167 |
if( numLayers==5 ) return R.string.minx4;
|
|
168 |
|
|
169 |
return 0;
|
| 150 |
170 |
}
|
| 151 |
171 |
|
| 152 |
172 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
| 153 |
173 |
|
| 154 |
174 |
public int getInventor(int numLayers)
|
| 155 |
175 |
{
|
| 156 |
|
return R.string.minx2_inventor;
|
|
176 |
if( numLayers==3 ) return R.string.minx2_inventor;
|
|
177 |
if( numLayers==5 ) return R.string.minx4_inventor;
|
|
178 |
|
|
179 |
return 0;
|
| 157 |
180 |
}
|
| 158 |
181 |
|
| 159 |
182 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
Progress with any size Kilominx.