Project

General

Profile

« Previous | Next » 

Revision fc08e3ca

Added by Leszek Koltunski 1 day ago

  • ID fc08e3ca18bec97b554c7c68260d567da97454e9
  • Parent 2f53a016

Unify the position verifiers (for verifying if a manually set position for solving is possible!)

View differences:

src/main/java/org/distorted/solvers/SolverTablebaseCU232.java
20 20

  
21 21
public class SolverTablebaseCU232 extends SolverTablebase
22 22
{
23
  private static final int ERROR_CORNER_135_MISSING = -1;
24
  private static final int ERROR_CORNER_134_MISSING = -2;
25
  private static final int ERROR_CORNER_125_MISSING = -3;
26
  private static final int ERROR_CORNER_124_MISSING = -4;
27
  private static final int ERROR_CORNER_035_MISSING = -5;
28
  private static final int ERROR_CORNER_034_MISSING = -6;
29
  private static final int ERROR_CORNER_025_MISSING = -7;
30
  private static final int ERROR_CORNER_024_MISSING = -8;
31

  
32
  private static final int ERROR_EDGE_15_MISSING = -9;
33
  private static final int ERROR_EDGE_14_MISSING = -10;
34
  private static final int ERROR_EDGE_05_MISSING = -11;
35
  private static final int ERROR_EDGE_04_MISSING = -12;
36

  
37
  private static final int ERROR_CORNERS_CANNOT  = -13;
38
  private static final int ERROR_EDGE_TWISTED    = -14;
39
  private static final int ERROR_CORNER_TWISTED  = -15;
23
  private static final int ERROR_CORNER_MISSING = -1;
24
  private static final int ERROR_EDGE_MISSING   = -2;
25
  private static final int ERROR_CORNERS_CANNOT = -3;
26
  private static final int ERROR_EDGE_TWISTED   = -4;
27
  private static final int ERROR_CORNER_TWISTED = -5;
40 28

  
41 29
  private final int[] mFaceColors;
30
  private int mErrColor1, mErrColor2, mErrColor3;
42 31

  
43 32
///////////////////////////////////////////////////////////////////////////////////////////////////
44 33

  
......
77 66
      else if( edge3==1 ) return ERROR_EDGE_TWISTED;
78 67
      }
79 68

  
80
    if( output[0]==-1 ) return ERROR_EDGE_15_MISSING;
81
    if( output[1]==-1 ) return ERROR_EDGE_14_MISSING;
82
    if( output[2]==-1 ) return ERROR_EDGE_05_MISSING;
83
    if( output[3]==-1 ) return ERROR_EDGE_04_MISSING;
69
    if( output[0]==-1 ) { mErrColor1=1; mErrColor2=5; return ERROR_EDGE_MISSING; }
70
    if( output[1]==-1 ) { mErrColor1=1; mErrColor2=4; return ERROR_EDGE_MISSING; }
71
    if( output[2]==-1 ) { mErrColor1=0; mErrColor2=5; return ERROR_EDGE_MISSING; }
72
    if( output[3]==-1 ) { mErrColor1=0; mErrColor2=4; return ERROR_EDGE_MISSING; }
84 73

  
85 74
    return 0;
86 75
    }
......
145 134
      else if( corner0==1 ) return ERROR_CORNER_TWISTED;
146 135
      }
147 136

  
148
    if( output[0]==-1 ) return ERROR_CORNER_135_MISSING;
149
    if( output[1]==-1 ) return ERROR_CORNER_134_MISSING;
150
    if( output[2]==-1 ) return ERROR_CORNER_125_MISSING;
151
    if( output[3]==-1 ) return ERROR_CORNER_124_MISSING;
152
    if( output[4]==-1 ) return ERROR_CORNER_035_MISSING;
153
    if( output[5]==-1 ) return ERROR_CORNER_034_MISSING;
154
    if( output[6]==-1 ) return ERROR_CORNER_025_MISSING;
155
    if( output[7]==-1 ) return ERROR_CORNER_024_MISSING;
137
    if( output[0]==-1 ) { mErrColor1=1; mErrColor2=3; mErrColor3=5; return ERROR_CORNER_MISSING; }
138
    if( output[1]==-1 ) { mErrColor1=1; mErrColor2=3; mErrColor3=4; return ERROR_CORNER_MISSING; }
139
    if( output[2]==-1 ) { mErrColor1=1; mErrColor2=2; mErrColor3=5; return ERROR_CORNER_MISSING; }
140
    if( output[3]==-1 ) { mErrColor1=1; mErrColor2=3; mErrColor3=4; return ERROR_CORNER_MISSING; }
141
    if( output[4]==-1 ) { mErrColor1=0; mErrColor2=3; mErrColor3=5; return ERROR_CORNER_MISSING; }
142
    if( output[5]==-1 ) { mErrColor1=0; mErrColor2=3; mErrColor3=4; return ERROR_CORNER_MISSING; }
143
    if( output[6]==-1 ) { mErrColor1=0; mErrColor2=2; mErrColor3=5; return ERROR_CORNER_MISSING; }
144
    if( output[7]==-1 ) { mErrColor1=0; mErrColor2=2; mErrColor3=4; return ERROR_CORNER_MISSING; }
156 145

  
157 146
    return 0;
158 147
    }
......
326 315
    {
327 316
    switch(index)
328 317
      {
329
      case ERROR_CORNER_135_MISSING: return cornerError(res,1,3,5);
330
      case ERROR_CORNER_134_MISSING: return cornerError(res,1,3,4);
331
      case ERROR_CORNER_125_MISSING: return cornerError(res,1,2,5);
332
      case ERROR_CORNER_124_MISSING: return cornerError(res,1,2,4);
333
      case ERROR_CORNER_035_MISSING: return cornerError(res,0,3,5);
334
      case ERROR_CORNER_034_MISSING: return cornerError(res,0,3,4);
335
      case ERROR_CORNER_025_MISSING: return cornerError(res,0,2,5);
336
      case ERROR_CORNER_024_MISSING: return cornerError(res,0,2,4);
337

  
338
      case ERROR_EDGE_15_MISSING   : return edgeError(res,1,5);
339
      case ERROR_EDGE_14_MISSING   : return edgeError(res,1,4);
340
      case ERROR_EDGE_05_MISSING   : return edgeError(res,0,5);
341
      case ERROR_EDGE_04_MISSING   : return edgeError(res,0,4);
342

  
343
      case ERROR_CORNERS_CANNOT    : return res.getString(R.string.solver_generic_corners_cannot);
344
      case ERROR_EDGE_TWISTED      : return res.getString(R.string.solver_generic_edge_twist);
345
      case ERROR_CORNER_TWISTED    : return res.getString(R.string.solver_generic_corner_twist);
318
      case ERROR_CORNER_MISSING: return cornerError(res,mErrColor1,mErrColor2,mErrColor3);
319
      case ERROR_EDGE_MISSING  : return edgeError(res,mErrColor1,mErrColor2);
320
      case ERROR_CORNERS_CANNOT: return res.getString(R.string.solver_generic_corners_cannot);
321
      case ERROR_EDGE_TWISTED  : return res.getString(R.string.solver_generic_edge_twist);
322
      case ERROR_CORNER_TWISTED: return res.getString(R.string.solver_generic_corner_twist);
346 323
      }
347 324

  
348 325
    return null;
src/main/java/org/distorted/solvers/SolverTablebaseCU323.java
29 29
  private static final int ERROR_CORNER_TWISTED = -5;
30 30

  
31 31
  private final int[] mFaceColors;
32
  private int mErrorColor1, mErrorColor2, mErrorColor3;
32
  private int mErrColor1, mErrColor2, mErrColor3;
33 33

  
34 34
///////////////////////////////////////////////////////////////////////////////////////////////////
35 35

  
......
88 88
      if( edge[0]==c0 && edge[1]==c1 ) return i;
89 89
      if( edge[0]==c1 && edge[1]==c0 )
90 90
        {
91
        mErrorColor1 = c0;
92
        mErrorColor2 = c1;
91
        mErrColor1 = c0;
92
        mErrColor2 = c1;
93 93
        return ERROR_EDGE_TWISTED;
94 94
        }
95 95
      }
96 96

  
97
    mErrorColor1 = c0;
98
    mErrorColor2 = c1;
97
    mErrColor1 = c0;
