示例#1
0
  private static void initSym2Raw() {
    int repIdx = 0;
    EdgeCubies cube1 = new EdgeCubies();
    EdgeCubies cube2 = new EdgeCubies();
    Edge4 e = new Edge4();
    byte[] t = new byte[8];
    byte[] isRepTable = new byte[(N_RAW_COORD >> 3) + 1];
    hasSym = new int[N_COORD];
    for (int u = 0; u < N_RAW_COORD; ++u) {
      if (Util.get1bit(isRepTable, u)) continue;
      raw2sym[u] = repIdx << SYM_SHIFT;
      e.raw_coord = u;
      e.unpack(cube1);

      /* Only retain configs without parity */
      int ul = Util.get8Perm(cube1.cubies, 4);
      for (int i = 0; i < 4; i++)
        t[i] = (cube1.cubies[i] > 4) ? (byte) (cube1.cubies[i] - 8) : cube1.cubies[i];
      for (int i = 4; i < 8; i++)
        t[i] = (cube1.cubies[i + 8] > 4) ? (byte) (cube1.cubies[i + 8] - 8) : cube1.cubies[i + 8];
      int uh = Util.get8Perm(t, 0);
      if (Util.parity_perm8_table[ul] != Util.parity_perm8_table[uh])
        continue; // getting rid of the parity.

      for (int s = 1; s < N_SYM; ++s) {
        cube1.conjugate(s, cube2);
        e.pack(cube2);
        Util.set1bit(isRepTable, e.raw_coord);
        raw2sym[e.raw_coord] = (repIdx << SYM_SHIFT) + Symmetry.invSymIdx[s];
        if (e.raw_coord == u) hasSym[repIdx] |= (1 << s);
      }
      sym2raw[repIdx++] = u;
    }
  }
示例#2
0
  private static void initSym2Raw() {
    int repIdx = 0;
    CenterCubies cube1 = new CenterCubies();
    CenterCubies cube2 = new CenterCubies();
    Center3 c = new Center3();

    byte[] isRepTable = new byte[(N_RAW_COORD >> 3) + 1];
    hasSym = new int[N_COORD];
    for (int u = 0; u < N_RAW_COORD; ++u) {
      if (Util.get1bit(isRepTable, u)) continue;
      raw2sym[u] = repIdx << SYM_SHIFT;
      c.raw_coord = u;
      c.unpack(cube1);
      for (int s = 1; s < N_SYM; ++s) {
        cube1.rightMult(Symmetry.invSymIdx[s], cube2);
        c.pack(cube2);
        Util.set1bit(isRepTable, c.raw_coord);
        raw2sym[c.raw_coord] = (repIdx << SYM_SHIFT) + Symmetry.invSymIdx[s];
        if (c.raw_coord == u) hasSym[repIdx] |= (1 << s);
      }
      sym2raw[repIdx++] = u;
    }
  }