diagonalsRead関数
リファレンスの説明と例は英語です。見出しと目次は日本語です。
Whether every diagonal run a laying's new tiles would stand in is taken by
isWord: each walked from its top end down, with the word's own letters on
its new squares. Only a run through a new tile can change, and two new
tiles of one word never share a diagonal (they share a row or a column), so
each is read on its own. A run of two, a corner touch, is never read.
インポート
import { diagonalsRead } from "@johnmorrisdotca/kumimoji";
定義
function diagonalsRead(letterAt: (row: number, col: number) => string, inside: (row: number, col: number) => boolean, word: string, fit: CrossingFit, isWord: (run: string) => boolean): boolean
引数
| 名前 | 型 | 説明 |
|---|---|---|
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. |
fit | CrossingFit | The first coordinate and fresh tile coordinates of the proposed laying. |
isWord | (run: string) => boolean | The predicate that accepts a readable word. |
戻り値
boolean
Whether every diagonal run a laying's new tiles would stand in is taken by isWord: each walked from its top end down, with the word's own letters on its new squares. Only a run through a new tile can change, and two new tiles of one word never share a diagonal (they share a row or a column), so each is read on its own. A run of two, a corner touch, is never read.
例
import { loadTileWordsFromModule } from "@johnmorrisdotca/kumimoji/words";
import { diagonalsRead } from "@johnmorrisdotca/kumimoji";
const words = await loadTileWordsFromModule("english");
console.log(diagonalsRead(()=>"",()=>true,"cat",{first:{row:0,col:0},fresh:[{row:0,col:0},{row:0,col:1},{row:0,col:2}]},word=>words.allowed.has(word)));true出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。