98
    mErrColor2 = c1;
99 99
    return ERROR_EDGE_MISSING;
100 100
    }
101 101

  
......
115 115
      if( (corner[0]==c1 && corner[1]==c2 && corner[2]==c0 ) ||
116 116
          (corner[0]==c2 && corner[1]==c0 && corner[2]==c1 )  )
117 117
        {
118
        mErrorColor1 = c0;
119
        mErrorColor2 = c1;
120
        mErrorColor3 = c2;
118
        mErrColor1 = c0;
119
        mErrColor2 = c1;
120
        mErrColor3 = c2;
121 121
        return ERROR_CORNER_TWISTED;
122 122
        }
123 123
      }
124 124

  
125
    mErrorColor1 = c0;
126
    mErrorColor2 = c1;
127
    mErrorColor3 = c2;
125
    mErrColor1 = c0;
126
    mErrColor2 = c1;
127
    mErrColor3 = c2;
128 128
    return ERROR_CORNER_MISSING;
129 129
    }
130 130

  
......
357 357
    {
358 358
    switch(index)
359 359
      {
360
      case ERROR_CORNER_MISSING : return cornerMissingError(res,mErrorColor1,mErrorColor2,mErrorColor3);
361
      case ERROR_EDGE_MISSING   : return edgeMissingError(res,mErrorColor1,mErrorColor2);
360
      case ERROR_CORNER_MISSING : return cornerMissingError(res,mErrColor1,mErrColor2,mErrColor3);
361
      case ERROR_EDGE_MISSING   : return edgeMissingError(res,mErrColor1,mErrColor2);
362 362
      case ERROR_CORNERS_CANNOT : return res.getString(R.string.solver_generic_corners_cannot);
363
      case ERROR_EDGE_TWISTED   : return edgeTwistedError(res,mErrorColor1,mErrorColor2);
364
      case ERROR_CORNER_TWISTED : return cornerTwistedError(res,mErrorColor1,mErrorColor2,mErrorColor3);
363
      case ERROR_EDGE_TWISTED   : return edgeTwistedError(res,mErrColor1,mErrColor2);
364
      case ERROR_CORNER_TWISTED : return cornerTwistedError(res,mErrColor1,mErrColor2,mErrColor3);
365 365
      }
366 366

  
367 367
    return null;
src/main/java/org/distorted/solvers/SolverTablebaseCUBE2.java
21 21

  
22 22
public class SolverTablebaseCUBE2 extends SolverTablebase
23 23
{
24
  private static final int ERROR_CORNER_135_MISSING = -1;
25
  private static final int ERROR_CORNER_134_MISSING = -2;
26
  private static final int ERROR_CORNER_125_MISSING = -3;
27
  private static final int ERROR_CORNER_124_MISSING = -4;
28
  private static final int ERROR_CORNER_035_MISSING = -5;
29
  private static final int ERROR_CORNER_034_MISSING = -6;
30
  private static final int ERROR_CORNER_025_MISSING = -7;
31
  private static final int ERROR_CORNER_024_MISSING = -8;
32
  private static final int ERROR_CORNERS_CANNOT     = -9;
33
  private static final int ERROR_CORNER_TWISTED     = -10;
24
  private static final int ERROR_CORNER_MISSING = -1;
25
  private static final int ERROR_CORNERS_CANNOT = -2;
26
  private static final int ERROR_CORNER_TWISTED = -3;
34 27

  
35 28
  private final int[] mFaceColors;
29
  private int mErrColor1, mErrColor2, mErrColor3;
36 30

  
37 31
////////////////////////////////////////////////////////////////////////////////////////
38 32

  
......
83 77
    output[6] = cornerIndex(corners, 0,3,5);
84 78
    output[7] = cornerIndex(corners, 0,4,3);
85 79

  
86
    if( output[0]==-1 ) return ERROR_CORNER_125_MISSING;
87
    if( output[1]==-1 ) return ERROR_CORNER_124_MISSING;
88
    if( output[2]==-1 ) return ERROR_CORNER_135_MISSING;
89
    if( output[3]==-1 ) return ERROR_CORNER_134_MISSING;
90
    if( output[4]==-1 ) return ERROR_CORNER_025_MISSING;
91
    if( output[5]==-1 ) return ERROR_CORNER_024_MISSING;
92
    if( output[6]==-1 ) return ERROR_CORNER_035_MISSING;
93
    if( output[7]==-1 ) return ERROR_CORNER_034_MISSING;
80
    if( output[0]==-1 ) { mErrColor1=1; mErrColor2=2; mErrColor3=5; return ERROR_CORNER_MISSING; }
81
    if( output[1]==-1 ) { mErrColor1=1; mErrColor2=4; mErrColor3=2; return ERROR_CORNER_MISSING; }
82
    if( output[2]==-1 ) { mErrColor1=1; mErrColor2=5; mErrColor3=3; return ERROR_CORNER_MISSING; }
83
    if( output[3]==-1 ) { mErrColor1=1; mErrColor2=3; mErrColor3=4; return ERROR_CORNER_MISSING; }
84
    if( output[4]==-1 ) { mErrColor1=0; mErrColor2=5; mErrColor3=2; return ERROR_CORNER_MISSING; }
85
    if( output[5]==-1 ) { mErrColor1=0; mErrColor2=2; mErrColor3=4; return ERROR_CORNER_MISSING; }
86
    if( output[6]==-1 ) { mErrColor1=0; mErrColor2=3; mErrColor3=5; return ERROR_CORNER_MISSING; }
87
    if( output[7]==-1 ) { mErrColor1=0; mErrColor2=4; mErrColor3=3; return ERROR_CORNER_MISSING; }
94 88

  
95 89
    return 0;
96 90
    }
......
229 223
    {
230 224
    switch(index)
231 225
      {
232
      case ERROR_CORNER_135_MISSING: return cornerError(res,1,3,5);
233
      case ERROR_CORNER_134_MISSING: return cornerError(res,1,3,4);
234
      case ERROR_CORNER_125_MISSING: return cornerError(res,1,2,5);
235
      case ERROR_CORNER_124_MISSING: return cornerError(res,1,2,4);
236
      case ERROR_CORNER_035_MISSING: return cornerError(res,0,3,5);
237
      case ERROR_CORNER_034_MISSING: return cornerError(res,0,3,4);
238
      case ERROR_CORNER_025_MISSING: return cornerError(res,0,2,5);
239
      case ERROR_CORNER_024_MISSING: return cornerError(res,0,2,4);
240
      case ERROR_CORNERS_CANNOT    : return res.getString(R.string.solver_generic_corners_cannot);
241
      case ERROR_CORNER_TWISTED    : return res.getString(R.string.solver_generic_corner_twist);
226
      case ERROR_CORNER_MISSING: return cornerError(res,mErrColor1,mErrColor2,mErrColor3);
227
      case ERROR_CORNERS_CANNOT: return res.getString(R.string.solver_generic_corners_cannot);
228
      case ERROR_CORNER_TWISTED: return res.getString(R.string.solver_generic_corner_twist);
242 229
      }
243 230

  
244 231
    return null;
src/main/java/org/distorted/solvers/SolverTablebaseDIAM2.java
20 20

  
21 21
public class SolverTablebaseDIAM2 extends SolverTablebase
22 22
{
23
  private static final int ERROR_CORNER_FR_MISSING = -1;
24
  private static final int ERROR_CORNER_BR_MISSING = -2;
25
  private static final int ERROR_CORNER_BL_MISSING = -3;
26
  private static final int ERROR_CORNER_FL_MISSING = -4;
27
  private static final int ERROR_CORNER_TO_MISSING = -5;
28
  private static final int ERROR_CORNER_BO_MISSING = -6;
29

  
30
  private static final int ERROR_CENTER_0_MISSING = -7;
31
  private static final int ERROR_CENTER_1_MISSING = -8;
32
  private static final int ERROR_CENTER_2_MISSING = -9;
33
  private static final int ERROR_CENTER_3_MISSING = -10;
34
  private static final int ERROR_CENTER_4_MISSING = -11;
35
  private static final int ERROR_CENTER_5_MISSING = -12;
36
  private static final int ERROR_CENTER_6_MISSING = -13;
37
  private static final int ERROR_CENTER_7_MISSING = -14;
38

  
39
  private static final int ERROR_TWO_CORNERS      = -15;
40
  private static final int ERROR_TWO_CENTERS      = -16;
41
  private static final int ERROR_CORNER_TWIST_90  = -17;
42
  private static final int ERROR_CORNER_TWIST_180 = -18;
43
  private static final int ERROR_CORNERS_CANNOT   = -19;
23
  private static final int ERROR_CORNER_MISSING   = -1;
24
  private static final int ERROR_CENTER_MISSING   = -2;
25
  private static final int ERROR_TWO_CORNERS      = -3;
26
  private static final int ERROR_TWO_CENTERS      = -4;
27
  private static final int ERROR_CORNER_TWIST_90  = -5;
28
  private static final int ERROR_CORNER_TWIST_180 = -6;
29
  private static final int ERROR_CORNERS_CANNOT   = -7;
44 30

  
45 31
  private final int[] mFaceColors;
46

  
32
  private int mErrColor1, mErrColor2;
47 33
  private static final int[] FREE_CENTERS = {0,2,5,7};
48 34

  
49 35
///////////////////////////////////////////////////////////////////////////////////////////////////
......
148 134
      if( t==1 || t==3 ) return ERROR_CORNER_TWIST_90;
149 135
      if( t==2 )
150 136
        {
151
        if( i<5 )
152
          {
153
          total+=(1<<i);
154
          even = !even;
155
          }
156
        else if( even ) return ERROR_CORNER_TWIST_180;
137
        if( i<5 ) total+=(1<<i);
138
        even = !even;
157 139
        }
158 140
      }
159 141

  
160
    return total;
142
    return even ? total : ERROR_CORNER_TWIST_180;
161 143
    }
162 144

  
163 145
///////////////////////////////////////////////////////////////////////////////////////////////////
......
198 180
    output[6] = centers[6];
199 181

  
200 182
    int color01 = figureOutColor(corners,output[4],output[1]);
201
    if( color01<0 ) return ERROR_CORNER_FR_MISSING;
183
    if( color01<0 ) { mErrColor1=4; mErrColor2=1; return ERROR_CORNER_MISSING; }
202 184
    int color02 = figureOutColor(corners,output[3],output[4]);
203
    if( color02<0 ) return ERROR_CORNER_FL_MISSING;
185
    if( color02<0 ) { mErrColor1=3; mErrColor2=4; return ERROR_CORNER_MISSING; }
204 186
    int color03 = figureOutColor(corners,output[1],output[3]);
205
    if( color03<0 ) return ERROR_CORNER_TO_MISSING;
187
    if( color03<0 ) { mErrColor1=1; mErrColor2=3; return ERROR_CORNER_MISSING; }
206 188
    if( color01!=color02 || color01!=color03 ) return ERROR_CORNERS_CANNOT;
207 189
    output[0] = color01;
208 190

  
209 191
    int color21 = figureOutColor(corners,output[1],output[6]);
210
    if( color21<0 ) return ERROR_CORNER_BR_MISSING;
192
    if( color21<0 ) { mErrColor1=1; mErrColor2=6; return ERROR_CORNER_MISSING; }
211 193
    int color22 = figureOutColor(corners,output[6],output[3]);
212
    if( color22<0 ) return ERROR_CORNER_BL_MISSING;
194
    if( color22<0 ) { mErrColor1=6; mErrColor2=3; return ERROR_CORNER_MISSING; }
213 195
    int color23 = figureOutColor(corners,output[3],output[1]);
214
    if( color23<0 ) return ERROR_CORNER_TO_MISSING;
196
    if( color23<0 ) { mErrColor1=3; mErrColor2=1; return ERROR_CORNER_MISSING; }
215 197
    if( color21!=color22 || color21!=color23 ) return ERROR_CORNERS_CANNOT;
216 198
    output[2] = color21;
217 199

  
218 200
    int color51 = figureOutColor(corners,output[1],output[4]);
219
    if( color51<0 ) return ERROR_CORNER_FR_MISSING;
201
    if( color51<0 ) { mErrColor1=1; mErrColor2=4; return ERROR_CORNER_MISSING; }
220 202
    int color52 = figureOutColor(corners,output[6],output[1]);
221
    if( color52<0 ) return ERROR_CORNER_BR_MISSING;
203
    if( color52<0 ) { mErrColor1=6; mErrColor2=1; return ERROR_CORNER_MISSING; }
222 204
    int color53 = figureOutColor(corners,output[4],output[6]);
223
    if( color53<0 ) return ERROR_CORNER_BO_MISSING;
205
    if( color53<0 ) { mErrColor1=4; mErrColor2=6; return ERROR_CORNER_MISSING; }
224 206
    if( color51!=color52 || color51!=color53 ) return ERROR_CORNERS_CANNOT;
225 207
    output[5] = color51;
226 208

  
227 209
    int color71 = figureOutColor(corners,output[3],output[6]);
228
    if( color71<0 ) return ERROR_CORNER_BL_MISSING;
210
    if( color71<0 ) { mErrColor1=3; mErrColor2=6; return ERROR_CORNER_MISSING; }
229 211
    int color72 = figureOutColor(corners,output[4],output[3]);
230
    if( color72<0 ) return ERROR_CORNER_FL_MISSING;
212
    if( color72<0 ) { mErrColor1=4; mErrColor2=3; return ERROR_CORNER_MISSING; }
231 213
    int color73 = figureOutColor(corners,output[6],output[4]);
232
    if( color73<0 ) return ERROR_CORNER_BO_MISSING;
214
    if( color73<0 ) { mErrColor1=6; mErrColor2=4; return ERROR_CORNER_MISSING; }
233 215
    if( color71!=color72 || color71!=color73 ) return ERROR_CORNERS_CANNOT;
234 216
    output[7] = color71;
235 217

  
......
272 254
          break;
273 255
          }
