pointOffunction
Convert a row-major array index into board coordinates.
Import it
import { pointOf } from "@johnmorrisdotca/narabe";
Definition
function pointOf(size: number, index: number): Point
Parameters
| Name | Type | Description |
|---|---|---|
size | number | The number of cells on each side of the board. |
index | number | The row-major board array index. |
Returns
Point
Convert a row-major array index into board coordinates.
Examples
import { pointOf } from "@johnmorrisdotca/narabe";
console.log(pointOf(15, 112));{ row: 7, col: 7 }What it prints (run when this page was built)