本文へ移動

Tsunagi繋ぎ

同じ印の2つを別々の線で結び、盤を埋めます。収録された問題やシード付きの問題で遊べます。

「つなぎ」は、物をつなぐことを表す言葉です。 名前について(英語)

目次

リファレンス · SVGの盤

TsunagiDrawOptions型

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

DRAWING a board as SVG text: a string, to put in a page, a file or an image, with nothing to load and nothing run. Every picture here is made in code.

What is drawn is what the site that grew this package draws: marbles on a board, the lines between them as thick rounded strokes through the cells' middles, every cell a line runs through washed faintly in its colour and (as fill: "marbles") holding a small marble of that colour too, so a finished board is a board of marbles joined by their lines. Walls are thick bars on the edge between two cells. A BRIDGE is drawn as a bridge: the line going down passes UNDER its deck and is lost beneath it, and the line going across is drawn over the deck. A waypoint is a ring in its line's colour. A board that wraps has a ghost of the far edge all round it, faded, with a dashed rim round the real board, and a line across the join is drawn out through one edge and in through the other. A hexagon is a honeycomb of hexagons.

The drawing holds still: the same board is the same box whatever is drawn on it, and a page redraws it as lines change. Colours and numbers on the marbles, dots or only lines, a colour set and a board are all options.

インポート

import type { TsunagiDrawOptions } from "@johnmorrisdotca/tsunagi/draw";

定義

type TsunagiDrawOptions = {
    lines?: Lines;
    marks?: TsunagiMarks;
    fill?: TsunagiFill;
    colours?: TsunagiColourSetName | readonly TsunagiColour[];
    board?: TsunagiBoardName | TsunagiBoardLook;
    coordinates?: boolean;
    ghosts?: boolean;
    flagged?: Iterable<number>;
    blasted?: Iterable<number>;
    done?: boolean;
    language?: TsunagiLanguage;
    label?: string;
    style?: boolean;
    id?: string;
};

メンバー

名前型説明
lines (省略可)Lines | undefined

The lines drawn so far, one list of cells for each pair (Lines); none, if left out.

marks (省略可)TsunagiMarks | undefined

Tell the pairs apart by colour (the default) or by the number on their marbles.

fill (省略可)TsunagiFill | undefined

A small marble in every cell a line runs through (marbles, the default: the dots), or the line alone (lines).

colours (省略可)"marble" | "bright" | "colour-blind" | "soft" | readonly TsunagiColour[] | undefined

The colour of each pair: a named set (marble, bright, colour-blind, soft) or colours of your own.

board (省略可)"paper" | "wood" | "green" | "blue" | "red" | "black" | TsunagiBoardLook | undefined

The board it is drawn on: paper (the default, which follows the page's light or dark), wood, green, blue, red, black, or a look of your own.

coordinates (省略可)boolean | undefined

Row numbers and column letters down the board's sides. Not drawn on a board that wraps or a hexagon.

ghosts (省略可)boolean | undefined

The ghost of the far edge round a board that wraps. Default true.

flagged (省略可)Iterable<number> | undefined

Pairs whose marbles flash: the ones Check found not joined yet.

blasted (省略可)Iterable<number> | undefined

Cells an explosion has just taken a line out of: each bursts.

done (省略可)boolean | undefined

The board is solved: a faint wash of green over it, and data-solved="true".

language (省略可)TsunagiLanguage | undefined

The language a screen reader hears the drawing in: en (the default) or ja.

label (省略可)string | undefined

A description for screen readers, instead of the board's size.

style (省略可)boolean | undefined

Put TSUNAGI_STYLE inside the drawing, so it stands alone as an image. A page with the style in already leaves this off.

id (省略可)string | undefined

The prefix of the ids the drawing's gradients and mask are given, so two drawings on one page never share one. Made from the drawing itself, if left out.

例

import type { TsunagiDrawOptions } from "@johnmorrisdotca/tsunagi/draw";

const value: TsunagiDrawOptions = {marks:"numbers",coordinates:true};
console.log(value);
{ marks: 'numbers', coordinates: true }

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

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

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