Skip to the content

Karakuriからくり

Play eight native puzzles, run bounded searches, step deterministic physics and mount a canvas player controlled by pointer or keyboard.

Karakuri is the Japanese word からくり for a mechanism or ingenious device. About the name

Contents

Reference · Native level collections

PinRescueEntrytype

A level, the pins that win it in order (by index in pins), and pins that lose it in order.

Import it

import type { PinRescueEntry } from "@johnmorrisdotca/karakuri/levels";

Definition

interface PinRescueEntry extends PinLevel {
    solution: readonly number[];
    loss: readonly number[];
}

Members

NameTypeDescription
solutionreadonly number[]
lossreadonly number[]
wallsreadonly Segment[]
pinsreadonly PinSpec[]
hero{ x: number; y: number; }
gold (optional){ x: number; y: number; } | undefined
fluidsreadonly FluidSpec[]
spikesreadonly Segment[]

Spikes: touching one loses.

zoneZone
goal"hero" | "gold" | "either"

What has to reach the safe place: the hero, the gold, or whichever gets there first.

Examples

import type { PinRescueEntry } from "@johnmorrisdotca/karakuri/levels";
import { PIN_RESCUE_LEVELS } from "@johnmorrisdotca/karakuri/levels";

const value: PinRescueEntry = PIN_RESCUE_LEVELS[0];
console.log(value);
{
  walls: [
    { ax: 70, ay: 40, bx: 70, by: 440 },
    { ax: 290, ay: 40, bx: 290, by: 440 },
    { ax: 70, ay: 440, bx: 290, by: 440 },
    { ax: 70, ay: 40, bx: 290, by: 40 }
  ],
  pins: [
    { x: 74, y: 250, length: 212, side: 'left' },
    { x: 286, y: 130, length: 212, side: 'right' }
  ],
  hero: { x: 180, y: 232 },
  fluids: [ { kind: 'lava', x: 78, y: 70, w: 204, h: 55 } ],
  spikes: [],
  zone: { x: 74, y: 405, w: 212, h: 35 },
  goal: 'hero',
  solution: [ 0 ],
  loss: [ 1 ]
}

What it prints (run when this page was built)

View sourceEdit on GitHubMade from the source of @johnmorrisdotca/karakuri 0.2.1.