Skip to main content
jimhark's user avatar
jimhark's user avatar
jimhark's user avatar
jimhark
  • Member for 11 years, 7 months
  • Last seen more than a month ago
awarded
comment
How to represent a Rubik's Cube in a data structure
the most straightforward way of know whether a cube is solvable is to solve it. Well, using the model you suggest I guess that's true. But if you use a model closer to @maple_shaft's and track rotations, you can quickly test if a 3x3x3 cube is solvable by verifying sum of edge flips mod 2 is 0 and corner rotations mod 3 is 0. Then check the parity of the permutation by counting edge swaps and corner swaps (needed to get back to solved), their sum mod 2 must be 0 (total parity even). These are the necessary and sufficient tests to prove the cube is solvable.