本文へ移動

Karakuriからくり

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

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

目次

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

StretchGrabberEntry型

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

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

インポート

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

定義

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

メンバー

名前型説明
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[]

例

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

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

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

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