274 256

  
275
      if( !present )
276
        {
277
        switch(i)
278
          {
279
          case 0: return ERROR_CENTER_0_MISSING;
280
          case 1: return ERROR_CENTER_1_MISSING;
281
          case 2: return ERROR_CENTER_2_MISSING;
282
          case 3: return ERROR_CENTER_3_MISSING;
283
          case 4: return ERROR_CENTER_4_MISSING;
284
          case 5: return ERROR_CENTER_5_MISSING;
285
          case 6: return ERROR_CENTER_6_MISSING;
286
          case 7: return ERROR_CENTER_7_MISSING;
287
          }
288
        }
257
      if( !present ) { mErrColor1=i; return ERROR_CENTER_MISSING; }
289 258
      }
290 259

  
291 260
    return 0;
......
413 382
    {
414 383
    switch(index)
415 384
      {
416
      case ERROR_CORNER_FR_MISSING: return cornerError(res,1,4);
417
      case ERROR_CORNER_BR_MISSING: return cornerError(res,1,6);
418
      case ERROR_CORNER_BL_MISSING: return cornerError(res,3,6);
419
      case ERROR_CORNER_FL_MISSING: return cornerError(res,3,4);
420
      case ERROR_CORNER_TO_MISSING: return cornerError(res,1,3);
421
      case ERROR_CORNER_BO_MISSING: return cornerError(res,4,6);
422

  
423
      case ERROR_CENTER_0_MISSING : return centerError(res,0);
424
      case ERROR_CENTER_1_MISSING : return centerError(res,1);
425
      case ERROR_CENTER_2_MISSING : return centerError(res,2);
426
      case ERROR_CENTER_3_MISSING : return centerError(res,3);
427
      case ERROR_CENTER_4_MISSING : return centerError(res,4);
428
      case ERROR_CENTER_5_MISSING : return centerError(res,5);
429
      case ERROR_CENTER_6_MISSING : return centerError(res,6);
430
      case ERROR_CENTER_7_MISSING : return centerError(res,7);
431

  
385
      case ERROR_CORNER_MISSING   : return cornerError(res,mErrColor1,mErrColor2);
386
      case ERROR_CENTER_MISSING   : return centerError(res,mErrColor1);
432 387
      case ERROR_TWO_CORNERS      : return res.getString(R.string.solver_generic_two_corners);
433 388
      case ERROR_TWO_CENTERS      : return res.getString(R.string.solver_generic_two_centers);
434 389
      case ERROR_CORNER_TWIST_90  : return res.getString(R.string.solver_generic_corner_twist) + " (90)";
src/main/java/org/distorted/solvers/SolverTablebaseIVY2.java
20 20

  
21 21
public class SolverTablebaseIVY2 extends SolverTablebase
22 22
{
23
  private static final int ERROR_CENTER_O_MISSING = -1;
24
  private static final int ERROR_CENTER_W_MISSING = -2;
25
  private static final int ERROR_CENTER_G_MISSING = -3;
26
  private static final int ERROR_CENTER_Y_MISSING = -4;
27
  private static final int ERROR_CENTER_B_MISSING = -5;
28
  private static final int ERROR_CENTER_R_MISSING = -6;
29
  private static final int ERROR_TWO_CENTERS_SWAP = -7;
30
  private static final int ERROR_CORNERS_CANNOT   = -8;
23
  private static final int ERROR_CENTER_MISSING   = -1;
24
  private static final int ERROR_TWO_CENTERS_SWAP = -2;
25
  private static final int ERROR_CORNERS_CANNOT   = -3;
26

  
27
  private int mErrorColor;
31 28

  
32 29
///////////////////////////////////////////////////////////////////////////////////////////////////
33 30

  
......
47 44
          break;
48 45
          }
49 46

  
50
      if( error )
51
        {
52
        switch(color)
53
          {
54
          case 0: return ERROR_CENTER_Y_MISSING;
55
          case 1: return ERROR_CENTER_W_MISSING;
56
          case 2: return ERROR_CENTER_B_MISSING;
57
          case 3: return ERROR_CENTER_G_MISSING;
58
          case 4: return ERROR_CENTER_R_MISSING;
59
          case 5: return ERROR_CENTER_O_MISSING;
60
          }
61
        }
47
      if( error ) { mErrorColor=color; return ERROR_CENTER_MISSING; }
62 48
      }
63 49

  
64 50
    return 0;
......
209 195
    return perm_num + 360*(twist[0]+ 3*(twist[1]+ 3*(twist[2]+ 3*twist[3])));
210 196
    }
