Reference · Rules, tiles and records
judgeGridfunction
A grid judged against any test of a word: isWord answers for a run as spelt, and readable says how to name one that is not. judgeWithWords is this with a language's list.
Import it
import { judgeGrid } from "@johnmorrisdotca/kumimoji";
Definition
function judgeGrid(tiles: Tiles, isWord: (word: string) => boolean, readable?: (word: string) => string, rules?: GridRules): GridVerdict
Parameters
| Name | Type | Description |
|---|---|---|
tiles | Tiles | The map from row,column square names to internal tile codes. |
isWord | (word: string) => boolean | The predicate that accepts a readable word. |
readable (optional) | (word: string) => string | The conversion from tile codes to readable words. |
rules (optional) | GridRules | Whether diagonal runs are also judged. |
Returns
GridVerdict
A grid judged against any test of a word: isWord answers for a run as spelt, and readable says how to name one that is not. judgeWithWords is this with a language's list.
Examples
import { judgeGrid } from "@johnmorrisdotca/kumimoji";
const tiles = new Map([["0,0","c"],["0,1","a"],["0,2","t"]]);
console.log(judgeGrid(tiles,word=>word==="cat"));{
sound: true,
tiles: 3,
misspelt: Set(0) {},
apart: Set(0) {},
notWords: []
}What it prints (run when this page was built)