@tamb/gamegrid
    Preparing search index...

    Function createNpcMemory

    • Empty search state for one NPC. Keep this object and pass it on later ticks. Replacing it forgets visited cells, the last sighting, and the coverage sweep.

      Returns NpcMemory

      A new memory object the brains mutate.

      import { chooseSeekerStep, createNpcMemory, walkableUnlessTypes } from "@tamb/gamegrid/npc";

      const memory = createNpcMemory();
      const matrix = [[{ type: "floor" }, { type: "floor" }]];
      const isWalkable = walkableUnlessTypes(["wall"]);

      chooseSeekerStep({
      matrix,
      isWalkable,
      self: [0, 0],
      visibleQuarry: [],
      isQuarryActive: () => false,
      memory,
      difficulty: "normal",
      });

      chooseSeekerStep({
      matrix,
      isWalkable,
      self: [1, 0],
      visibleQuarry: [],
      isQuarryActive: () => false,
      memory,
      difficulty: "normal",
      });

      memory.visited.has("0,0"); // true
      memory.visited.has("1,0"); // true