211 197

  
198
///////////////////////////////////////////////////////////////////////////////////////////////////
199

  
200
  private String centerError(Resources res, int face)
201
    {
202
    int j = getHexColor(face,2);
203
    String c = res.getString(j);
204
    return res.getString(R.string.solver_generic_missing_center,c);
205
    }
206

  
212 207
///////////////////////////////////////////////////////////////////////////////////////////////////
213 208

  
214 209
  public String error(int index, Resources res)
215 210
    {
216 211
    switch(index)
217 212
      {
218
      case ERROR_CENTER_W_MISSING  : String colorW = res.getString(R.string.color_white2);
219
                                     return res.getString(R.string.solver_generic_missing_center,colorW);
220
      case ERROR_CENTER_O_MISSING  : String colorO = res.getString(R.string.color_orange2);
221
                                     return res.getString(R.string.solver_generic_missing_center,colorO);
222
      case ERROR_CENTER_G_MISSING  : String colorG = res.getString(R.string.color_green2);
223
                                     return res.getString(R.string.solver_generic_missing_center,colorG);
224
      case ERROR_CENTER_Y_MISSING  : String colorY = res.getString(R.string.color_yellow2);
225
                                     return res.getString(R.string.solver_generic_missing_center,colorY);
226
      case ERROR_CENTER_B_MISSING  : String colorB = res.getString(R.string.color_blue2);
227
                                     return res.getString(R.string.solver_generic_missing_center,colorB);
228
      case ERROR_CENTER_R_MISSING  : String colorR = res.getString(R.string.color_red2);
229
                                     return res.getString(R.string.solver_generic_missing_center,colorR);
230
      case ERROR_TWO_CENTERS_SWAP  : return res.getString(R.string.solver_generic_two_centers);
231
      case ERROR_CORNERS_CANNOT    : return res.getString(R.string.solver_generic_corners_cannot);
213
      case ERROR_CENTER_MISSING  : return centerError(res,mErrorColor);
214
      case ERROR_TWO_CENTERS_SWAP: return res.getString(R.string.solver_generic_two_centers);
215
      case ERROR_CORNERS_CANNOT  : return res.getString(R.string.solver_generic_corners_cannot);
232 216
      }
233 217

  
234 218
    return null;
src/main/java/org/distorted/solvers/SolverTablebaseJING2.java
21 21

  
22 22
public class SolverTablebaseJING2 extends SolverTablebase
23 23
{
24
  private static final int ERROR_CORNER_GYB_MISSING = -1;
25
  private static final int ERROR_CORNER_GYR_MISSING = -2;
26
  private static final int ERROR_CORNER_GBR_MISSING = -3;
27
  private static final int ERROR_CORNER_YBR_MISSING = -4;
28

  
29
  private static final int ERROR_EDGE_RB_MISSING    = -5;
30
  private static final int ERROR_EDGE_RY_MISSING    = -6;
31
  private static final int ERROR_EDGE_RG_MISSING    = -7;
32
  private static final int ERROR_EDGE_YB_MISSING    = -8;
33
  private static final int ERROR_EDGE_GB_MISSING    = -9;
34
  private static final int ERROR_EDGE_GY_MISSING    = -10;
35

  
36
  private static final int ERROR_CENTER_G_MISSING   = -11;
37
  private static final int ERROR_CENTER_Y_MISSING   = -12;
38
  private static final int ERROR_CENTER_B_MISSING   = -13;
39
  private static final int ERROR_CENTER_R_MISSING   = -14;
40

  
41
  private static final int ERROR_CORNERS_CANNOT     = -15;
42
  private static final int ERROR_EDGE_TWISTED       = -16;
43
  private static final int ERROR_CORNER_TWISTED     = -17;
44
  private static final int ERROR_TWO_EDGES          = -18;
45
  private static final int ERROR_TWO_CENTERS        = -19;
24
  private static final int ERROR_CORNER_MISSING = -1;
25
  private static final int ERROR_EDGE_MISSING   = -2;
26
  private static final int ERROR_CENTER_MISSING = -3;
27
  private static final int ERROR_CORNERS_CANNOT = -4;
28
  private static final int ERROR_EDGE_TWISTED   = -5;
29
  private static final int ERROR_CORNER_TWISTED = -6;
30
  private static final int ERROR_TWO_EDGES      = -7;
31
  private static final int ERROR_TWO_CENTERS    = -8;
46 32

  
47 33
  private int[] mFaceColors;
34
  private int mErrColor1, mErrColor2, mErrColor3;
48 35

  
49 36
///////////////////////////////////////////////////////////////////////////////////////////////////
50 37

  
......
90 77
      if( pieceEqual3(corners[i],1,2,3) ) ybr = true;
91 78
      }
92 79

  
93
    if( !ybr ) return ERROR_CORNER_YBR_MISSING;
94
    if( !gbr ) return ERROR_CORNER_GBR_MISSING;
95
    if( !gyr ) return ERROR_CORNER_GYR_MISSING;
96
    if( !gyb ) return ERROR_CORNER_GYB_MISSING;
80
    if( !ybr ) { mErrColor1=1; mErrColor2=2; mErrColor3=3; return ERROR_CORNER_MISSING; }
81
    if( !gbr ) { mErrColor1=0; mErrColor2=2; mErrColor3=3; return ERROR_CORNER_MISSING; }
82
    if( !gyr ) { mErrColor1=0; mErrColor2=1; mErrColor3=3; return ERROR_CORNER_MISSING; }
83
    if( !gyb ) { mErrColor1=0; mErrColor2=1; mErrColor3=2; return ERROR_CORNER_MISSING; }
97 84

  
98 85
    return 0;
99 86
    }
......
107 94

  
108 95
    for(int i=0; i<6; i++)
109 96
      for(int j=0; j<6; j++)
110
        if (pieceEqual2(edges[i], edgeColors[j]))
97
        if( pieceEqual2(edges[i], edgeColors[j]) )
111 98
          {
112 99
          present[j] = true;
113 100
          break;
114 101
          }
115 102

  
116
    if( !present[0] ) return ERROR_EDGE_RB_MISSING;
117
    if( !present[1] ) return ERROR_EDGE_GB_MISSING;
118
    if( !present[2] ) return ERROR_EDGE_RG_MISSING;
119
    if( !present[3] ) return ERROR_EDGE_YB_MISSING;
120
    if( !present[4] ) return ERROR_EDGE_RY_MISSING;
