Skip to the content

Houseki宝石

Run five native gem and stone engines, play measured challenges and lessons, and save deterministic games.

Houseki (宝石) is Japanese for a gem or precious stone. About the name

Contents

Reference · Tsumiki

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

NameTypeDescription
stateGameState

The game.

slotnumber

The place in the tray: 0, 1 or 2.

rownumber

The row of the piece's top left.

columnnumber

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));
true

What it prints (run when this page was built)

View sourceEdit on GitHubMade from the source of @johnmorrisdotca/houseki 0.5.0.