Me when trying to write a .def file:

mind = blown

but seriously can someone explain to me how to define orientation in non-trivial cases? 3x3 edges I sorta get, but for instance megaminx corners and edges. How do you define orientation?

It took me a lot of sitting with my megaminx with a lot of confused turning to figure out. I'll try explain in a way that made sense to me.

For faces other than U or D, you can observe that the effect of a a single one fifth turn on the two corners in the U/D layer is the same as a quarter turn on a 3x3. Since the inverse of a turn must undo the effect, we can say the same for the two corners brought into U/D by that turn. That leaves the one corner on the "equator zig-zag" (don't know what else to call it) as an unknown. Since the total corner twist on the entire puzzle must be a multiple of 3, you can work out that the orientation of the last corner can't be changed with a single fifth turn.

With edge orientation, it's a little trickier. A face turn must flip an even number of edges, but since there are 5 edges per face, at least one edge must keep it's orientation. On a 3x3 orientation is specified relative to an axis that is defined by the line passing through the F and B centres. On a megaminx, you can define a similar axis that doesn't pass through centres, but passes through two corners. It's easiest to explain with colours, I think. Assuming you have a megaminx with the default colour scheme, and hold white on top, green on front. Then the axis for orientation goes from the front-most corner (green-turquoise-pale yellow) to the back-most corner (blue-yellow-light green). Then the following rules for figuring out edge orientation apply:

- Turning a face that does not contain the axis corner does not affect edge orientation.
- Turning a face that contains an axis corner flips 4 edges. The edge that is not flipped is the edge that is between the corner that moves out of the axis position and the corner that moves into the axis position. Or, the edge that stays on the equator zig-zag does not change orientation.