drawnByLengthfunction
Whether a finished game was drawn because it ran to its length, rather than because the board filled or both sides made a line at once.
The status line has to say which: "both made a line at once" is a different thing from "we agreed to stop here", and telling a player the wrong one is worse than telling them nothing.
Import it
import { drawnByLength } from "@johnmorrisdotca/narabe";
Definition
function drawnByLength(state: GameState): boolean
Parameters
| Name | Type | Description |
|---|---|---|
state | GameState | The current immutable game position. |
Returns
boolean
Whether a finished game was drawn because it ran to its length, rather than because the board filled or both sides made a line at once. The status line has to say which: "both made a line at once" is a different thing from "we agreed to stop here", and telling a player the wrong one is worse than telling them nothing.
Examples
import { createGame, drawnByLength } from "@johnmorrisdotca/narabe";
const state = createGame({variant:"freestyle",size:15});
console.log(drawnByLength(state));falseWhat it prints (run when this page was built)