How-to
Use a cuboid
Choose cuboid dimensions, match turns to the slice shape, and draw and replay a cuboid.
Choose dimensions
Import the cuboid engine for box-shaped puzzles. Dimensions are x, y and z, each a whole number from 1 to 7; 1×1×1 is refused because it has no layer to turn. A side one cubie deep is the whole puzzle, not a legal layer turn.
Respect the slice
A square slice can make quarter turns; a rectangular slice only half turns. readCuboidMoves explains a refused token instead of silently changing it.
import { legalTurns, readCuboidMoves, solvedCuboid, turnAllCuboid } from "@johnmorrisdotca/kyuubu/cuboid";
const dims = [2, 3, 3] as const;
console.log(legalTurns(dims, 0, 0));
console.log(legalTurns(dims, 1, 0));
const reading = readCuboidMoves("R U2", dims);
if (reading.ok) console.log(turnAllCuboid(solvedCuboid(dims), dims, reading.moves));
else console.log(reading.token, reading.fault);[ 1, 2, 3 ]
[ 2 ]
FUFUFULLLRRRRRRUBFDFDDBDBDBRRRLLLLLLFDUBUBDraw and replay
CuboidView takes dims instead of size. The cuboid player and element preserve the same legality rules. The full shape and notation material remains in Cuboids and Cuboid usage.