Project

General

Profile

« Previous | Next » 

Revision c0266cb1

Added by Leszek Koltunski about 1 year ago

Tablebase-based scrambling.

View differences:

src/main/java/org/distorted/objectlib/scrambling/ObjectScrambler.java
13 13
import java.util.Random;
14 14

  
15 15
import org.distorted.objectlib.helpers.ObjectSignature;
16
import org.distorted.objectlib.tablebases.TablebasesAbstract;
16 17

  
17 18
///////////////////////////////////////////////////////////////////////////////////////////////////
18 19

  
......
21 22
  public static final int SCRAMBLING_ALGORITHMS = 0;
22 23
  public static final int SCRAMBLING_SQUARE1    = 1;
23 24
  public static final int SCRAMBLING_BANDAGED   = 2;
24
  public static final int SCRAMBLING_TABLEBASES = 3;
25 25

  
26 26
  private final ScrambleState[] mStates;
27 27
  private final int mType;
......
56 56
  private ArrayList<ScrambleStateBandagedCuboid> mStatesHistory;
57 57
  private BlacklistedSignatures mBlacklisted;
58 58

  
59
  // type==3 (tablebases)
60
  private TablebasesAbstract mTablebase;
61

  
59 62
///////////////////////////////////////////////////////////////////////////////////////////////////
60 63

  
61
  public ObjectScrambler(int type, int numAxis, int[] numLayers, int[][] algorithms, int[][] edges)
64
  public ObjectScrambler(int type, int numAxis, int[] numLayers, int[][] algorithms, int[][] edges, TablebasesAbstract tablebase)
62 65
    {
63 66
    mType       = type;
64 67
    mNumAxis    = numAxis;
......
84 87
      mCornerQuat = new int[8];
85 88
      mLastRot = LAST_SL;
86 89
      }
90

  
91
    mTablebase = tablebase;
87 92
    }
88 93

  
89 94
///////////////////////////////////////////////////////////////////////////////////////////////////
......
615 620
    if( curr==0 ) initializeType2Scrambling(scramble,rnd,total,signature);
616 621
    }
617 622

  
618
///////////////////////////////////////////////////////////////////////////////////////////////////
619
// TYPE 3   (tablebases)
620

  
621
  private void randomizeNewScramble3(int[][] scramble, Random rnd, int curr, int total, ObjectSignature signature)
622
    {
623
    // TODO
624
    }
625

  
626 623
///////////////////////////////////////////////////////////////////////////////////////////////////
627 624
// PUBLIC API
628 625

  
629 626
  public void randomizeNewScramble(int[][] scramble, Random rnd, int curr, int total, ObjectSignature signature)
630 627
    {
631
    switch(mType)
628
    if( mTablebase!=null )
629
      {
630
      if( curr==0 ) mTablebase.scramble(rnd,total,scramble);
631
      }
632
    else
632 633
      {
633
      case SCRAMBLING_ALGORITHMS: randomizeNewScramble0(scramble, rnd, curr); break;
634
      case SCRAMBLING_SQUARE1   : randomizeNewScramble1(scramble, rnd, curr); break;
635
      case SCRAMBLING_BANDAGED  : randomizeNewScramble2(scramble, rnd, curr, total, signature); break;
636
      case SCRAMBLING_TABLEBASES: randomizeNewScramble3(scramble, rnd, curr, total, signature); break;
634
      switch(mType)
635
        {
636
        case SCRAMBLING_ALGORITHMS: randomizeNewScramble0(scramble, rnd, curr); break;
637
        case SCRAMBLING_SQUARE1   : randomizeNewScramble1(scramble, rnd, curr); break;
638
        case SCRAMBLING_BANDAGED  : randomizeNewScramble2(scramble, rnd, curr, total, signature); break;
639
        }
637 640
      }
638 641
    }
639 642
  }

Also available in: Unified diff