Project

General

Profile

« Previous | Next » 

Revision f51c164f

Added by Leszek Koltunski about 1 year ago

CU_323 solver: speedups

View differences:

src/main/java/org/distorted/objectlib/tablebases/TablebasesPruning.java
274 274

  
275 275
///////////////////////////////////////////////////////////////////////////////////////////////////
276 276

  
277
  private boolean jumpMidSolvedRecursive(int[] quats, int jump, int depth, int lastA, int lastR, int[][] solution)
277
  private boolean jumpMidSolvedRecursive(int[] quats, int jump, int depth, int lastA, int lastR,
278
                                         int[][] solution, int[][] tmpE, int[][][] rotRowE )
278 279
    {
279 280
    int numQuats  = quats.length;
280 281
    int[] move    = solution[depth];
281
    int[] tmp     = new int[mNumCubits];
282
    int[][] rotRow= new int[mNumCubits][mNumAxis];
282
    int[] tmp     = tmpE[jump];
283
    int[][] rotRow= rotRowE[jump];
283 284

  
284 285
    move[0]=0;
285 286
    move[1]=0;
......
327 328
          return true;
328 329
          }
329 330

  
330
        if( jump>1 && jumpMidSolvedRecursive(tmp, jump-1, depth+1, ax, layer, solution) )
331
        if( jump>1 && jumpMidSolvedRecursive(tmp, jump-1, depth+1, ax, layer, solution, tmpE, rotRowE) )
331 332
          {
332 333
          return true;
333 334
          }
......
349 350
    int[][] solution = new int[maxJump+1][4];
350 351
    int[] quats = getQuats(index);
351 352

  
353
    int[][] tmpE = new int[maxJump+1][mNumCubits];
354
    int[][][] rotRowE = new int[maxJump+1][mNumCubits][mNumAxis];
355

  
352 356
    for(int i=1; i<=maxJump; i++)
353
      if( jumpMidSolvedRecursive(quats,i,1,lastA,lastR,solution) )
357
      if( jumpMidSolvedRecursive(quats,i,1,lastA,lastR,solution,tmpE,rotRowE) )
354 358
        {
355 359
        solution[0][2] = i;
356 360
        return solution;

Also available in: Unified diff