Cell type strings that cannot be entered.
A predicate for chooseHiderAction, chooseSeekerStep, and the search helpers.
import { walkableUnlessTypes } from "@tamb/gamegrid/npc";
const matrix = [
[
{ type: "floor" },
{ type: "wall" },
],
[
{ type: "water" },
{ type: "floor" },
],
];
const isWalkable = walkableUnlessTypes(["wall", "water"]);
isWalkable(matrix, 0, 0); // floor
isWalkable(matrix, 1, 0); // wall, blocked
isWalkable(matrix, 1, 1); // floor
isWalkable(matrix, -1, 0); // false, off the board
isWalkable(matrix, 0, 2); // false, no such row
Walkability that blocks the given cell types and anything off the matrix. A game whose walls are
"barrier"passes that name. A game whose walls are"wall"passes that instead. Types not in the list can be entered.