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