Lucas Garron
Administrator
I have yet another suggestion. I'm not sure if this was intentional or not, but did you intend your inverse function to do Inverse["F2"] = "F2'" instead of simply "F2"?
I'm not asking you to change this, but, for the use of Cube Explorer, it doesn't recognize "F2'" as F2, for example.
Therefore, if only it makes no difference to you, then could you just simply add a string replace command "2'"->"2" at the end of your inverse function?
It is definitely intentional. Because alg.cubing.net is built primarily for cubers, I consider direction to be an important property of a move. I always type out my algs and reconstructions with deliberate directions for double turns, and write my code to make sure all the transformations honor directions.
I don't want to add a button specifically for your requested transformation, unless others would also find it very useful. Perhaps there is a way to generalize it to something to something that is general enough to warrant a button for it, but I'd rather leave it out unless we think of one.
But just to make this easier on you for now, here's some simple code that has the desired effect:
Code:
var positiveDoubleTurns = alg.cube.makeAlgTraversal();
positiveDoubleTurns.move = function(move) {
if (move.amount < -1) {
var newMove = alg.cube.cloneMove(move);
newMove.amount = newMove.amount + 4;
return newMove;
}
else {
return move;
}
};
var oldAlgString = $("#algorithm").val();
var newAlgString = positiveDoubleTurns(oldAlgString);
$("#algorithm").val(newAlgString);
Run it in the Javascript console or create a bookmarklet from it.
If you also want to convert F' into F3, just change the comparison on line 4 into (move.amount < 0).
In any case, you might want to ask Herbert Kociemba if he would adapt his parser to treat 2' as 2.