footprintFitsfunction
Whether every cell of a footprint is on the board and empty.
Import it
import { footprintFits } from "@johnmorrisdotca/narabe";
Definition
function footprintFits(board: Cell[], size: number, cells: readonly PieceCell[]): boolean
Parameters
| Name | Type | Description |
|---|---|---|
board | Cell[] | The row-major board cells; null marks an empty point. |
size | number | The number of cells on each side of the board. |
cells | readonly PieceCell[] | The absolute coloured cells of the piece placement. |
Returns
boolean
Whether every cell of a footprint is on the board and empty.
Examples
import { createGame, footprintFits } from "@johnmorrisdotca/narabe";
const state = createGame({variant:"freestyle",size:15});
const point = {row:7,col:7};
console.log(footprintFits(state.board,15,[{...point,stone:"black"}]));trueWhat it prints (run when this page was built)