Project

General

Profile

« Previous | Next » 

Revision 697d16ed

Added by Leszek Koltunski over 1 year ago

CU_323 solver: remove mUpper.

View differences:

src/main/java/org/distorted/solvers/SolverCuboid323.java
33 33
  TablebasesAbstract mSolver;
34 34
  private final int[] mFaceColors;
35 35
  private int mErrorColor1, mErrorColor2, mErrorColor3;
36
  private boolean mUpper;
37 36

  
38 37
///////////////////////////////////////////////////////////////////////////////////////////////////
39
// true or false, depending on if the 'half-fixed' front edge is in its place or not.
40
// if the 'half-fixed' edge is the upped front one (i.e. mUpper==true) than it can be in its
41
// place or not; if mUpper==false it always must be in its place.
42 38

  
43 39
  private boolean isFrontEdgeInItsPlace(int[][] edges)
44 40
    {
45
    return (!mUpper || edges[3][1]==mFaceColors[2]);
41
    return edges[1][1]==mFaceColors[3];
46 42
    }
47 43

  
48 44
///////////////////////////////////////////////////////////////////////////////////////////////////
......
181 177
    mFaceColors[2] = centers[0];
182 178
    mFaceColors[3] = centers[1];
183 179

  
184
    if( edges[1][1]==mFaceColors[2] )
180
    if( edges[1][1]==mFaceColors[2] || edges[1][1]==mFaceColors[3] )
185 181
      {
186
      mUpper = true;
187 182
      mFaceColors[4] = edges[1][0];
188 183
      }
189
    else if( edges[3][1]==mFaceColors[2] )
190
      {
191
      mUpper = true;
192
      mFaceColors[4] = edges[3][0];
193
      }
194
    else
195
      {
196
      mUpper = false;
197
      mFaceColors[4] = edges[3][0];
198
      }
184
    else return ERROR_CORNERS_CANNOT;
199 185

  
200 186
    mFaceColors[0] = findCorner(corners,mFaceColors[4],mFaceColors[2]);
201 187
    if( mFaceColors[0]<0 ) return mFaceColors[0];
......
308 294
//    TablebaseHelpers.displayTable(corner_perm, "CORNER PERM");
309 295
//    TablebaseHelpers.displayTable(edge_perm, "EDGE PERM");
310 296

  
311
    int[] edge_perm2 = TBCuboid323.edgePermTo7(edge_perm,mUpper); // edge1 (lower) or edge3 (upper) is fixed!
297
    int[] edge_perm2 = TBCuboid323.edgePermTo7(edge_perm);
312 298

  
313 299
    int corner_perm_num = TablebaseHelpers.computePermutationNum(corner_perm);
314 300
    int edge_perm_num = TablebaseHelpers.computePermutationNum(edge_perm2);
315 301
    boolean inPlace = isFrontEdgeInItsPlace(edges);
316 302

  
317
//android.util.Log.e("D", "corner_perm_num: "+corner_perm_num+" edge_perm_num: "+edge_perm_num+" inPlace: "+inPlace);
318
//android.util.Log.e("D", "index="+(corner_perm_num + 40320*( (inPlace?0:1) + 2*edge_perm_num)));
303
android.util.Log.e("D", "corner_perm_num: "+corner_perm_num+" edge_perm_num: "+edge_perm_num+" inPlace: "+inPlace);
304
android.util.Log.e("D", "index="+(corner_perm_num + 40320*( (inPlace?0:1) + 2*edge_perm_num)));
319 305

  
320
    TBCuboid323.setUpper(mUpper, mUpper^inPlace);
306
    TBCuboid323.setDown(inPlace);
321 307

  
322 308
    return corner_perm_num + 40320*( (inPlace?0:1) + 2*edge_perm_num);
323 309
    }
......
470 456
      {
471 457
      mSolver = ImplementedTablebasesList.createPacked(os,ObjectSignatures.CU_323);
472 458
      //mSolver = ImplementedTablebasesList.createUnpacked(ObjectSignatures.CU_323);
473
      //if( mSolver!=null ) mSolver.test();
459
      //if( mSolver!=null ) mSolver.createTablebase(1);
474 460
      }
475 461

  
476 462
    return mSolver!=null ? mSolver.solution(index,null,os) : null;

Also available in: Unified diff