121
    if( !present[5] ) return ERROR_EDGE_GY_MISSING;
103
    if( !present[0] ) { mErrColor1=3; mErrColor2=2; return ERROR_EDGE_MISSING; }
104
    if( !present[1] ) { mErrColor1=3; mErrColor2=1; return ERROR_EDGE_MISSING; }
105
    if( !present[2] ) { mErrColor1=2; mErrColor2=1; return ERROR_EDGE_MISSING; }
106
    if( !present[3] ) { mErrColor1=3; mErrColor2=0; return ERROR_EDGE_MISSING; }
107
    if( !present[4] ) { mErrColor1=2; mErrColor2=0; return ERROR_EDGE_MISSING; }
108
    if( !present[5] ) { mErrColor1=1; mErrColor2=0; return ERROR_EDGE_MISSING; }
122 109

  
123 110
    return 0;
124 111
    }
......
129 116
    {
130 117
    boolean[] present = new boolean[4];
131 118
    for(int i=0; i<4; i++) present[i] = false;
119
    for(int i=0; i<4; i++) present[centers[i]]= true;
132 120

  
133
    for(int i=0; i<4; i++)
134
      {
135
      present[centers[i]]= true;
136
      }
137

  
138
    if( !present[0] ) return ERROR_CENTER_G_MISSING;
139
    if( !present[1] ) return ERROR_CENTER_Y_MISSING;
140
    if( !present[2] ) return ERROR_CENTER_B_MISSING;
141
    if( !present[3] ) return ERROR_CENTER_R_MISSING;
121
    if( !present[0] ) { mErrColor1=0; return ERROR_CENTER_MISSING; }
122
    if( !present[1] ) { mErrColor1=1; return ERROR_CENTER_MISSING; }
123
    if( !present[2] ) { mErrColor1=2; return ERROR_CENTER_MISSING; }
124
    if( !present[3] ) { mErrColor1=3; return ERROR_CENTER_MISSING; }
142 125

  
143 126
    return 0;
144 127
    }
......
423 406
    return res.getString(R.string.solver_generic_missing_edge,c0,c1);
424 407
    }
425 408

  
409
///////////////////////////////////////////////////////////////////////////////////////////////////
410

  
411
  private String centerError(Resources res, int face)
412
    {
413
    int j = getTetColor(face,2);
414
    String c = res.getString(j);
415
    return res.getString(R.string.solver_generic_missing_center,c);
416
    }
417

  
426 418
///////////////////////////////////////////////////////////////////////////////////////////////////
427 419

  
428 420
  public String error(int index, Resources res)
429 421
    {
430 422
    switch(index)
431 423
      {
432
      case ERROR_CORNER_YBR_MISSING: return cornerError(res,3,2,1);
433
      case ERROR_CORNER_GBR_MISSING: return cornerError(res,3,2,0);
434
      case ERROR_CORNER_GYR_MISSING: return cornerError(res,3,1,0);
435
      case ERROR_CORNER_GYB_MISSING: return cornerError(res,2,1,0);
436
      case ERROR_EDGE_RB_MISSING   : return edgeError(res,3,2);
437
      case ERROR_EDGE_RY_MISSING   : return edgeError(res,2,0);
438
      case ERROR_EDGE_RG_MISSING   : return edgeError(res,2,1);
439
      case ERROR_EDGE_YB_MISSING   : return edgeError(res,3,0);
440
      case ERROR_EDGE_GB_MISSING   : return edgeError(res,3,1);
441
      case ERROR_EDGE_GY_MISSING   : return edgeError(res,1,0);
442
      case ERROR_CENTER_G_MISSING  : String colorG = res.getString(R.string.color_green2);
443
                                     return res.getString(R.string.solver_generic_missing_center,colorG);
444
      case ERROR_CENTER_Y_MISSING  : String colorY = res.getString(R.string.color_yellow2);
445
                                     return res.getString(R.string.solver_generic_missing_center,colorY);
446
      case ERROR_CENTER_B_MISSING  : String colorB = res.getString(R.string.color_blue2);
447
                                     return res.getString(R.string.solver_generic_missing_center,colorB);
448
      case ERROR_CENTER_R_MISSING  : String colorR = res.getString(R.string.color_red2);
449
                                     return res.getString(R.string.solver_generic_missing_center,colorR);
450
      case ERROR_CORNER_TWISTED    : return res.getString(R.string.solver_generic_corner_twist);
451
      case ERROR_EDGE_TWISTED      : return res.getString(R.string.solver_generic_edge_twist);
452
      case ERROR_CORNERS_CANNOT    : return res.getString(R.string.solver_generic_corners_cannot);
453
      case ERROR_TWO_EDGES         : return res.getString(R.string.solver_generic_two_edges);
454
      case ERROR_TWO_CENTERS       : return res.getString(R.string.solver_generic_two_centers);
424
      case ERROR_CORNER_MISSING: return cornerError(res,mErrColor1,mErrColor2,mErrColor3);
425
      case ERROR_EDGE_MISSING  : return edgeError(res,mErrColor1,mErrColor2);
426
      case ERROR_CENTER_MISSING: return centerError(res,mErrColor1);
427
      case ERROR_CORNER_TWISTED: return res.getString(R.string.solver_generic_corner_twist);
428
      case ERROR_EDGE_TWISTED  : return res.getString(R.string.solver_generic_edge_twist);
429
      case ERROR_CORNERS_CANNOT: return res.getString(R.string.solver_generic_corners_cannot);
430
      case ERROR_TWO_EDGES     : return res.getString(R.string.solver_generic_two_edges);
431
      case ERROR_TWO_CENTERS   : return res.getString(R.string.solver_generic_two_centers);
455 432
      }
456 433

  
457 434
    return null;
src/main/java/org/distorted/solvers/SolverTablebasePDIA3.java
20 20

  
21 21
public class SolverTablebasePDIA3 extends SolverTablebase
22 22
{
23
  private static final int ERROR_CORNER_FR_MISSING = -1;
24
  private static final int ERROR_CORNER_BR_MISSING = -2;
25
  private static final int ERROR_CORNER_BL_MISSING = -3;
26
  private static final int ERROR_CORNER_FL_MISSING = -4;
27
  private static final int ERROR_CORNER_TO_MISSING = -5;
28
  private static final int ERROR_CORNER_BO_MISSING = -6;
29

  
30
  private static final int ERROR_CENTER_0_MISSING = -7;
31
  private static final int ERROR_CENTER_1_MISSING = -8;
32
  private static final int ERROR_CENTER_2_MISSING = -9;
33
  private static final int ERROR_CENTER_3_MISSING = -10;
34
  private static final int ERROR_CENTER_4_MISSING = -11;
35
  private static final int ERROR_CENTER_5_MISSING = -12;
36
  private static final int ERROR_CENTER_6_MISSING = -13;
37
  private static final int ERROR_CENTER_7_MISSING = -14;
38

  
39
  private static final int ERROR_TWO_CENTERS      = -15;
40
  private static final int ERROR_CORNERS_CANNOT   = -16;
23
  private static final int ERROR_CENTER_MISSING = -1;
24
  private static final int ERROR_TWO_CENTERS    = -2;
25
  private static final int ERROR_CORNERS_CANNOT = -3;
41 26

  
42 27
  private final int[] mFaceColors;
28
  private int mErrColor;
43 29

  
44 30
///////////////////////////////////////////////////////////////////////////////////////////////////
45 31

  
......
144 130
          break;
145 131
          }
146 132

  
147
      if( !present )
148
        {
149
        switch(i)
150
          {
151
          case 0: return ERROR_CENTER_0_MISSING;
152
          case 1: return ERROR_CENTER_1_MISSING;
153
          case 2: return ERROR_CENTER_2_MISSING;
154
          case 3: return ERROR_CENTER_3_MISSING;
155
          case 4: return ERROR_CENTER_4_MISSING;
156
          case 5: return ERROR_CENTER_5_MISSING;
157
          case 6: return ERROR_CENTER_6_MISSING;
158
          case 7: return ERROR_CENTER_7_MISSING;
159
          }
160
        }
133
      if( !present ) { mErrColor=i; return ERROR_CENTER_MISSING; }
161 134
      }
162 135

  
163 136
    return 0;
......
262 235
    return res.getString(R.string.solver_generic_missing_center,color);
263 236
    }
