本文へ移動

Karakuriからくり

8つの標準のパズルで遊び、探索や再現できる物理を使い、ポインターやキーボードで操作する盤を表示できます。

「からくり」は、仕組みや工夫した装置を表す言葉です。 名前について(英語)

目次

リファレンス · 標準の問題一覧

PinRescueEntry型

リファレンスの説明と例は英語です。見出しと目次は日本語です。

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

インポート

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

定義

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

メンバー

名前型説明
solutionreadonly number[]
lossreadonly number[]
wallsreadonly Segment[]
pinsreadonly PinSpec[]
hero{ x: number; y: number; }
gold (省略可){ 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.

例

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 ]
}

出力(このページを作ったときに実行した結果)

ソースを見るGitHub で編集@johnmorrisdotca/karakuri 0.2.1 のソースから作成しました。

この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。