Revision c65092dd
Added by Leszek Koltunski 10 months ago
| src/main/java/org/distorted/solvers/SolverTablebase.java | ||
|---|---|---|
| 11 | 11 |
|
| 12 | 12 |
import android.content.res.Resources; |
| 13 | 13 |
|
| 14 |
import org.distorted.main.R; |
|
| 14 | 15 |
import org.distorted.objectlib.helpers.OperatingSystemInterface; |
| 15 | 16 |
import org.distorted.objectlib.main.TwistyObject; |
| 16 | 17 |
import org.distorted.objectlib.tablebases.ImplementedTablebasesList; |
| ... | ... | |
| 21 | 22 |
|
| 22 | 23 |
public abstract class SolverTablebase implements SolvingInterface |
| 23 | 24 |
{
|
| 25 |
private static final int[][] colorsHex = |
|
| 26 |
{
|
|
| 27 |
{R.string.color_yellow1,R.string.color_yellow2,R.string.color_yellow3,R.string.color_yellow4,R.string.color_yellow5,R.string.color_yellow6,R.string.color_yellow7 },
|
|
| 28 |
{R.string.color_white1 ,R.string.color_white2 ,R.string.color_white3 ,R.string.color_white4 ,R.string.color_white5 ,R.string.color_white6 ,R.string.color_white7 },
|
|
| 29 |
{R.string.color_blue1 ,R.string.color_blue2 ,R.string.color_blue3 ,R.string.color_blue4 ,R.string.color_blue5 ,R.string.color_blue6 ,R.string.color_blue7 },
|
|
| 30 |
{R.string.color_green1 ,R.string.color_green2 ,R.string.color_green3 ,R.string.color_green4 ,R.string.color_green5 ,R.string.color_green6 ,R.string.color_green7 },
|
|
| 31 |
{R.string.color_red1 ,R.string.color_red2 ,R.string.color_red3 ,R.string.color_red4 ,R.string.color_red5 ,R.string.color_red6 ,R.string.color_red7 },
|
|
| 32 |
{R.string.color_orange1,R.string.color_orange2,R.string.color_orange3,R.string.color_orange4,R.string.color_orange5,R.string.color_orange6,R.string.color_orange7 },
|
|
| 33 |
}; |
|
| 34 |
private static final int[][] colorsTet = |
|
| 35 |
{
|
|
| 36 |
{R.string.color_green1 ,R.string.color_green2 ,R.string.color_green3 ,R.string.color_green4 ,R.string.color_green5 ,R.string.color_green6 ,R.string.color_green7 },
|
|
| 37 |
{R.string.color_yellow1,R.string.color_yellow2,R.string.color_yellow3,R.string.color_yellow4,R.string.color_yellow5,R.string.color_yellow6,R.string.color_yellow7 },
|
|
| 38 |
{R.string.color_blue1 ,R.string.color_blue2 ,R.string.color_blue3 ,R.string.color_blue4 ,R.string.color_blue5 ,R.string.color_blue6 ,R.string.color_blue7 },
|
|
| 39 |
{R.string.color_red1 ,R.string.color_red2 ,R.string.color_red3 ,R.string.color_red4 ,R.string.color_red5 ,R.string.color_red6 ,R.string.color_red7 },
|
|
| 40 |
}; |
|
| 41 |
private static final int[][] colorsOct = |
|
| 42 |
{
|
|
| 43 |
{R.string.color_violet1,R.string.color_violet2,R.string.color_violet3,R.string.color_violet4,R.string.color_violet5,R.string.color_violet6,R.string.color_violet7 },
|
|
| 44 |
{R.string.color_grey1 ,R.string.color_grey2 ,R.string.color_grey3 ,R.string.color_grey4 ,R.string.color_grey5 ,R.string.color_grey6 ,R.string.color_grey7 },
|
|
| 45 |
{R.string.color_blue1 ,R.string.color_blue2 ,R.string.color_blue3 ,R.string.color_blue4 ,R.string.color_blue5 ,R.string.color_blue6 ,R.string.color_blue7 },
|
|
| 46 |
{R.string.color_red1 ,R.string.color_red2 ,R.string.color_red3 ,R.string.color_red4 ,R.string.color_red5 ,R.string.color_red6 ,R.string.color_red7 },
|
|
| 47 |
{R.string.color_orange1,R.string.color_orange2,R.string.color_orange3,R.string.color_orange4,R.string.color_orange5,R.string.color_orange6,R.string.color_orange7 },
|
|
| 48 |
{R.string.color_green1 ,R.string.color_green2 ,R.string.color_green3 ,R.string.color_green4 ,R.string.color_green5 ,R.string.color_green6 ,R.string.color_green7 },
|
|
| 49 |
{R.string.color_white1 ,R.string.color_white2 ,R.string.color_white3 ,R.string.color_white4 ,R.string.color_white5 ,R.string.color_white6 ,R.string.color_white7 },
|
|
| 50 |
{R.string.color_yellow1,R.string.color_yellow2,R.string.color_yellow3,R.string.color_yellow4,R.string.color_yellow5,R.string.color_yellow6,R.string.color_yellow7 },
|
|
| 51 |
}; |
|
| 52 |
|
|
| 24 | 53 |
private final OperatingSystemInterface mOS; |
| 25 | 54 |
private final Resources mRes; |
| 26 | 55 |
private final TwistyObject mObject; |
| ... | ... | |
| 44 | 73 |
|
| 45 | 74 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 46 | 75 |
|
| 76 |
int getHexColor(int color,int variant) { return colorsHex[color][variant]; }
|
|
| 77 |
int getTetColor(int color,int variant) { return colorsTet[color][variant]; }
|
|
| 78 |
int getOctColor(int color,int variant) { return colorsOct[color][variant]; }
|
|
| 47 | 79 |
int[] getExtra() { return null; }
|
| 48 | 80 |
|
| 49 | 81 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| src/main/java/org/distorted/solvers/SolverTablebaseCU232.java | ||
|---|---|---|
| 292 | 292 |
return edge_perm_num + 6*corner_perm_num; |
| 293 | 293 |
} |
| 294 | 294 |
|
| 295 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 296 |
|
|
| 297 |
private int getColorIndex4(int face) |
|
| 298 |
{
|
|
| 299 |
switch(mFaceColors[face]) |
|
| 300 |
{
|
|
| 301 |
case 0: return R.string.color_yellow4; |
|
| 302 |
case 1: return R.string.color_white4; |
|
| 303 |
case 2: return R.string.color_blue4; |
|
| 304 |
case 3: return R.string.color_green4; |
|
| 305 |
case 4: return R.string.color_red4; |
|
| 306 |
case 5: return R.string.color_orange4; |
|
| 307 |
} |
|
| 308 |
|
|
| 309 |
return -1; |
|
| 310 |
} |
|
| 311 |
|
|
| 312 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 313 |
|
|
| 314 |
private int getColorIndex3(int face) |
|
| 315 |
{
|
|
| 316 |
switch(mFaceColors[face]) |
|
| 317 |
{
|
|
| 318 |
case 0: return R.string.color_yellow3; |
|
| 319 |
case 1: return R.string.color_white3; |
|
| 320 |
case 2: return R.string.color_blue3; |
|
| 321 |
case 3: return R.string.color_green3; |
|
| 322 |
case 4: return R.string.color_red3; |
|
| 323 |
case 5: return R.string.color_orange3; |
|
| 324 |
} |
|
| 325 |
|
|
| 326 |
return -1; |
|
| 327 |
} |
|
| 328 |
|
|
| 329 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 330 |
|
|
| 331 |
private int getColorIndex6(int face) |
|
| 332 |
{
|
|
| 333 |
switch(mFaceColors[face]) |
|
| 334 |
{
|
|
| 335 |
case 0: return R.string.color_yellow6; |
|
| 336 |
case 1: return R.string.color_white6; |
|
| 337 |
case 2: return R.string.color_blue6; |
|
| 338 |
case 3: return R.string.color_green6; |
|
| 339 |
case 4: return R.string.color_red6; |
|
| 340 |
case 5: return R.string.color_orange6; |
|
| 341 |
} |
|
| 342 |
|
|
| 343 |
return -1; |
|
| 344 |
} |
|
| 345 |
|
|
| 346 | 295 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 347 | 296 |
|
| 348 | 297 |
private String edgeError(Resources res, int face0, int face1) |
| 349 | 298 |
{
|
| 350 |
int j0 = getColorIndex3(face0);
|
|
| 351 |
int j1 = getColorIndex6(face1);
|
|
| 299 |
int j0 = getHexColor(face0,3);
|
|
| 300 |
int j1 = getHexColor(face1,6);
|
|
| 352 | 301 |
|
| 353 | 302 |
String c0 = res.getString(j0); |
| 354 | 303 |
String c1 = res.getString(j1); |
| ... | ... | |
| 360 | 309 |
|
| 361 | 310 |
private String cornerError(Resources res, int face0, int face1, int face2) |
| 362 | 311 |
{
|
| 363 |
int j0 = getColorIndex3(face0);
|
|
| 364 |
int j1 = getColorIndex3(face1);
|
|
| 365 |
int j2 = getColorIndex4(face2);
|
|
| 312 |
int j0 = getHexColor(face0,3);
|
|
| 313 |
int j1 = getHexColor(face1,3);
|
|
| 314 |
int j2 = getHexColor(face2,4);
|
|
| 366 | 315 |
|
| 367 | 316 |
String c0 = res.getString(j0); |
| 368 | 317 |
String c1 = res.getString(j1); |
| src/main/java/org/distorted/solvers/SolverTablebaseCU323.java | ||
|---|---|---|
| 295 | 295 |
return corner_perm_num + 40320*( centersInPlace + 2*edge_perm_num); |
| 296 | 296 |
} |
| 297 | 297 |
|
| 298 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 299 |
|
|
| 300 |
private int getColorIndex4(int color) |
|
| 301 |
{
|
|
| 302 |
switch(color) |
|
| 303 |
{
|
|
| 304 |
case 0: return R.string.color_yellow4; |
|
| 305 |
case 1: return R.string.color_white4; |
|
| 306 |
case 2: return R.string.color_blue4; |
|
| 307 |
case 3: return R.string.color_green4; |
|
| 308 |
case 4: return R.string.color_red4; |
|
| 309 |
case 5: return R.string.color_orange4; |
|
| 310 |
} |
|
| 311 |
|
|
| 312 |
return -1; |
|
| 313 |
} |
|
| 314 |
|
|
| 315 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 316 |
|
|
| 317 |
private int getColorIndex3(int color) |
|
| 318 |
{
|
|
| 319 |
switch(color) |
|
| 320 |
{
|
|
| 321 |
case 0: return R.string.color_yellow3; |
|
| 322 |
case 1: return R.string.color_white3; |
|
| 323 |
case 2: return R.string.color_blue3; |
|
| 324 |
case 3: return R.string.color_green3; |
|
| 325 |
case 4: return R.string.color_red3; |
|
| 326 |
case 5: return R.string.color_orange3; |
|
| 327 |
} |
|
| 328 |
|
|
| 329 |
return -1; |
|
| 330 |
} |
|
| 331 |
|
|
| 332 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 333 |
|
|
| 334 |
private int getColorIndex5(int color) |
|
| 335 |
{
|
|
| 336 |
switch(color) |
|
| 337 |
{
|
|
| 338 |
case 0: return R.string.color_yellow5; |
|
| 339 |
case 1: return R.string.color_white5; |
|
| 340 |
case 2: return R.string.color_blue5; |
|
| 341 |
case 3: return R.string.color_green5; |
|
| 342 |
case 4: return R.string.color_red5; |
|
| 343 |
case 5: return R.string.color_orange5; |
|
| 344 |
} |
|
| 345 |
|
|
| 346 |
return -1; |
|
| 347 |
} |
|
| 348 |
|
|
| 349 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 350 |
|
|
| 351 |
private int getColorIndex6(int color) |
|
| 352 |
{
|
|
| 353 |
switch(color) |
|
| 354 |
{
|
|
| 355 |
case 0: return R.string.color_yellow6; |
|
| 356 |
case 1: return R.string.color_white6; |
|
| 357 |
case 2: return R.string.color_blue6; |
|
| 358 |
case 3: return R.string.color_green6; |
|
| 359 |
case 4: return R.string.color_red6; |
|
| 360 |
case 5: return R.string.color_orange6; |
|
| 361 |
} |
|
| 362 |
|
|
| 363 |
return -1; |
|
| 364 |
} |
|
| 365 |
|
|
| 366 | 298 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 367 | 299 |
|
| 368 | 300 |
private String edgeTwistedError(Resources res, int color0, int color1) |
| 369 | 301 |
{
|
| 370 |
int j0 = getColorIndex3(color0);
|
|
| 371 |
int j1 = getColorIndex6(color1);
|
|
| 302 |
int j0 = getHexColor(color0,3);
|
|
| 303 |
int j1 = getHexColor(color1,6);
|
|
| 372 | 304 |
|
| 373 | 305 |
String c0 = res.getString(j0); |
| 374 | 306 |
String c1 = res.getString(j1); |
| ... | ... | |
| 380 | 312 |
|
| 381 | 313 |
private String cornerTwistedError(Resources res, int color0, int color1, int color2) |
| 382 | 314 |
{
|
| 383 |
int j0 = getColorIndex3(color0);
|
|
| 384 |
int j1 = getColorIndex3(color1);
|
|
| 385 |
int j2 = getColorIndex5(color2);
|
|
| 315 |
int j0 = getHexColor(color0,3);
|
|
| 316 |
int j1 = getHexColor(color1,3);
|
|
| 317 |
int j2 = getHexColor(color2,5);
|
|
| 386 | 318 |
|
| 387 | 319 |
String c0 = res.getString(j0); |
| 388 | 320 |
String c1 = res.getString(j1); |
| ... | ... | |
| 395 | 327 |
|
| 396 | 328 |
private String edgeMissingError(Resources res, int color0, int color1) |
| 397 | 329 |
{
|
| 398 |
int j0 = getColorIndex3(color0);
|
|
| 399 |
int j1 = getColorIndex6(color1);
|
|
| 330 |
int j0 = getHexColor(color0,3);
|
|
| 331 |
int j1 = getHexColor(color1,6);
|
|
| 400 | 332 |
|
| 401 | 333 |
String c0 = res.getString(j0); |
| 402 | 334 |
String c1 = res.getString(j1); |
| ... | ... | |
| 408 | 340 |
|
| 409 | 341 |
private String cornerMissingError(Resources res, int color0, int color1, int color2) |
| 410 | 342 |
{
|
| 411 |
int j0 = getColorIndex3(color0);
|
|
| 412 |
int j1 = getColorIndex3(color1);
|
|
| 413 |
int j2 = getColorIndex4(color2);
|
|
| 343 |
int j0 = getHexColor(color0,3);
|
|
| 344 |
int j1 = getHexColor(color1,3);
|
|
| 345 |
int j2 = getHexColor(color2,4);
|
|
| 414 | 346 |
|
| 415 | 347 |
String c0 = res.getString(j0); |
| 416 | 348 |
String c1 = res.getString(j1); |
| src/main/java/org/distorted/solvers/SolverTablebaseCUBE2.java | ||
|---|---|---|
| 208 | 208 |
return twistNum + 729*permNum; |
| 209 | 209 |
} |
| 210 | 210 |
|
| 211 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 212 |
|
|
| 213 |
private int getColorIndex4(int face) |
|
| 214 |
{
|
|
| 215 |
switch(mFaceColors[face]) |
|
| 216 |
{
|
|
| 217 |
case 0: return R.string.color_yellow4; |
|
| 218 |
case 1: return R.string.color_white4; |
|
| 219 |
case 2: return R.string.color_blue4; |
|
| 220 |
case 3: return R.string.color_green4; |
|
| 221 |
case 4: return R.string.color_red4; |
|
| 222 |
case 5: return R.string.color_orange4; |
|
| 223 |
} |
|
| 224 |
|
|
| 225 |
return -1; |
|
| 226 |
} |
|
| 227 |
|
|
| 228 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 229 |
|
|
| 230 |
private int getColorIndex3(int face) |
|
| 231 |
{
|
|
| 232 |
switch(mFaceColors[face]) |
|
| 233 |
{
|
|
| 234 |
case 0: return R.string.color_yellow3; |
|
| 235 |
case 1: return R.string.color_white3; |
|
| 236 |
case 2: return R.string.color_blue3; |
|
| 237 |
case 3: return R.string.color_green3; |
|
| 238 |
case 4: return R.string.color_red3; |
|
| 239 |
case 5: return R.string.color_orange3; |
|
| 240 |
} |
|
| 241 |
|
|
| 242 |
return -1; |
|
| 243 |
} |
|
| 244 |
|
|
| 245 | 211 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 246 | 212 |
|
| 247 | 213 |
private String cornerError(Resources res, int face0, int face1, int face2) |
| 248 | 214 |
{
|
| 249 |
int j0 = getColorIndex3(face0);
|
|
| 250 |
int j1 = getColorIndex3(face1);
|
|
| 251 |
int j2 = getColorIndex4(face2);
|
|
| 215 |
int j0 = getHexColor(face0,3);
|
|
| 216 |
int j1 = getHexColor(face1,3);
|
|
| 217 |
int j2 = getHexColor(face2,4);
|
|
| 252 | 218 |
|
| 253 | 219 |
String c0 = res.getString(j0); |
| 254 | 220 |
String c1 = res.getString(j1); |
| src/main/java/org/distorted/solvers/SolverTablebaseDIAM2.java | ||
|---|---|---|
| 387 | 387 |
return centers_perm_num + 12*(totalTwist + 32*corners_perm_num); |
| 388 | 388 |
} |
| 389 | 389 |
|
| 390 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 391 |
|
|
| 392 |
private int getColorIndex4(int face) |
|
| 393 |
{
|
|
| 394 |
switch(mFaceColors[face]) |
|
| 395 |
{
|
|
| 396 |
case 0: return R.string.color_violet4; |
|
| 397 |
case 1: return R.string.color_grey4; |
|
| 398 |
case 2: return R.string.color_blue4; |
|
| 399 |
case 3: return R.string.color_red4; |
|
| 400 |
case 4: return R.string.color_orange4; |
|
| 401 |
case 5: return R.string.color_green4; |
|
| 402 |
case 6: return R.string.color_white4; |
|
| 403 |
case 7: return R.string.color_yellow4; |
|
| 404 |
} |
|
| 405 |
|
|
| 406 |
return -1; |
|
| 407 |
} |
|
| 408 |
|
|
| 409 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 410 |
|
|
| 411 |
private int getColorIndex3(int face) |
|
| 412 |
{
|
|
| 413 |
switch(mFaceColors[face]) |
|
| 414 |
{
|
|
| 415 |
case 0: return R.string.color_violet3; |
|
| 416 |
case 1: return R.string.color_grey3; |
|
| 417 |
case 2: return R.string.color_blue3; |
|
| 418 |
case 3: return R.string.color_red3; |
|
| 419 |
case 4: return R.string.color_orange3; |
|
| 420 |
case 5: return R.string.color_green3; |
|
| 421 |
case 6: return R.string.color_white3; |
|
| 422 |
case 7: return R.string.color_yellow3; |
|
| 423 |
} |
|
| 424 |
|
|
| 425 |
return -1; |
|
| 426 |
} |
|
| 427 |
|
|
| 428 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 429 |
|
|
| 430 |
private int getColorIndex2(int face) |
|
| 431 |
{
|
|
| 432 |
switch(face) |
|
| 433 |
{
|
|
| 434 |
case 0: return R.string.color_violet2; |
|
| 435 |
case 1: return R.string.color_grey2; |
|
| 436 |
case 2: return R.string.color_blue2; |
|
| 437 |
case 3: return R.string.color_red2; |
|
| 438 |
case 4: return R.string.color_orange2; |
|
| 439 |
case 5: return R.string.color_green2; |
|
| 440 |
case 6: return R.string.color_white2; |
|
| 441 |
case 7: return R.string.color_yellow2; |
|
| 442 |
} |
|
| 443 |
|
|
| 444 |
return -1; |
|
| 445 |
} |
|
| 446 |
|
|
| 447 | 390 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 448 | 391 |
|
| 449 | 392 |
private String centerError(Resources res, int face) |
| 450 | 393 |
{
|
| 451 |
String color = res.getString(getColorIndex2(face)); |
|
| 394 |
int index = getOctColor(face,2); |
|
| 395 |
String color = res.getString(index); |
|
| 452 | 396 |
return res.getString(R.string.solver_generic_missing_center,color); |
| 453 | 397 |
} |
| 454 | 398 |
|
| ... | ... | |
| 456 | 400 |
|
| 457 | 401 |
private String cornerError(Resources res, int f1, int f2) |
| 458 | 402 |
{
|
| 459 |
String c1 = res.getString(getColorIndex3(f1)); |
|
| 460 |
String c2 = res.getString(getColorIndex4(f2)); |
|
| 403 |
int i1 = getOctColor(f1,3); |
|
| 404 |
int i2 = getOctColor(f2,4); |
|
| 405 |
String c1 = res.getString(i1); |
|
| 406 |
String c2 = res.getString(i2); |
|
| 461 | 407 |
return res.getString(R.string.solver_generic_missing_corner2,c1,c2); |
| 462 | 408 |
} |
| 463 | 409 |
|
| src/main/java/org/distorted/solvers/SolverTablebaseDINO6.java | ||
|---|---|---|
| 331 | 331 |
return TBDino6.getIndexFromPerm(perm); |
| 332 | 332 |
} |
| 333 | 333 |
|
| 334 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 335 |
|
|
| 336 |
private int getColorIndex3(int color) |
|
| 337 |
{
|
|
| 338 |
switch(color) |
|
| 339 |
{
|
|
| 340 |
case 0: return R.string.color_yellow3; |
|
| 341 |
case 1: return R.string.color_white3; |
|
| 342 |
case 2: return R.string.color_blue3; |
|
| 343 |
case 3: return R.string.color_green3; |
|
| 344 |
case 4: return R.string.color_red3; |
|
| 345 |
case 5: return R.string.color_orange3; |
|
| 346 |
} |
|
| 347 |
|
|
| 348 |
return -1; |
|
| 349 |
} |
|
| 350 |
|
|
| 351 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 352 |
|
|
| 353 |
private int getColorIndex6(int color) |
|
| 354 |
{
|
|
| 355 |
switch(color) |
|
| 356 |
{
|
|
| 357 |
case 0: return R.string.color_yellow6; |
|
| 358 |
case 1: return R.string.color_white6; |
|
| 359 |
case 2: return R.string.color_blue6; |
|
| 360 |
case 3: return R.string.color_green6; |
|
| 361 |
case 4: return R.string.color_red6; |
|
| 362 |
case 5: return R.string.color_orange6; |
|
| 363 |
} |
|
| 364 |
|
|
| 365 |
return -1; |
|
| 366 |
} |
|
| 367 |
|
|
| 368 | 334 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 369 | 335 |
|
| 370 | 336 |
private String edgeMissingError(Resources res, int color0, int color1) |
| 371 | 337 |
{
|
| 372 |
int j0 = getColorIndex3(color0);
|
|
| 373 |
int j1 = getColorIndex6(color1);
|
|
| 338 |
int j0 = getHexColor(color0,3);
|
|
| 339 |
int j1 = getHexColor(color1,6);
|
|
| 374 | 340 |
|
| 375 | 341 |
String c0 = res.getString(j0); |
| 376 | 342 |
String c1 = res.getString(j1); |
| ... | ... | |
| 382 | 348 |
|
| 383 | 349 |
private String edgeTwistedError(Resources res, int color0, int color1) |
| 384 | 350 |
{
|
| 385 |
int j0 = getColorIndex3(color0);
|
|
| 386 |
int j1 = getColorIndex6(color1);
|
|
| 351 |
int j0 = getHexColor(color0,3);
|
|
| 352 |
int j1 = getHexColor(color1,6);
|
|
| 387 | 353 |
|
| 388 | 354 |
String c0 = res.getString(j0); |
| 389 | 355 |
String c1 = res.getString(j1); |
| ... | ... | |
| 395 | 361 |
|
| 396 | 362 |
private String edgeMonoError(Resources res, int color) |
| 397 | 363 |
{
|
| 398 |
int j0 = getColorIndex3(color);
|
|
| 399 |
int j1 = getColorIndex6(color);
|
|
| 364 |
int j0 = getHexColor(color,3);
|
|
| 365 |
int j1 = getHexColor(color,6);
|
|
| 400 | 366 |
String c0 = res.getString(j0); |
| 401 | 367 |
String c1 = res.getString(j1); |
| 402 | 368 |
|
| ... | ... | |
| 407 | 373 |
|
| 408 | 374 |
private String edgeTwiceError(Resources res, int color0, int color1) |
| 409 | 375 |
{
|
| 410 |
int j0 = getColorIndex3(color0);
|
|
| 411 |
int j1 = getColorIndex6(color1);
|
|
| 376 |
int j0 = getHexColor(color0,3);
|
|
| 377 |
int j1 = getHexColor(color1,6);
|
|
| 412 | 378 |
String c0 = res.getString(j0); |
| 413 | 379 |
String c1 = res.getString(j1); |
| 414 | 380 |
|
| src/main/java/org/distorted/solvers/SolverTablebaseJING2.java | ||
|---|---|---|
| 395 | 395 |
return green_face + 4*(vertexTwist + 81*(edgeTwist + 32*perm_num)); |
| 396 | 396 |
} |
| 397 | 397 |
|
| 398 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 399 |
|
|
| 400 |
private int getColorIndex3(int color) |
|
| 401 |
{
|
|
| 402 |
switch(color) |
|
| 403 |
{
|
|
| 404 |
case 0: return R.string.color_green3; |
|
| 405 |
case 1: return R.string.color_yellow3; |
|
| 406 |
case 2: return R.string.color_blue3; |
|
| 407 |
case 3: return R.string.color_red3; |
|
| 408 |
} |
|
| 409 |
|
|
| 410 |
return -1; |
|
| 411 |
} |
|
| 412 |
|
|
| 413 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 414 |
|
|
| 415 |
private int getColorIndex4(int color) |
|
| 416 |
{
|
|
| 417 |
switch(color) |
|
| 418 |
{
|
|
| 419 |
case 0: return R.string.color_green4; |
|
| 420 |
case 1: return R.string.color_yellow4; |
|
| 421 |
case 2: return R.string.color_blue4; |
|
| 422 |
case 3: return R.string.color_red4; |
|
| 423 |
} |
|
| 424 |
|
|
| 425 |
return -1; |
|
| 426 |
} |
|
| 427 |
|
|
| 428 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 429 |
|
|
| 430 |
private int getFaceIndex3(int face) |
|
| 431 |
{
|
|
| 432 |
switch(mFaceColors[face]) |
|
| 433 |
{
|
|
| 434 |
case 0: return R.string.color_green3; |
|
| 435 |
case 1: return R.string.color_yellow3; |
|
| 436 |
case 2: return R.string.color_blue3; |
|
| 437 |
case 3: return R.string.color_red3; |
|
| 438 |
} |
|
| 439 |
|
|
| 440 |
return -1; |
|
| 441 |
} |
|
| 442 |
|
|
| 443 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 444 |
|
|
| 445 |
private int getFaceIndex6(int face) |
|
| 446 |
{
|
|
| 447 |
switch(mFaceColors[face]) |
|
| 448 |
{
|
|
| 449 |
case 0: return R.string.color_green6; |
|
| 450 |
case 1: return R.string.color_yellow6; |
|
| 451 |
case 2: return R.string.color_blue6; |
|
| 452 |
case 3: return R.string.color_red6; |
|
| 453 |
} |
|
| 454 |
|
|
| 455 |
return -1; |
|
| 456 |
} |
|
| 457 |
|
|
| 458 | 398 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 459 | 399 |
|
| 460 | 400 |
private String cornerError(Resources res, int color0, int color1, int color2) |
| 461 | 401 |
{
|
| 462 |
int j0 = getColorIndex3(color0);
|
|
| 463 |
int j1 = getColorIndex3(color1);
|
|
| 464 |
int j2 = getColorIndex4(color2);
|
|
| 402 |
int j0 = getTetColor(color0,3);
|
|
| 403 |
int j1 = getTetColor(color1,3);
|
|
| 404 |
int j2 = getTetColor(color2,4);
|
|
| 465 | 405 |
|
| 466 | 406 |
String c0 = res.getString(j0); |
| 467 | 407 |
String c1 = res.getString(j1); |
| ... | ... | |
| 474 | 414 |
|
| 475 | 415 |
private String edgeError(Resources res, int face0, int face1) |
| 476 | 416 |
{
|
| 477 |
int j0 = getFaceIndex3(face0);
|
|
| 478 |
int j1 = getFaceIndex6(face1);
|
|
| 417 |
int j0 = getTetColor(mFaceColors[face0],3);
|
|
| 418 |
int j1 = getTetColor(mFaceColors[face1],6);
|
|
| 479 | 419 |
|
| 480 | 420 |
String c0 = res.getString(j0); |
| 481 | 421 |
String c1 = res.getString(j1); |
| src/main/java/org/distorted/solvers/SolverTablebasePDIA3.java | ||
|---|---|---|
| 253 | 253 |
return total_twist + 2048*centers_perm_num; |
| 254 | 254 |
} |
| 255 | 255 |
|
| 256 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 257 |
|
|
| 258 |
private int getColorIndex4(int face) |
|
| 259 |
{
|
|
| 260 |
switch(mFaceColors[face]) |
|
| 261 |
{
|
|
| 262 |
case 0: return R.string.color_violet4; |
|
| 263 |
case 1: return R.string.color_grey4; |
|
| 264 |
case 2: return R.string.color_blue4; |
|
| 265 |
case 3: return R.string.color_red4; |
|
| 266 |
case 4: return R.string.color_orange4; |
|
| 267 |
case 5: return R.string.color_green4; |
|
| 268 |
case 6: return R.string.color_white4; |
|
| 269 |
case 7: return R.string.color_yellow4; |
|
| 270 |
} |
|
| 271 |
|
|
| 272 |
return -1; |
|
| 273 |
} |
|
| 274 |
|
|
| 275 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 276 |
|
|
| 277 |
private int getColorIndex3(int face) |
|
| 278 |
{
|
|
| 279 |
switch(mFaceColors[face]) |
|
| 280 |
{
|
|
| 281 |
case 0: return R.string.color_violet3; |
|
| 282 |
case 1: return R.string.color_grey3; |
|
| 283 |
case 2: return R.string.color_blue3; |
|
| 284 |
case 3: return R.string.color_red3; |
|
| 285 |
case 4: return R.string.color_orange3; |
|
| 286 |
case 5: return R.string.color_green3; |
|
| 287 |
case 6: return R.string.color_white3; |
|
| 288 |
case 7: return R.string.color_yellow3; |
|
| 289 |
} |
|
| 290 |
|
|
| 291 |
return -1; |
|
| 292 |
} |
|
| 293 |
|
|
| 294 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 295 |
|
|
| 296 |
private int getColorIndex2(int face) |
|
| 297 |
{
|
|
| 298 |
switch(face) |
|
| 299 |
{
|
|
| 300 |
case 0: return R.string.color_violet2; |
|
| 301 |
case 1: return R.string.color_grey2; |
|
| 302 |
case 2: return R.string.color_blue2; |
|
| 303 |
case 3: return R.string.color_red2; |
|
| 304 |
case 4: return R.string.color_orange2; |
|
| 305 |
case 5: return R.string.color_green2; |
|
| 306 |
case 6: return R.string.color_white2; |
|
| 307 |
case 7: return R.string.color_yellow2; |
|
| 308 |
} |
|
| 309 |
|
|
| 310 |
return -1; |
|
| 311 |
} |
|
| 312 |
|
|
| 313 | 256 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 314 | 257 |
|
| 315 | 258 |
private String centerError(Resources res, int face) |
| 316 | 259 |
{
|
| 317 |
String color = res.getString(getColorIndex2(face)); |
|
| 260 |
int index = getOctColor(face,2); |
|
| 261 |
String color = res.getString(index); |
|
| 318 | 262 |
return res.getString(R.string.solver_generic_missing_center,color); |
| 319 | 263 |
} |
| 320 | 264 |
|
| ... | ... | |
| 322 | 266 |
|
| 323 | 267 |
private String cornerError(Resources res, int f1, int f2) |
| 324 | 268 |
{
|
| 325 |
String c1 = res.getString(getColorIndex3(f1)); |
|
| 326 |
String c2 = res.getString(getColorIndex4(f2)); |
|
| 269 |
int i1 = getOctColor(f1,3); |
|
| 270 |
int i2 = getOctColor(f2,4); |
|
| 271 |
String c1 = res.getString(i1); |
|
| 272 |
String c2 = res.getString(i2); |
|
| 327 | 273 |
return res.getString(R.string.solver_generic_missing_corner2,c1,c2); |
| 328 | 274 |
} |
| 329 | 275 |
|
| src/main/java/org/distorted/solvers/SolverTablebasePYRA3.java | ||
|---|---|---|
| 397 | 397 |
return vertexTwist + 81*(edgeTwist + 32*perm_num); |
| 398 | 398 |
} |
| 399 | 399 |
|
| 400 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 401 |
|
|
| 402 |
private int getColorIndex3(int color) |
|
| 403 |
{
|
|
| 404 |
switch(color) |
|
| 405 |
{
|
|
| 406 |
case 0: return R.string.color_green3; |
|
| 407 |
case 1: return R.string.color_yellow3; |
|
| 408 |
case 2: return R.string.color_blue3; |
|
| 409 |
case 3: return R.string.color_red3; |
|
| 410 |
} |
|
| 411 |
|
|
| 412 |
return -1; |
|
| 413 |
} |
|
| 414 |
|
|
| 415 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 416 |
|
|
| 417 |
private int getColorIndex4(int color) |
|
| 418 |
{
|
|
| 419 |
switch(color) |
|
| 420 |
{
|
|
| 421 |
case 0: return R.string.color_green4; |
|
| 422 |
case 1: return R.string.color_yellow4; |
|
| 423 |
case 2: return R.string.color_blue4; |
|
| 424 |
case 3: return R.string.color_red4; |
|
| 425 |
} |
|
| 426 |
|
|
| 427 |
return -1; |
|
| 428 |
} |
|
| 429 |
|
|
| 430 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 431 |
|
|
| 432 |
private int getFaceIndex3(int face) |
|
| 433 |
{
|
|
| 434 |
switch(mFaceColors[face]) |
|
| 435 |
{
|
|
| 436 |
case 0: return R.string.color_green3; |
|
| 437 |
case 1: return R.string.color_yellow3; |
|
| 438 |
case 2: return R.string.color_blue3; |
|
| 439 |
case 3: return R.string.color_red3; |
|
| 440 |
} |
|
| 441 |
|
|
| 442 |
return -1; |
|
| 443 |
} |
|
| 444 |
|
|
| 445 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 446 |
|
|
| 447 |
private int getFaceIndex6(int face) |
|
| 448 |
{
|
|
| 449 |
switch(mFaceColors[face]) |
|
| 450 |
{
|
|
| 451 |
case 0: return R.string.color_green6; |
|
| 452 |
case 1: return R.string.color_yellow6; |
|
| 453 |
case 2: return R.string.color_blue6; |
|
| 454 |
case 3: return R.string.color_red6; |
|
| 455 |
} |
|
| 456 |
|
|
| 457 |
return -1; |
|
| 458 |
} |
|
| 459 |
|
|
| 460 | 400 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 461 | 401 |
|
| 462 | 402 |
private String cornerError(Resources res, int color0, int color1, int color2) |
| 463 | 403 |
{
|
| 464 |
int j0 = getColorIndex3(color0);
|
|
| 465 |
int j1 = getColorIndex3(color1);
|
|
| 466 |
int j2 = getColorIndex4(color2);
|
|
| 404 |
int j0 = getTetColor(color0,3);
|
|
| 405 |
int j1 = getTetColor(color1,3);
|
|
| 406 |
int j2 = getTetColor(color2,4);
|
|
| 467 | 407 |
|
| 468 | 408 |
String c0 = res.getString(j0); |
| 469 | 409 |
String c1 = res.getString(j1); |
| ... | ... | |
| 476 | 416 |
|
| 477 | 417 |
private String vertexError(Resources res, int color0, int color1, int color2) |
| 478 | 418 |
{
|
| 479 |
int j0 = getColorIndex3(color0);
|
|
| 480 |
int j1 = getColorIndex3(color1);
|
|
| 481 |
int j2 = getColorIndex4(color2);
|
|
| 419 |
int j0 = getTetColor(color0,3);
|
|
| 420 |
int j1 = getTetColor(color1,3);
|
|
| 421 |
int j2 = getTetColor(color2,4);
|
|
| 482 | 422 |
|
| 483 | 423 |
String c0 = res.getString(j0); |
| 484 | 424 |
String c1 = res.getString(j1); |
| ... | ... | |
| 491 | 431 |
|
| 492 | 432 |
private String edgeError(Resources res, int color0, int color1) |
| 493 | 433 |
{
|
| 494 |
int j0 = getFaceIndex3(color0);
|
|
| 495 |
int j1 = getFaceIndex6(color1);
|
|
| 434 |
int j0 = getTetColor(mFaceColors[color0],3);
|
|
| 435 |
int j1 = getTetColor(mFaceColors[color1],6);
|
|
| 496 | 436 |
|
| 497 | 437 |
String c0 = res.getString(j0); |
| 498 | 438 |
String c1 = res.getString(j1); |
| src/main/java/org/distorted/solvers/SolverTablebaseSKEW2.java | ||
|---|---|---|
| 323 | 323 |
return center_perm_num+ 360*(totalTwist + 2187*freeLoc[0]); |
| 324 | 324 |
} |
| 325 | 325 |
|
| 326 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 327 |
|
|
| 328 |
private int getColorIndex2(int face) |
|
| 329 |
{
|
|
| 330 |
switch(mFaceColors[face]) |
|
| 331 |
{
|
|
| 332 |
case 0: return R.string.color_yellow2; |
|
| 333 |
case 1: return R.string.color_white2; |
|
| 334 |
case 2: return R.string.color_blue2; |
|
| 335 |
case 3: return R.string.color_green2; |
|
| 336 |
case 4: return R.string.color_red2; |
|
| 337 |
case 5: return R.string.color_orange2; |
|
| 338 |
} |
|
| 339 |
|
|
| 340 |
return -1; |
|
| 341 |
} |
|
| 342 |
|
|
| 343 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 344 |
|
|
| 345 |
private int getColorIndex3(int face) |
|
| 346 |
{
|
|
| 347 |
switch(mFaceColors[face]) |
|
| 348 |
{
|
|
| 349 |
case 0: return R.string.color_yellow3; |
|
| 350 |
case 1: return R.string.color_white3; |
|
| 351 |
case 2: return R.string.color_blue3; |
|
| 352 |
case 3: return R.string.color_green3; |
|
| 353 |
case 4: return R.string.color_red3; |
|
| 354 |
case 5: return R.string.color_orange3; |
|
| 355 |
} |
|
| 356 |
|
|
| 357 |
return -1; |
|
| 358 |
} |
|
| 359 |
|
|
| 360 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 361 |
|
|
| 362 |
private int getColorIndex4(int face) |
|
| 363 |
{
|
|
| 364 |
switch(mFaceColors[face]) |
|
| 365 |
{
|
|
| 366 |
case 0: return R.string.color_yellow4; |
|
| 367 |
case 1: return R.string.color_white4; |
|
| 368 |
case 2: return R.string.color_blue4; |
|
| 369 |
case 3: return R.string.color_green4; |
|
| 370 |
case 4: return R.string.color_red4; |
|
| 371 |
case 5: return R.string.color_orange4; |
|
| 372 |
} |
|
| 373 |
|
|
| 374 |
return -1; |
|
| 375 |
} |
|
| 376 |
|
|
| 377 | 326 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 378 | 327 |
|
| 379 | 328 |
private String cornerError(Resources res, int face0, int face1, int face2) |
| 380 | 329 |
{
|
| 381 |
int j0 = getColorIndex3(face0);
|
|
| 382 |
int j1 = getColorIndex3(face1);
|
|
| 383 |
int j2 = getColorIndex4(face2);
|
|
| 330 |
int j0 = getHexColor(face0,3);
|
|
| 331 |
int j1 = getHexColor(face1,3);
|
|
| 332 |
int j2 = getHexColor(face2,4);
|
|
| 384 | 333 |
|
| 385 | 334 |
String c0 = res.getString(j0); |
| 386 | 335 |
String c1 = res.getString(j1); |
| ... | ... | |
| 393 | 342 |
|
| 394 | 343 |
private String centerError(Resources res, int face) |
| 395 | 344 |
{
|
| 396 |
int color = getColorIndex2(face);
|
|
| 345 |
int color = getHexColor(face,2);
|
|
| 397 | 346 |
String clr= res.getString(color); |
| 398 | 347 |
return res.getString(R.string.solver_generic_missing_center,clr); |
| 399 | 348 |
} |
| src/main/java/org/distorted/solvers/SolvingInterface.java | ||
|---|---|---|
| 15 | 15 |
|
| 16 | 16 |
public interface SolvingInterface |
| 17 | 17 |
{
|
| 18 |
public void solve(ScreenSolver screen);
|
|
| 18 |
void solve(ScreenSolver screen); |
|
| 19 | 19 |
} |
Also available in: Unified diff
Standarize solver 'validity of position' methods.