// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // Generate a CoordCube from a CubieCube public CoordCube(CubieCube c) { twist = c.getTwist(); flip = c.getFlip(); parity = c.cornerParity(); FRtoBR = c.getFRtoBR(); URFtoDLF = c.getURFtoDLF(); URtoUL = c.getURtoUL(); UBtoDF = c.getUBtoDF(); URtoDF = c.getURtoDF(); // only needed in phase2 }
/** * Generates a random cube. * @return A random cube in the string representation. Each cube of the cube space has the same probability. */ public static String randomCube() { CubieCube cc = new CubieCube(); Random gen = new Random(); cc.setFlip((short)gen.Next(CoordCube.N_FLIP)); cc.setTwist((short)gen.Next(CoordCube.N_TWIST)); do { cc.setURFtoDLB(gen.Next(CoordCube.N_URFtoDLB)); cc.setURtoBR(gen.Next(CoordCube.N_URtoBR)); } while ((cc.edgeParity() ^ cc.cornerParity()) != 0); FaceCube fc = cc.toFaceCube(); return(fc.to_String()); }