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

StretchGrabberEntrytype

A level, the waypoints of one way to win it, and of one way to lose it.

Import it

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

Definition

interface StretchGrabberEntry extends GrabLevel {
    solution: readonly Pt[];
    loss: readonly Pt[];
}

Members

NameTypeDescription
solutionreadonly Pt[]
lossreadonly Pt[]
basePt
star{ x: number; y: number; r: number; }
maxLengthnumber

The most the arm can stretch to, in units of length.

solidsreadonly Solid[]
hazardsreadonly Hazard[]

Examples

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

const value: StretchGrabberEntry = STRETCH_GRABBER_LEVELS[0];
console.log(value);
{
  base: { x: 180, y: 452 },
  star: { x: 70, y: 70, r: 13 },
  maxLength: 694,
  solids: [ { kind: 'wall', ax: 0, ay: 270, bx: 250, by: 270, r: 6 } ],
  hazards: [ { kind: 'laser', ax: 0, ay: 400, bx: 110, by: 400 } ],
  solution: [
    { x: 180, y: 452 },
    { x: 272, y: 272 },
    { x: 264, y: 252 },
    { x: 88, y: 80 }
  ],
  loss: [ { x: 55, y: 400 } ]
}

What it prints (run when this page was built)

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