264 237

  
265
///////////////////////////////////////////////////////////////////////////////////////////////////
266

  
267
  private String cornerError(Resources res, int f1, int f2)
268
    {
269
    int i1 = getOctColor(f1,3);
270
    int i2 = getOctColor(f2,4);
271
    String c1 = res.getString(i1);
272
    String c2 = res.getString(i2);
273
    return res.getString(R.string.solver_generic_missing_corner2,c1,c2);
274
    }
275

  
276 238
///////////////////////////////////////////////////////////////////////////////////////////////////
277 239

  
278 240
  public String error(int index, Resources res)
279 241
    {
280 242
    switch(index)
281 243
      {
282
      case ERROR_CORNER_FR_MISSING: return cornerError(res,1,4);
283
      case ERROR_CORNER_BR_MISSING: return cornerError(res,1,6);
284
      case ERROR_CORNER_BL_MISSING: return cornerError(res,3,6);
285
      case ERROR_CORNER_FL_MISSING: return cornerError(res,3,4);
286
      case ERROR_CORNER_TO_MISSING: return cornerError(res,1,3);
287
      case ERROR_CORNER_BO_MISSING: return cornerError(res,4,6);
288

  
289
      case ERROR_CENTER_0_MISSING : return centerError(res,0);
290
      case ERROR_CENTER_1_MISSING : return centerError(res,1);
291
      case ERROR_CENTER_2_MISSING : return centerError(res,2);
292
      case ERROR_CENTER_3_MISSING : return centerError(res,3);
293
      case ERROR_CENTER_4_MISSING : return centerError(res,4);
294
      case ERROR_CENTER_5_MISSING : return centerError(res,5);
295
      case ERROR_CENTER_6_MISSING : return centerError(res,6);
296
      case ERROR_CENTER_7_MISSING : return centerError(res,7);
297

  
298
      case ERROR_TWO_CENTERS      : return res.getString(R.string.solver_generic_two_centers);
299
      case ERROR_CORNERS_CANNOT   : return res.getString(R.string.solver_generic_corners_cannot);
244
      case ERROR_CENTER_MISSING : return centerError(res,mErrColor);
245
      case ERROR_TWO_CENTERS    : return res.getString(R.string.solver_generic_two_centers);
246
      case ERROR_CORNERS_CANNOT : return res.getString(R.string.solver_generic_corners_cannot);
300 247
      }
301 248

  
302 249
    return null;
src/main/java/org/distorted/solvers/SolverTablebasePDUO2.java
19 19

  
20 20
public class SolverTablebasePDUO2 extends SolverTablebase
21 21
{
22
  private static final int ERROR_CORNER_GYB_MISSING = -1;
23
  private static final int ERROR_CORNER_GYR_MISSING = -2;
24
  private static final int ERROR_CORNER_GBR_MISSING = -3;
25
  private static final int ERROR_CORNER_YBR_MISSING = -4;
22
  private static final int ERROR_CORNER_MISSING = -1;
23
  private static final int ERROR_CENTER_MISSING = -2;
24
  private static final int ERROR_TWO_CENTERS    = -3;
25
  private static final int ERROR_CORNER_TWISTED = -4;
26
  private static final int ERROR_CORNERS_CANNOT = -5;
26 27

  
27
  private static final int ERROR_CENTER_G_MISSING = -5;
28
  private static final int ERROR_CENTER_Y_MISSING = -6;
29
  private static final int ERROR_CENTER_B_MISSING = -7;
30
  private static final int ERROR_CENTER_R_MISSING = -8;
31

  
32
  private static final int ERROR_TWO_CENTERS      = -9;
33
  private static final int ERROR_CORNER_TWISTED   = -10;
34

  
35
  private static final int ERROR_CORNERS_CANNOT   = -11;
28
  private int mErrColor1, mErrColor2, mErrColor3;
36 29

  
37 30
///////////////////////////////////////////////////////////////////////////////////////////////////
38 31

  
......
63 56
      if( cornerEqual(corners[i],1,2,3) ) ybr = true;
64 57
      }
65 58

  
66
    if( !ybr ) return ERROR_CORNER_YBR_MISSING;
67
    if( !gbr ) return ERROR_CORNER_GBR_MISSING;
68
    if( !gyr ) return ERROR_CORNER_GYR_MISSING;
69
    if( !gyb ) return ERROR_CORNER_GYB_MISSING;
59
    if( !ybr ) { mErrColor1=1; mErrColor2=2; mErrColor3=3; return ERROR_CORNER_MISSING; }
60
    if( !gbr ) { mErrColor1=0; mErrColor2=2; mErrColor3=3; return ERROR_CORNER_MISSING; }
61
    if( !gyr ) { mErrColor1=0; mErrColor2=1; mErrColor3=3; return ERROR_CORNER_MISSING; }
62
    if( !gyb ) { mErrColor1=0; mErrColor2=1; mErrColor3=2; return ERROR_CORNER_MISSING; }
70 63

  
71 64
    return 0;
72 65
    }
......
75 68

  
76 69
  private int checkAllCentersPresent(int[] centers)
77 70
    {
78
    if( centers[0]!=0 && centers[1]!=0 && centers[2]!=0 && centers[3]!=0 ) return ERROR_CENTER_G_MISSING;
79
    if( centers[0]!=1 && centers[1]!=1 && centers[2]!=1 && centers[3]!=1 ) return ERROR_CENTER_Y_MISSING;
80
    if( centers[0]!=2 && centers[1]!=2 && centers[2]!=2 && centers[3]!=2 ) return ERROR_CENTER_B_MISSING;
81
    if( centers[0]!=3 && centers[1]!=3 && centers[2]!=3 && centers[3]!=3 ) return ERROR_CENTER_R_MISSING;
71
    for(int i=0; i<4; i++)
72
      if( centers[0]!=i && centers[1]!=i && centers[2]!=i && centers[3]!=i )
73
        { mErrColor1=i; return ERROR_CENTER_MISSING; }
82 74

  
83 75
    return 0;
84 76
    }
