lineDirectionsForfunction
The directions a winning line may run: the hexagon's three axes on a hexagon board, the square's four otherwise.
Import it
import { lineDirectionsFor } from "@johnmorrisdotca/narabe";
Definition
function lineDirectionsFor(hexagon: boolean): readonly Point[]
Parameters
| Name | Type | Description |
|---|---|---|
hexagon | boolean | Whether to use the hexagonal rather than square line directions. |
Returns
readonly Point[]
The directions a winning line may run: the hexagon's three axes on a hexagon board, the square's four otherwise.
Examples
import { lineDirectionsFor } from "@johnmorrisdotca/narabe";
console.log(lineDirectionsFor(false));[
{ row: 0, col: 1 },
{ row: 1, col: 0 },
{ row: 1, col: 1 },
{ row: 1, col: -1 }
]What it prints (run when this page was built)