

If they would be flipped, the cube would be solved. Imagine a cube that has all pieces in their right slots and rightly rotated, except for the edges which could be flipped, but still in right slot. I will describe those functions below, starting with the one whose result is used in the innermost loop: getEdgeFlipSequences


RUBIKS CUBE FLIP A SIDE PIECE CODE
Mr Smart's code will go through each of the 5 get functions to retrieve the basic sequences he needs to start producing sequences to the caller. Mr Dumb's code passes his callback function once to Mr Smart, who will then keep calling back that function until it returns true. Mr Dumb would have this code: function performMoves(sequence):
RUBIKS CUBE FLIP A SIDE PIECE GENERATOR
A callback system will avoid the need for keeping all moves in memory, and could be rewritten in the more modern generator syntax if available in the target language. functions would all return an array of sequences, where each sequence is an array of moves. ParitySwitchingSequences = getParitySwitchingSequences()ĬornerCycleSequences = getCornerCycleSequences()ĮdgeCycleSequences = getEdgeCycleSequences()ĬornerRotationSequences = getCornerRotationSequences()ĮdgeFlipSequences = getEdgeFlipSequences()įoreach paritySeq in paritySwitchingSequences:įoreach cornerCycleSeq in cornerCycleSequences:įoreach edgeCycleSeq in edgeCycleSequences:įoreach cornerRotationSeq in cornerRotationSequences:įoreach edgeFLipSeq in edgeFlipSequences: The main structure of the algorithm for Mr Smart would look like this: function getMoves(callback): Note that this is purely a theoretical problem and I don't actually want to program a computer to do this.Īn idea to get such a path through all permutations of the Cube would be to use some of the sequences that human solvers use.
