本文へ移動

Tsunagi繋ぎ

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

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

目次

リファレンス · 問題集の読み込み

LevelRow型

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

One level: its layout and its one answer, each a code (code.ts).

インポート

import type { LevelRow } from "@johnmorrisdotca/tsunagi/levels";

ほかのエクスポート元: @johnmorrisdotca/tsunagi

定義

type LevelRow = readonly [
    string,
    string
];

メンバー

名前型説明
0string
1string
length2
toString(): string

Returns a string representation of an array.

toLocaleString(): string (locales: string | string[], options?: Intl.NumberFormatOptions & Intl.DateTimeFormatOptions): string

Returns a string representation of an array. The elements are converted to string using their toLocaleString methods.

concat(...items: ConcatArray<string>[]): string[] (...items: (string | ConcatArray<string>)[]): string[]

Combines two or more arrays.

join(separator?: string): string

Adds all the elements of an array separated by the specified separator string.

slice(start?: number, end?: number): string[]

Returns a section of an array.

indexOf(searchElement: string, fromIndex?: number): number

Returns the index of the first occurrence of a value in an array.

lastIndexOf(searchElement: string, fromIndex?: number): number

Returns the index of the last occurrence of a specified value in an array.

every<S extends string>(predicate: (value: string, index: number, array: readonly string[]) => value is S, thisArg?: any): this is readonly S[] (predicate: (value: string, index: number, array: readonly string[]) => unknown, thisArg?: any): boolean

Determines whether all the members of an array satisfy the specified test.

some(predicate: (value: string, index: number, array: readonly string[]) => unknown, thisArg?: any): boolean

Determines whether the specified callback function returns true for any element of an array.

forEach(callbackfn: (value: string, index: number, array: readonly string[]) => void, thisArg?: any): void

Performs the specified action for each element in an array.

map<U>(callbackfn: (value: string, index: number, array: readonly string[]) => U, thisArg?: any): U[]

Calls a defined callback function on each element of an array, and returns an array that contains the results.

filter<S extends string>(predicate: (value: string, index: number, array: readonly string[]) => value is S, thisArg?: any): S[] (predicate: (value: string, index: number, array: readonly string[]) => unknown, thisArg?: any): string[]

Returns the elements of an array that meet the condition specified in a callback function.

reduce(callbackfn: (previousValue: string, currentValue: string, currentIndex: number, array: readonly string[]) => string): string (callbackfn: (previousValue: string, currentValue: string, currentIndex: number, array: readonly string[]) => string, initialValue: string): string <U>(callbackfn: (previousValue: U, currentValue: string, currentIndex: number, array: readonly string[]) => U, initialValue: U): U

Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.

reduceRight(callbackfn: (previousValue: string, currentValue: string, currentIndex: number, array: readonly string[]) => string): string (callbackfn: (previousValue: string, currentValue: string, currentIndex: number, array: readonly string[]) => string, initialValue: string): string <U>(callbackfn: (previousValue: U, currentValue: string, currentIndex: number, array: readonly string[]) => U, initialValue: U): U

Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.

find<S extends string>(predicate: (value: string, index: number, obj: readonly string[]) => value is S, thisArg?: any): S | undefined (predicate: (value: string, index: number, obj: readonly string[]) => unknown, thisArg?: any): string | undefined

Returns the value of the first element in the array where predicate is true, and undefined otherwise.

findIndex(predicate: (value: string, index: number, obj: readonly string[]) => unknown, thisArg?: any): number

Returns the index of the first element in the array where predicate is true, and -1 otherwise.

entries(): ArrayIterator<[number, string]>

Returns an iterable of key, value pairs for every entry in the array

keys(): ArrayIterator<number>

Returns an iterable of keys in the array

values(): ArrayIterator<string>

Returns an iterable of values in the array

includes(searchElement: string, fromIndex?: number): boolean

Determines whether an array includes a certain element, returning true or false as appropriate.

flatMap<U, This = undefined>(callback: (this: This, value: string, index: number, array: string[]) => U | readonly U[], thisArg?: This | undefined): U[]

Calls a defined callback function on each element of an array. Then, flattens the result into a new array. This is identical to a map followed by flat with depth 1.

flat<A, D extends number = 1>(this: A, depth?: D | undefined): FlatArray<A, D>[]

Returns a new array with all sub-array elements concatenated into it recursively up to the specified depth.

at(index: number): string | undefined

Returns the item located at the specified index.

例

import type { LevelRow } from "@johnmorrisdotca/tsunagi/levels";
import { TSUNAGI_4 } from "@johnmorrisdotca/tsunagi/levels-4";

const value: LevelRow = TSUNAGI_4[0];
console.log(value);
[ 'A..AB..BC..CD..D', 'AAAABBBBCCCCDDDD' ]

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

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

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