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 · Controllers and canvas player

GameInfotype

What a game of the package is, for a chooser.

Import it

import type { GameInfo } from "@johnmorrisdotca/karakuri/play";

Also exported from: @johnmorrisdotca/karakuri

Definition

interface GameInfo {
    id: string;
    levels: number;
    gesture: "drag" | "tap";
    physics: boolean;
    create(level: number): Controller;
}

Members

NameTypeDescription
idstring
levelsnumber

How many levels it has.

gesture"drag" | "tap"
physicsboolean

Whether it runs a physics simulation, stepped sixty times a second.

create(level: number): Controller

Builds a controller for a level (from 1).

Examples

import type { GameInfo } from "@johnmorrisdotca/karakuri/play";
import { KARAKURI_GAMES } from "@johnmorrisdotca/karakuri/play";

const value: GameInfo = KARAKURI_GAMES["tube-sort"];
console.log(value);
{
  id: 'tube-sort',
  levels: 5,
  gesture: 'tap',
  physics: false,
  create: [Function: tubeSortController]
}

What it prints (run when this page was built)

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