......
271 263
    {
272 264
    switch(index)
273 265
      {
274
      case ERROR_CORNER_YBR_MISSING: return cornerError(res,3,2,1);
275
      case ERROR_CORNER_GBR_MISSING: return cornerError(res,3,2,0);
276
      case ERROR_CORNER_GYR_MISSING: return cornerError(res,3,1,0);
277
      case ERROR_CORNER_GYB_MISSING: return cornerError(res,2,1,0);
278
      case ERROR_CENTER_G_MISSING  : return centerError(res,0);
279
      case ERROR_CENTER_Y_MISSING  : return centerError(res,1);
280
      case ERROR_CENTER_B_MISSING  : return centerError(res,2);
281
      case ERROR_CENTER_R_MISSING  : return centerError(res,3);
282
      case ERROR_TWO_CENTERS       : return res.getString(R.string.solver_generic_two_centers);
283
      case ERROR_CORNER_TWISTED    : return res.getString(R.string.solver_generic_corner_twist);
284
      case ERROR_CORNERS_CANNOT    : return res.getString(R.string.solver_generic_corners_cannot);
266
      case ERROR_CORNER_MISSING: return cornerError(res,mErrColor1,mErrColor2,mErrColor3);
267
      case ERROR_CENTER_MISSING: return centerError(res,mErrColor1);
268
      case ERROR_TWO_CENTERS   : return res.getString(R.string.solver_generic_two_centers);
269
      case ERROR_CORNER_TWISTED: return res.getString(R.string.solver_generic_corner_twist);
270
      case ERROR_CORNERS_CANNOT: return res.getString(R.string.solver_generic_corners_cannot);
285 271
      }
286 272

  
287 273
    return null;
src/main/java/org/distorted/solvers/SolverTablebasePYRA3.java
21 21

  
22 22
public class SolverTablebasePYRA3 extends SolverTablebase
23 23
{
24
  private static final int ERROR_CORNER_GYB_MISSING = -1;
25
  private static final int ERROR_CORNER_GYR_MISSING = -2;
26
  private static final int ERROR_CORNER_GBR_MISSING = -3;
27
  private static final int ERROR_CORNER_YBR_MISSING = -4;
28

  
29
  private static final int ERROR_VERTEX_GYB_MISSING = -5;
30
  private static final int ERROR_VERTEX_GYR_MISSING = -6;
31
  private static final int ERROR_VERTEX_GBR_MISSING = -7;
32
  private static final int ERROR_VERTEX_YBR_MISSING = -8;
33

  
34
  private static final int ERROR_EDGE_RB_MISSING = -9;
35
  private static final int ERROR_EDGE_RY_MISSING = -10;
36
  private static final int ERROR_EDGE_RG_MISSING = -11;
37
  private static final int ERROR_EDGE_YB_MISSING = -12;
38
  private static final int ERROR_EDGE_GB_MISSING = -13;
39
  private static final int ERROR_EDGE_GY_MISSING = -14;
40

  
41
  private static final int ERROR_CORNERS_CANNOT   = -15;
42
  private static final int ERROR_VERTICES_CANNOT  = -16;
43
  private static final int ERROR_EDGE_TWISTED     = -17;
44
  private static final int ERROR_C_V_DONT_MATCH   = -18;
45
  private static final int ERROR_TWO_EDGES        = -19;
24
  private static final int ERROR_CORNER_MISSING = -1;
25
  private static final int ERROR_VERTEX_MISSING = -2;
26
  private static final int ERROR_EDGE_MISSING   = -3;
27
  private static final int ERROR_CORNERS_CANNOT = -4;
28
  private static final int ERROR_VERTICES_CANNOT= -5;
29
  private static final int ERROR_EDGE_TWISTED   = -6;
30
  private static final int ERROR_C_V_DONT_MATCH = -7;
31
  private static final int ERROR_TWO_EDGES      = -8;
46 32

  
47 33
  private int[] mCornerTwist;
48 34
  private int[] mFaceColors;
35
  private int mErrColor1, mErrColor2, mErrColor3;
49 36

  
50 37
///////////////////////////////////////////////////////////////////////////////////////////////////
51 38

  
......
84 71
      if( pieceEqual3(corners[i],1,2,3) ) ybr = true;
85 72
      }
86 73

  
87
    if( !ybr ) return ERROR_CORNER_YBR_MISSING;
88
    if( !gbr ) return ERROR_CORNER_GBR_MISSING;
89
    if( !gyr ) return ERROR_CORNER_GYR_MISSING;
90
    if( !gyb ) return ERROR_CORNER_GYB_MISSING;
74
    if( !ybr ) { mErrColor1=1; mErrColor2=2; mErrColor3=3; return ERROR_CORNER_MISSING; }
75
    if( !gbr ) { mErrColor1=0; mErrColor2=2; mErrColor3=3; return ERROR_CORNER_MISSING; }
76
    if( !gyr ) { mErrColor1=0; mErrColor2=1; mErrColor3=3; return ERROR_CORNER_MISSING; }
77
    if( !gyb ) { mErrColor1=0; mErrColor2=1; mErrColor3=2; return ERROR_CORNER_MISSING; }
91 78

  
92 79
    return 0;
93 80
    }
......
109 96
      if( pieceEqual3(vertex[i],1,2,3) ) ybr = true;
110 97
      }
111 98

  
112
    if( !ybr ) return ERROR_VERTEX_YBR_MISSING;
113
    if( !gbr ) return ERROR_VERTEX_GBR_MISSING;
114
    if( !gyr ) return ERROR_VERTEX_GYR_MISSING;
115
    if( !gyb ) return ERROR_VERTEX_GYB_MISSING;
99
    if( !ybr ) { mErrColor1=1; mErrColor2=2; mErrColor3=3; return ERROR_VERTEX_MISSING; }
100
    if( !gbr ) { mErrColor1=0; mErrColor2=2; mErrColor3=3; return ERROR_VERTEX_MISSING; }
101
    if( !gyr ) { mErrColor1=0; mErrColor2=1; mErrColor3=3; return ERROR_VERTEX_MISSING; }
102
    if( !gyb ) { mErrColor1=0; mErrColor2=1; mErrColor3=2; return ERROR_VERTEX_MISSING; }
116 103

  
117 104
    return 0;
118 105
    }
......
126 113

  
127 114
    for(int i=0; i<6; i++)
128 115
      for(int j=0; j<6; j++)
129
        if (pieceEqual2(edges[i], edgeColors[j]))
116
        if( pieceEqual2(edges[i], edgeColors[j]) )
130 117
          {
131 118
          present[j] = true;
132 119
          break;
133 120
          }
134 121

  
135
    if( !present[0] ) return ERROR_EDGE_RB_MISSING;
136
    if( !present[1] ) return ERROR_EDGE_RY_MISSING;
137
    if( !present[2] ) return ERROR_EDGE_RG_MISSING;
138
    if( !present[3] ) return ERROR_EDGE_YB_MISSING;
139
    if( !present[4] ) return ERROR_EDGE_GB_MISSING;
140
    if( !present[5] ) return ERROR_EDGE_GY_MISSING;
122
    if( !present[0] ) { mErrColor1=3; mErrColor2=2; return ERROR_EDGE_MISSING; }
123
    if( !present[1] ) { mErrColor1=2; mErrColor2=0; return ERROR_EDGE_MISSING; }
124
    if( !present[2] ) { mErrColor1=2; mErrColor2=1; return ERROR_EDGE_MISSING; }
125
    if( !present[3] ) { mErrColor1=3; mErrColor2=0; return ERROR_EDGE_MISSING; }
126
    if( !present[4] ) { mErrColor1=3; mErrColor2=1; return ERROR_EDGE_MISSING; }
127
    if( !present[5] ) { mErrColor1=1; mErrColor2=0; return ERROR_EDGE_MISSING; }
141 128

  
142 129
    return 0;
143 130
    }
