Revision 7981e108
Added by Leszek Koltunski 2 days ago
src/main/java/org/distorted/phasedsolver/SolverActivity.java | ||
---|---|---|
40 | 40 |
private TextView mText; |
41 | 41 |
private SolvedObject mObject; |
42 | 42 |
private int[][] mMoveTable; |
43 |
private int[][] mBasicAngles; |
|
43 | 44 |
private String mMoves; |
44 | 45 |
private int mNumMoves; |
45 | 46 |
|
... | ... | |
187 | 188 |
|
188 | 189 |
mObject = new SolvedObject(pos,axis,angles,cuts,rot); |
189 | 190 |
mMoveTable = mObject.getMoveTable(); |
191 |
mBasicAngles = angles; |
|
190 | 192 |
} |
191 | 193 |
|
192 | 194 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
194 | 196 |
public void Solve(View v) |
195 | 197 |
{ |
196 | 198 |
if( mObject==null ) createObject(); |
199 |
int[][] moveTable = mObject.getMoveTable(); |
|
197 | 200 |
|
198 | 201 |
TwistyObject object = getControl().getObject(); |
199 |
int[] numL = object.getNumLayers(); |
|
200 |
float[][] pos = object.getCubitPositions(numL); |
|
201 |
|
|
202 |
int[] numL = object.getNumLayers(); |
|
203 |
float[][] pos = object.getCubitPositions(numL); |
|
202 | 204 |
int numCubits = pos.length; |
203 | 205 |
int[] qi = new int[numCubits]; |
204 | 206 |
for(int i=0; i<numCubits; i++) qi[i] = object.getCubitQuatIndex(i); |
... | ... | |
207 | 209 |
int[][] whiteCorners = new int[][]{ {0},{1},{2},{3} }; |
208 | 210 |
int[][] secondLayer = new int[][]{ {8},{9},{10},{11} }; |
209 | 211 |
|
210 |
int[][] algsSecondL = { { 6, 3, 8, 3,15, 5,17}, {15, 5,17, 5, 6, 3, 8}, |
|
211 |
{12, 3,14, 3, 8, 5, 6}, { 8, 5, 6, 5,12, 3,14}, |
|
212 |
{11, 3, 9, 3,14, 5,12}, {14, 5,12, 5,11, 3, 9}, |
|
213 |
{17, 3,15, 3, 9, 5,11}, { 9, 5,11, 5,17, 3,15}, |
|
214 |
{3} |
|
215 |
}; |
|
216 |
|
|
217 |
int[][] algsEdgeOrie = { {11,17,5,15,3,9},{3} }; |
|
218 |
int[][] algsEdgePerm = { {6,5,8,5,6,4,8},{3} }; |
|
219 |
int[][] algsCornPerm = { {5,6,3,9,5,8,3,11},{3} }; |
|
220 |
int[][] algsCornOrie = { {15,2,17,0,15,2,17,0},{3} }; |
|
212 |
String a1 = "(3){-1,0,1,2}(6,3,8,3,15,5,17)"; |
|
213 |
String a2 = "(3){-1,0,1,2}(15,5,17,5,6,3,8)"; |
|
214 |
String a3 = "(3){-1,0,1,2}(12,3,14,3,8,5,6)"; |
|
215 |
String a4 = "(3){-1,0,1,2}(8,5,6,5,12,3,14)"; |
|
216 |
String a5 = "(3){-1,0,1,2}(11,3,9,3,14,5,12)"; |
|
217 |
String a6 = "(3){-1,0,1,2}(14,5,12,5,11,3,9)"; |
|
218 |
String a7 = "(3){-1,0,1,2}(17,3,15,3,9,5,11)"; |
|
219 |
String a8 = "(3){-1,0,1,2}(9,5,11,5,17,3,15)"; |
|
221 | 220 |
|
222 |
int[][] moveTable = mObject.getMoveTable(); |
|
223 | 221 |
MoveProviderAll all = new MoveProviderAll(moveTable); |
224 |
MoveProviderAlgs asl = new MoveProviderAlgs(algsSecondL);
|
|
225 |
MoveProviderAlgs aeO = new MoveProviderAlgs(algsEdgeOrie);
|
|
226 |
MoveProviderAlgs aeP = new MoveProviderAlgs(algsEdgePerm);
|
|
227 |
MoveProviderAlgs acP = new MoveProviderAlgs(algsCornPerm);
|
|
228 |
MoveProviderAlgs acO = new MoveProviderAlgs(algsCornOrie);
|
|
222 |
MoveProviderAlgs asl = new MoveProviderAlgs(mObject, "["+a1+";"+a2+";"+a3+";"+a4+";"+a5+";"+a6+";"+a7+";"+a8+"]");
|
|
223 |
MoveProviderAlgs aeO = new MoveProviderAlgs(mObject, "(3){-1,0,1,2}(11,17,5,15,3,9)");
|
|
224 |
MoveProviderAlgs aeP = new MoveProviderAlgs(mObject, "(3){-1,0,1,2}(6,5,8,5,6,4,8){0,1}");
|
|
225 |
MoveProviderAlgs acP = new MoveProviderAlgs(mObject, "(3){-1,0,1,2}(5,6,3,9,5,8,3,11){0,1}");
|
|
226 |
MoveProviderAlgs acO = new MoveProviderAlgs(mObject, "(3){-1,0,1,2}(15,2,17,0){-2,0,2}");
|
|
229 | 227 |
|
230 | 228 |
TargetProvider wcr = new TargetProviderAll(whiteCross); |
231 | 229 |
TargetProvider wco = new TargetProviderAll(whiteCorners); |
... | ... | |
276 | 274 |
int findMove(int ax, int row, int angle) |
277 | 275 |
{ |
278 | 276 |
int num = mMoveTable.length; |
277 |
int basicAngle = mBasicAngles[ax][row]; |
|
279 | 278 |
|
280 | 279 |
for( int m=0; m<num; m++) |
281 | 280 |
{ |
282 | 281 |
int[] move = mMoveTable[m]; |
283 |
if( ax==move[0] && row==move[1] && angle==move[2] ) return m;
|
|
282 |
if( ax==move[0] && row==move[1] && ((angle-move[2])%basicAngle)==0 ) return m;
|
|
284 | 283 |
} |
285 | 284 |
|
286 | 285 |
return -1; |
Also available in: Unified diff
3x3 Beginner should be finished. Everything seems to work, and work fast.