Revision 92116505
Added by Leszek Koltunski about 1 year ago
src/main/java/org/distorted/solvers/SolverDino6.java | ||
---|---|---|
25 | 25 |
private static final int ERROR_EDGE_CANNOT = -2; |
26 | 26 |
private static final int ERROR_EDGE_TWISTED = -3; |
27 | 27 |
private static final int ERROR_EDGE_MONOCHROMATIC = -4; |
28 |
private static final int ERROR_EDGE_TWICE = -5; |
|
28 | 29 |
|
29 | 30 |
int[][] EDGE_MAP = { |
30 | 31 |
{4,2},{0,4},{4,3},{1,4}, |
... | ... | |
160 | 161 |
mFaceColors[4] = edges[0][0]; |
161 | 162 |
mFaceColors[2] = edges[0][1]; |
162 | 163 |
mFaceColors[5] = computeOpposite(mFaceColors[4], edges, present); |
163 |
if( mFaceColors[5]<0 ) return ERROR_EDGE_CANNOT;
|
|
164 |
if( mFaceColors[5]<0 ) return mFaceColors[5];
|
|
164 | 165 |
|
165 | 166 |
mFaceColors[3] = computeOpposite(mFaceColors[2], edges, present); |
166 |
if( mFaceColors[3]<0 ) return ERROR_EDGE_CANNOT;
|
|
167 |
if( mFaceColors[3]<0 ) return mFaceColors[3];
|
|
167 | 168 |
|
168 | 169 |
int success = fillUpRemainingFaceColors(present); |
169 | 170 |
if( success<0 ) return success; |
... | ... | |
199 | 200 |
|
200 | 201 |
if( notPresent(m1,m2,edges) ) |
201 | 202 |
{ |
202 |
android.util.Log.e("D", "edge missing i="+i+" m1="+m1+" m2="+m2); |
|
203 |
|
|
204 | 203 |
mErrorColor1 = mFaceColors[m1]; |
205 | 204 |
mErrorColor2 = mFaceColors[m2]; |
206 | 205 |
return ERROR_EDGE_MISSING; |
... | ... | |
342 | 341 |
return res.getString(R.string.solver_generic_edge_mono,c0,c1); |
343 | 342 |
} |
344 | 343 |
|
344 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
345 |
|
|
346 |
private String edgeTwiceError(Resources res, int color0, int color1) |
|
347 |
{ |
|
348 |
int j0 = getColorIndex3(color0); |
|
349 |
int j1 = getColorIndex6(color1); |
|
350 |
String c0 = res.getString(j0); |
|
351 |
String c1 = res.getString(j1); |
|
352 |
|
|
353 |
return res.getString(R.string.solver_generic_edge_twice,c0,c1); |
|
354 |
} |
|
355 |
|
|
345 | 356 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
346 | 357 |
|
347 | 358 |
public String error(int index, Resources res) |
... | ... | |
351 | 362 |
case ERROR_EDGE_MISSING : return edgeMissingError(res,mErrorColor1,mErrorColor2); |
352 | 363 |
case ERROR_EDGE_TWISTED : return edgeTwistedError(res,mErrorColor1,mErrorColor2); |
353 | 364 |
case ERROR_EDGE_MONOCHROMATIC: return edgeMonoError(res,mErrorColor1); |
365 |
case ERROR_EDGE_TWICE : return edgeTwiceError(res,mErrorColor1,mErrorColor2); |
|
354 | 366 |
case ERROR_EDGE_CANNOT : return res.getString(R.string.solver_generic_edges_cannot); |
355 | 367 |
} |
356 | 368 |
|
Also available in: Unified diff
Dino6 solver: errors