......
446 433
    {
447 434
    switch(index)
448 435
      {
449
      case ERROR_CORNER_YBR_MISSING: return cornerError(res,3,2,1);
450
      case ERROR_CORNER_GBR_MISSING: return cornerError(res,3,2,0);
451
      case ERROR_CORNER_GYR_MISSING: return cornerError(res,3,1,0);
452
      case ERROR_CORNER_GYB_MISSING: return cornerError(res,2,1,0);
453
      case ERROR_VERTEX_YBR_MISSING: return vertexError(res,3,2,1);
454
      case ERROR_VERTEX_GBR_MISSING: return vertexError(res,3,2,0);
455
      case ERROR_VERTEX_GYR_MISSING: return vertexError(res,3,1,0);
456
      case ERROR_VERTEX_GYB_MISSING: return vertexError(res,2,1,0);
457
      case ERROR_EDGE_RB_MISSING   : return edgeError(res,3,2);
458
      case ERROR_EDGE_RY_MISSING   : return edgeError(res,2,0);
459
      case ERROR_EDGE_RG_MISSING   : return edgeError(res,2,1);
460
      case ERROR_EDGE_YB_MISSING   : return edgeError(res,3,0);
461
      case ERROR_EDGE_GB_MISSING   : return edgeError(res,3,1);
462
      case ERROR_EDGE_GY_MISSING   : return edgeError(res,1,0);
463
      case ERROR_EDGE_TWISTED      : return res.getString(R.string.solver_generic_edge_twist);
464
      case ERROR_CORNERS_CANNOT    : return res.getString(R.string.solver_generic_corners_cannot);
465
      case ERROR_VERTICES_CANNOT   : return res.getString(R.string.solver_generic_vertices_cannot);
466
      case ERROR_C_V_DONT_MATCH    : return res.getString(R.string.solver_generic_c_v_dont_match);
467
      case ERROR_TWO_EDGES         : return res.getString(R.string.solver_generic_two_edges);
436
      case ERROR_CORNER_MISSING : return cornerError(res,mErrColor1,mErrColor2,mErrColor3);
437
      case ERROR_VERTEX_MISSING : return vertexError(res,mErrColor1,mErrColor2,mErrColor3);
438
      case ERROR_EDGE_MISSING   : return edgeError(res,mErrColor1,mErrColor2);
439
      case ERROR_EDGE_TWISTED   : return res.getString(R.string.solver_generic_edge_twist);
440
      case ERROR_CORNERS_CANNOT : return res.getString(R.string.solver_generic_corners_cannot);
441
      case ERROR_VERTICES_CANNOT: return res.getString(R.string.solver_generic_vertices_cannot);
442
      case ERROR_C_V_DONT_MATCH : return res.getString(R.string.solver_generic_c_v_dont_match);
443
      case ERROR_TWO_EDGES      : return res.getString(R.string.solver_generic_two_edges);
468 444
      }
469 445

  
470 446
    return null;
src/main/java/org/distorted/solvers/SolverTablebaseSKEW2.java
24 24

  
25 25
public class SolverTablebaseSKEW2 extends SolverTablebase
26 26
{
27
  private static final int ERROR_CORNER_135_MISSING = -1;
28
  private static final int ERROR_CORNER_134_MISSING = -2;
29
  private static final int ERROR_CORNER_125_MISSING = -3;
30
  private static final int ERROR_CORNER_124_MISSING = -4;
31
  private static final int ERROR_CORNER_035_MISSING = -5;
32
  private static final int ERROR_CORNER_034_MISSING = -6;
33
  private static final int ERROR_CORNER_025_MISSING = -7;
34
  private static final int ERROR_CORNER_024_MISSING = -8;
35

  
36
  private static final int ERROR_CENTER_0_MISSING   = -9;
37
  private static final int ERROR_CENTER_1_MISSING   = -10;
38
  private static final int ERROR_CENTER_2_MISSING   = -11;
39
  private static final int ERROR_CENTER_3_MISSING   = -12;
40
  private static final int ERROR_CENTER_4_MISSING   = -13;
41
  private static final int ERROR_CENTER_5_MISSING   = -14;
42

  
43
  private static final int ERROR_CORNERS_CANNOT     = -15;
44
  private static final int ERROR_CORNER_TWISTED     = -16;
45
  private static final int ERROR_TWO_CENTERS        = -17;
46
  private static final int ERROR_TWO_CORNERS        = -18;
47

  
48
  private static final int ERROR_FREE_CORNERS_NOT_EVEN    = -19;
49
  private static final int ERROR_FREE_CORNERS_ROTATED     = -20;
27
  private static final int ERROR_CORNER_MISSING       = -1;
28
  private static final int ERROR_CENTER_MISSING       = -2;
29
  private static final int ERROR_CORNERS_CANNOT       = -3;
30
  private static final int ERROR_CORNER_TWISTED       = -4;
31
  private static final int ERROR_TWO_CENTERS          = -5;
32
  private static final int ERROR_TWO_CORNERS          = -6;
33
  private static final int ERROR_FREE_CORNERS_NOT_EVEN= -7;
34
  private static final int ERROR_FREE_CORNERS_ROTATED = -8;
50 35

  
51 36
  private final int[] mFaceColors;
37
  private int mErrColor1, mErrColor2, mErrColor3;
52 38

  
53 39
///////////////////////////////////////////////////////////////////////////////////////////////////
54 40

  
......
100 86
      tmp[i] = color;
101 87
      }
102 88

  
103
    if( !present[0] ) return ERROR_CENTER_0_MISSING;
104
    if( !present[1] ) return ERROR_CENTER_1_MISSING;
105
    if( !present[2] ) return ERROR_CENTER_2_MISSING;
106
    if( !present[3] ) return ERROR_CENTER_3_MISSING;
107
    if( !present[4] ) return ERROR_CENTER_4_MISSING;
108
    if( !present[5] ) return ERROR_CENTER_5_MISSING;
89
    for(int i=0; i<6; i++)
90
      if( !present[i] ) { mErrColor1=i; return ERROR_CENTER_MISSING; }
109 91

  
110 92
    for(int i=0; i<6; i++) mcl[i] = map[mFaceColors[i]];
111 93
    createCenterPermutation(out,mcl,tmp);
......
179 161
      if( cornerIs(corners[i],1,3,5) ) present[7]=true;
180 162
      }
181 163

  
182
    if( !present[0] ) return ERROR_CORNER_024_MISSING;
183
    if( !present[1] ) return ERROR_CORNER_025_MISSING;
184
    if( !present[2] ) return ERROR_CORNER_034_MISSING;
185
    if( !present[3] ) return ERROR_CORNER_035_MISSING;
186
    if( !present[4] ) return ERROR_CORNER_124_MISSING;
187
    if( !present[5] ) return ERROR_CORNER_125_MISSING;
188
    if( !present[6] ) return ERROR_CORNER_134_MISSING;
189
    if( !present[7] ) return ERROR_CORNER_135_MISSING;
164
    if( !present[0] ) { mErrColor1=0; mErrColor2=2; mErrColor3=4; return ERROR_CORNER_MISSING; }
165
    if( !present[1] ) { mErrColor1=0; mErrColor2=2; mErrColor3=5; return ERROR_CORNER_MISSING; }
166
    if( !present[2] ) { mErrColor1=0; mErrColor2=3; mErrColor3=4; return ERROR_CORNER_MISSING; }
167
    if( !present[3] ) { mErrColor1=0; mErrColor2=3; mErrColor3=5; return ERROR_CORNER_MISSING; }
168
    if( !present[4] ) { mErrColor1=1; mErrColor2=2; mErrColor3=4; return ERROR_CORNER_MISSING; }
169
    if( !present[5] ) { mErrColor1=1; mErrColor2=2; mErrColor3=5; return ERROR_CORNER_MISSING; }
170
    if( !present[6] ) { mErrColor1=1; mErrColor2=3; mErrColor3=4; return ERROR_CORNER_MISSING; }
171
    if( !present[7] ) { mErrColor1=1; mErrColor2=3; mErrColor3=5; return ERROR_CORNER_MISSING; }
190 172

  
191 173
    return 0;
192 174
    }
......
210 192
      if( cornerIs(cor,1,3,5) ) perm[3] = i;
211 193
      }
212 194

  
213
    if( perm[0]==-1 ) return ERROR_CORNER_025_MISSING;
214
    if( perm[1]==-1 ) return ERROR_CORNER_034_MISSING;
215
    if( perm[2]==-1 ) return ERROR_CORNER_124_MISSING;
216
    if( perm[3]==-1 ) return ERROR_CORNER_135_MISSING;
195
    if( perm[0]==-1 ) { mErrColor1=0; mErrColor2=2; mErrColor3=5; return ERROR_CORNER_MISSING; }
196
    if( perm[1]==-1 ) { mErrColor1=0; mErrColor2=3; mErrColor3=4; return ERROR_CORNER_MISSING; }
197
    if( perm[2]==-1 ) { mErrColor1=1; mErrColor2=2; mErrColor3=4; return ERROR_CORNER_MISSING; }
198
    if( perm[3]==-1 ) { mErrColor1=1; mErrColor2=3; mErrColor3=5; return ERROR_CORNER_MISSING; }
217 199

  
218 200
    return 0;
219 201
    }
......
353 335
    {
354 336
    switch(index)
355 337
      {
356
      case ERROR_CORNER_135_MISSING   : return cornerError(res,1,3,5);
357
      case ERROR_CORNER_134_MISSING   : return cornerError(res,1,3,4);
358
      case ERROR_CORNER_125_MISSING   : return cornerError(res,1,2,5);
359
      case ERROR_CORNER_124_MISSING   : return cornerError(res,1,2,4);
360
      case ERROR_CORNER_035_MISSING   : return cornerError(res,0,3,5);
361
      case ERROR_CORNER_034_MISSING   : return cornerError(res,0,3,4);
362
      case ERROR_CORNER_025_MISSING   : return cornerError(res,0,2,5);
363
      case ERROR_CORNER_024_MISSING   : return cornerError(res,0,2,4);
364
      case ERROR_CENTER_0_MISSING     : return centerError(res,0);
365
      case ERROR_CENTER_1_MISSING     : return centerError(res,1);
366
      case ERROR_CENTER_2_MISSING     : return centerError(res,2);
367
      case ERROR_CENTER_3_MISSING     : return centerError(res,3);
368
      case ERROR_CENTER_4_MISSING     : return centerError(res,4);
369
      case ERROR_CENTER_5_MISSING     : return centerError(res,5);
338
      case ERROR_CORNER_MISSING       : return cornerError(res,mErrColor1,mErrColor2,mErrColor3);
339
      case ERROR_CENTER_MISSING       : return centerError(res,mErrColor1);
370 340
      case ERROR_CORNERS_CANNOT       : return res.getString(R.string.solver_generic_corners_cannot);
371 341
      case ERROR_CORNER_TWISTED       : return res.getString(R.string.solver_generic_corner_twist);
372 342
      case ERROR_TWO_CENTERS          : return res.getString(R.string.solver_generic_two_centers);

Also available in: Unified diff