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

RopeCutEntrytype

A level and the cuts that win it, in order: the step to cut at, which rope, which link of it.

Import it

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

Definition

interface RopeCutEntry extends RopeLevel {
    solution: readonly {
        at: number;
        rope: number;
        link: number;
    }[];
    loss: readonly {
        at: number;
        rope: number;
        link: number;
    }[];
}

Members

NameTypeDescription
solutionreadonly { at: number; rope: number; link: number; }[]
lossreadonly { at: number; rope: number; link: number; }[]
anchorsreadonly { x: number; y: number; }[]

Where each rope is fixed. A rope runs from there to the load.

load{ x: number; y: number; r: number; }
platformsreadonly Platform[]
goal{ kind: "zone" | "button"; area: Area; }

What wins: the load's centre in a zone, or the load touching a button.

pitYnumber

Where the load is lost: below pitY, or in any of these.

pitsreadonly Area[]

Examples

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

const value: RopeCutEntry = ROPE_CUT_LEVELS[0];
console.log(value);
{
  anchors: [ { x: 180, y: 40 } ],
  load: { x: 180, y: 170, r: 14 },
  platforms: [
    { ax: 116, ay: 380, bx: 130, by: 440 },
    { ax: 130, ay: 440, bx: 230, by: 440 },
    { ax: 230, ay: 440, bx: 244, by: 380 }
  ],
  goal: { kind: 'zone', area: { x: 135, y: 395, w: 90, h: 42 } },
  pitY: 480,
  pits: [],
  solution: [ { at: 0, rope: 0, link: 4 } ],
  loss: []
}

What it prints (run when this page was built)

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