crossingFit関数
リファレンスの説明と例は英語です。見出しと目次は日本語です。
Where word stands with its letter at on the tile at anchor, running
across or down, or null where it cannot: a square outside what may be used,
a tile at either end, a different letter in its way, a new tile with a
neighbour at its side, or no new tile at all — and, given diagonalWord
(a game with Diagonals), a new tile standing in a diagonal run of three or
more that diagonalWord does not take (diagonalsRead).
インポート
import { crossingFit } from "@johnmorrisdotca/kumimoji";
定義
function crossingFit(letterAt: (row: number, col: number) => string, inside: (row: number, col: number) => boolean, word: string, anchor: Square, at: number, across: boolean, diagonalWord?: ((run: string) => boolean) | null): CrossingFit | null
引数
| 名前 | 型 | 説明 |
|---|---|---|
letterAt | (row: number, col: number) => string | The tile at a coordinate, or an empty string for no tile. |
inside | (row: number, col: number) => boolean | Whether a coordinate is within the caller’s working grid. |
word | string | The encoded word to lay or spell. |
anchor | Square | The existing tile that the word crosses. |
at | number | The word offset, seat index or date specified by this signature. |
across | boolean | Whether to lay or type horizontally rather than vertically. |
diagonalWord (省略可) | ((run: string) => boolean) | null | Optional diagonal-word predicate; null disables diagonal checking. |
戻り値
CrossingFit | null
Where word stands with its letter at on the tile at anchor, running across or down, or null where it cannot: a square outside what may be used, a tile at either end, a different letter in its way, a new tile with a neighbour at its side, or no new tile at all — and, given diagonalWord (a game with Diagonals), a new tile standing in a diagonal run of three or more that diagonalWord does not take (diagonalsRead).
例
import { crossingFit } from "@johnmorrisdotca/kumimoji";
console.log(crossingFit((r,c)=>r===0&&c===0?"c":"",()=>true,"cat",{row:0,col:0},0,true));{
first: { row: 0, col: 0 },
fresh: [ { row: 0, col: 1 }, { row: 0, col: 2 } ]
}出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。