@vscubing/cubing
Version:
A collection of JavaScript cubing libraries.
52 lines (50 loc) • 1.36 kB
JavaScript
import "./chunks/chunk-DFQMTDRG.js";
// src/bin/order.ts
import { Alg } from "@vscubing/cubing/alg";
import { KPuzzle } from "@vscubing/cubing/kpuzzle";
import { getPuzzleGeometryByName } from "@vscubing/cubing/puzzle-geometry";
import { puzzles } from "@vscubing/cubing/puzzles";
var {
binary,
string: cmdString,
command,
positional,
run
} = await import("cmd-ts-too");
var ReadAlg = {
async from(str) {
return Alg.fromString(str);
}
};
var app = command({
name: "order",
description: `Example: order 3x3x3 "R U R' U R U2' R'"`,
args: {
puzzleGeometryID: positional({
type: cmdString,
displayName: "Puzzle geometry ID"
}),
alg: positional({
type: ReadAlg,
displayName: "Alg"
})
},
handler: async ({ puzzleGeometryID, alg }) => {
const puzzleLoader = puzzles[puzzleGeometryID];
const kpuzzle = await (async () => {
if (puzzleLoader) {
return await puzzles[puzzleGeometryID].kpuzzle();
} else {
const pg = getPuzzleGeometryByName(puzzleGeometryID, {
allMoves: true
});
return new KPuzzle(pg.getKPuzzleDefinition(true));
}
})();
const order = kpuzzle.algToTransformation(alg).repetitionOrder();
console.log(order);
}
});
await run(binary(app), process.argv);
//# sourceMappingURL=order.js.map