canPlacefunction
Whether a piece from the tray can go with its top left on this cell, for a host to draw a ghost.
Import it
import { canPlace } from "@johnmorrisdotca/houseki/tsumiki";
Definition
function canPlace(state: GameState, slot: number, row: number, column: number): boolean
Parameters
| Name | Type | Description |
|---|---|---|
state | GameState | The game. |
slot | number | The place in the tray: 0, 1 or 2. |
row | number | The row of the piece's top left. |
column | number | The column of the piece's top left. |
Returns
boolean
True when the piece is there and every cell it would take is free and on the board.
Examples
import { canPlace, createGame } from "@johnmorrisdotca/houseki/tsumiki";
console.log(canPlace(createGame({ seed: "demo" }), 0, 0, 0));trueWhat it prints (run when this page was built)