// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  // Move table for the three edges UB,DR and DF in phase1.
  private void loadUBtoDFMoves(boolean force) {
    if (!force && UBtoDF_Move != null) return;
    UBtoDF_Move = new short[N_UBtoDF][N_MOVE];

    CubieCube a = new CubieCube();
    for (short i = 0; i < N_UBtoDF; i++) {
      a.setUBtoDF(i);
      for (int j = 0; j < 6; j++) {
        for (int k = 0; k < 3; k++) {
          a.edgeMultiply(CubieCube.moveCube[j]);
          UBtoDF_Move[i][3 * j + k] = a.getUBtoDF();
        }
        a.edgeMultiply(CubieCube.moveCube[j]);
      }
    }
  }
  // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  // Move table for the four UD-slice edges FR, FL, Bl and BR
  // FRtoBRMove < 11880 in phase 1
  // FRtoBRMove < 24 in phase 2
  // FRtoBRMove = 0 for solved cube
  private void loadFRtoBRMoves(boolean force) {
    if (!force && FRtoBR_Move != null) return;
    FRtoBR_Move = new short[N_FRtoBR][N_MOVE];

    CubieCube a = new CubieCube();
    for (short i = 0; i < N_FRtoBR; i++) {
      a.setFRtoBR(i);
      for (int j = 0; j < 6; j++) {
        for (int k = 0; k < 3; k++) {
          a.edgeMultiply(CubieCube.moveCube[j]);
          FRtoBR_Move[i][3 * j + k] = a.getFRtoBR();
        }
        a.edgeMultiply(CubieCube.moveCube[j]);
      }
    }
  }
  // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  // Move table for the flips of the edges
  // flip < 2048 in phase 1
  // flip = 0 in phase 2.
  private void loadFlipMoves(boolean force) {
    if (!force && flipMove != null) return;
    flipMove = new short[N_FLIP][N_MOVE];

    CubieCube a = new CubieCube();
    for (short i = 0; i < N_FLIP; i++) {
      a.setFlip(i);
      for (int j = 0; j < 6; j++) {
        for (int k = 0; k < 3; k++) {
          a.edgeMultiply(CubieCube.moveCube[j]);
          flipMove[i][3 * j + k] = a.getFlip();
        }
        a.edgeMultiply(CubieCube.moveCube[j]); // a
      }
    }
  }
  // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  // Move table for the permutation of six U-face and D-face edges in phase2. The positions of the
  // DL and DB edges are
  // determined by the parity.
  // URtoDF < 665280 in phase 1
  // URtoDF < 20160 in phase 2
  // URtoDF = 0 for solved cube.
  private void loadURtoDFMoves(boolean force) {
    if (!force && URtoDF_Move != null) return;
    URtoDF_Move = new short[N_URtoDF][N_MOVE];

    CubieCube a = new CubieCube();
    for (short i = 0; i < N_URtoDF; i++) {
      a.setURtoDF(i);
      for (int j = 0; j < 6; j++) {
        for (int k = 0; k < 3; k++) {
          a.edgeMultiply(CubieCube.moveCube[j]);
          URtoDF_Move[i][3 * j + k] =
              (short)
                  a
                      .getURtoDF(); // Table values are only valid for phase 2 moves! For phase 1
                                    // moves, casting to short is not possible.
        }
        a.edgeMultiply(CubieCube.moveCube[j]);
      }
    }
  }