orientationsfunction
Every distinct way the piece can lie: four rotations, each also mirrored. Colours travel with their cells, so a black-white domino turned round is a different orientation from the one it started as.
Import it
import { orientations } from "@johnmorrisdotca/narabe";
Definition
function orientations(piece: Piece): PieceCell[][]
Parameters
| Name | Type | Description |
|---|---|---|
piece | Piece | The queued piece with relative coloured cells. |
Returns
PieceCell[][]
Every distinct way the piece can lie: four rotations, each also mirrored. Colours travel with their cells, so a black-white domino turned round is a different orientation from the one it started as.
Examples
import { orientations } from "@johnmorrisdotca/narabe";
console.log(orientations({cells:[{row:0,col:0,stone:"black"},{row:0,col:1,stone:"white"}]}).length);4What it prints (run when this page was built)