Project

General

Profile

« Previous | Next » 

Revision ca4a3a68

Added by Leszek Koltunski 12 months ago

Algorithms now have their 'layers' in bitmap form.

We have to update all object JSON files.

View differences:

src/main/java/org/distorted/objectlib/scrambling/ScrambleState.java
39 39
    mMoreThanOneAxis = moreThanOne;
40 40
    }
41 41

  
42
///////////////////////////////////////////////////////////////////////////////////////////////////
43

  
44
  private int getScrambleValue(int[] alg, int[][] scrambleTable)
45
    {
46
    int l=0, layerBmp = alg[1];
47

  
48
    for(; l<32; l++)
49
      {
50
      if( (layerBmp&0x1) !=0 ) break;
51
      layerBmp /= 2;
52
      }
53

  
54
    return scrambleTable[alg[0]][l];
55
    }
56

  
42 57
///////////////////////////////////////////////////////////////////////////////////////////////////
43 58

  
44 59
  public void getRandom(Random rnd, int[][] algorithms, int axisExcluded, int[][] scrambleTable, int[] numOccurences, int[] result)
......
53 68

  
54 69
      if( alg[0]!=axisExcluded )
55 70
        {
56
        int value = scrambleTable[alg[0]][alg[1]];
71
        int value = getScrambleValue(alg,scrambleTable);
57 72
        if( value>max ) max=value;
58 73
        }
59 74
      }
......
62 77
      {
63 78
      int[] alg = algorithms[mEdges[2*i]];
64 79
      int previous = (total==0 ? 0 : numOccurences[total-1]);
65
      if( alg[0]!=axisExcluded ) numOccurences[total] = 1+max-scrambleTable[alg[0]][alg[1]]+previous;
80
      if( alg[0]!=axisExcluded ) numOccurences[total] = 1+max+previous-getScrambleValue(alg,scrambleTable);
66 81
      else                       numOccurences[total] = previous;
67 82
      total++;
68 83
      }

Also available in: Unified diff