Revision 6aed3662
Added by Leszek Koltunski 2 days ago
src/main/java/org/distorted/phasedsolver/SolverActivity.java | ||
---|---|---|
41 | 41 |
private SolvedObject mObject; |
42 | 42 |
private int[][] mMoveTable; |
43 | 43 |
private String mMoves; |
44 |
private int mNumMoves; |
|
44 | 45 |
|
45 | 46 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
46 | 47 |
|
... | ... | |
57 | 58 |
mLowerPane = new SolverLowerPane(this); |
58 | 59 |
mText = findViewById(R.id.solverMoves); |
59 | 60 |
mMoves = ""; |
61 |
mNumMoves = 0; |
|
60 | 62 |
} |
61 | 63 |
|
62 | 64 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
161 | 163 |
{ |
162 | 164 |
int mi = s[m]; |
163 | 165 |
moves[index++] = mMoveTable[mi]; |
164 |
android.util.Log.e("D","move "+m+" : "+mMoveTable[mi][0]+" "+mMoveTable[mi][1]+" "+mMoveTable[mi][2]); |
|
166 |
// android.util.Log.e("D","move "+m+" : "+mMoveTable[mi][0]+" "+mMoveTable[mi][1]+" "+mMoveTable[mi][2]);
|
|
165 | 167 |
} |
166 | 168 |
} |
167 | 169 |
|
... | ... | |
226 | 228 |
String llCornersOrie = llco+" "+llco+" "+llco+" "+llco; |
227 | 229 |
String llCorners = llCornersPerm+" "+llCornersOrie; |
228 | 230 |
|
229 |
int[][] algsOrie = { {11,17,5,15,3,9},{3} }; |
|
230 |
int[][] algsPerm = { {5,6,3,9,5,8,3,11},{3} }; |
|
231 |
int[][] algsEdgeOrie = { {11,17,5,15,3,9},{3} }; |
|
232 |
int[][] algsEdgePerm = { {6,5,8,5,6,4,8},{3} }; |
|
233 |
int[][] algsCornPerm = { {5,6,3,9,5,8,3,11},{3} }; |
|
234 |
int[][] algsCornOrie = { {15,2,17,0,15,2,17,0},{3} }; |
|
231 | 235 |
|
232 | 236 |
int[][] moveTable = mObject.getMoveTable(); |
233 | 237 |
MoveProviderAll all = new MoveProviderAll(moveTable); |
234 |
MoveProviderAlgs alO = new MoveProviderAlgs(algsOrie); |
|
235 |
MoveProviderAlgs alP = new MoveProviderAlgs(algsPerm); |
|
238 |
MoveProviderAlgs aeO = new MoveProviderAlgs(algsEdgeOrie); |
|
239 |
MoveProviderAlgs aeP = new MoveProviderAlgs(algsEdgePerm); |
|
240 |
MoveProviderAlgs acP = new MoveProviderAlgs(algsCornPerm); |
|
241 |
MoveProviderAlgs acO = new MoveProviderAlgs(algsCornOrie); |
|
236 | 242 |
|
237 | 243 |
TargetProvider wcr = new TargetProviderAll(whiteCross); |
238 | 244 |
TargetProvider wco = new TargetProviderAll(whiteCorners); |
239 | 245 |
TargetProvider sla = new TargetProviderAll(secondLayer); |
240 | 246 |
TargetProvider oll = new TargetProviderOrie(mObject,14,1); |
241 | 247 |
TargetProvider pll = new TargetProviderPerm(mObject,14,1); |
248 |
TargetProvider pcl = new TargetProviderPerm(mObject, 4,1); |
|
249 |
TargetProvider ocl = new TargetProviderOrie(mObject, 4,1); |
|
242 | 250 |
|
243 | 251 |
Phase[] phases = |
244 | 252 |
{ |
245 | 253 |
new PhaseMitm( mObject, all, wcr), |
246 | 254 |
new PhaseMitm( mObject, all, wco), |
247 | 255 |
new PhaseMitm( mObject, all, sla), |
248 |
new PhaseMitm( mObject, alO, oll), |
|
249 |
new PhaseMitm( mObject, alP, pll), |
|
256 |
new PhaseMitm( mObject, aeO, oll), |
|
257 |
new PhaseMitm( mObject, aeP, pll), |
|
258 |
new PhaseMitm( mObject, acP, pcl), |
|
259 |
new PhaseMitm( mObject, acO, ocl), |
|
250 | 260 |
}; |
251 | 261 |
|
252 | 262 |
SolverPhased ps = new SolverPhased(mObject,phases); |
... | ... | |
269 | 279 |
control.solveObject(); |
270 | 280 |
mLowerPane.clearMoves(this); |
271 | 281 |
|
282 |
mNumMoves = 0; |
|
272 | 283 |
mMoves = ""; |
273 | 284 |
mText.setText(mMoves); |
274 | 285 |
} |
... | ... | |
295 | 306 |
if( mObject==null ) createObject(); |
296 | 307 |
int move = findMove(axis,row,angle); |
297 | 308 |
mMoves += (" "+move); |
309 |
mNumMoves++; |
|
310 |
|
|
311 |
if( mNumMoves>10 ) |
|
312 |
{ |
|
313 |
int space = mMoves.indexOf(' '); |
|
314 |
mMoves = mMoves.substring(space+2); |
|
315 |
mNumMoves--; |
|
316 |
} |
|
317 |
|
|
298 | 318 |
mText.setText(mMoves); |
299 | 319 |
} |
300 | 320 |
|
Also available in: Unified diff
All phases of the 3x3 beginner (seem to) work now.