legalTurnsfunction
The turns a layer can make: [1, 2, 3] where its slice is square, [2]
where it is not, and none where there is no such layer or the layer is the
whole puzzle.
Import it
import { legalTurns } from "@johnmorrisdotca/kyuubu/cuboid";
Definition
function legalTurns(dims: CuboidDims, axis: CubeAxis, layer: number): readonly CubeTurns[]
Parameters
| Name | Type | Description |
|---|---|---|
dims | CuboidDims | The cuboid’s x, y and z dimensions, in that order. |
axis | CubeAxis | The model axis: 0 for x, 1 for y, or 2 for z. |
layer | number | The layer index counted from the negative side of the axis. |
Returns
readonly CubeTurns[]
The turns a layer can make: [1, 2, 3] where its slice is square, [2] where it is not, and none where there is no such layer or the layer is the whole puzzle.
Examples
import { legalTurns } from "@johnmorrisdotca/kyuubu/cuboid";
const dims = [2, 3, 3] as const;
console.log(legalTurns(dims, 1, 0));[ 2 ]What it prints (run when this page was built)