Reference · Rules, tiles and records
crossingFitfunction
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 it
import { crossingFit } from "@johnmorrisdotca/kumimoji";
Definition
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
Parameters
| Name | Type | Description |
|---|---|---|
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 (optional) | ((run: string) => boolean) | null | Optional diagonal-word predicate; null disables diagonal checking. |
Returns
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).
Examples
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 } ]
}What it prints (run when this page was built)