canBeDrawnfunction
Whether this game can be drawn at all.
Hex cannot. A full Hex board always holds exactly one chain from side to side, so there is no position in which neither player has won — and the rules page says so as a fact about the shape of the board rather than as a rule anybody wrote. A length that could produce a drawn Hex game would make that sentence false, so the length simply does not apply there, and the setting is refused rather than quietly ignored.
Read from the spec, never from a variant's name: any game that is won by joining two sides has the same theorem behind it.
Import it
import { canBeDrawn } from "@johnmorrisdotca/narabe";
Definition
function canBeDrawn(settings: GameSettings): boolean
Parameters
| Name | Type | Description |
|---|---|---|
settings | GameSettings | The native game settings to interpret. |
Returns
boolean
Whether the native game mechanics can end in a draw.
Examples
import { canBeDrawn, createGame } from "@johnmorrisdotca/narabe";
const state = createGame({variant:"freestyle",size:15});
console.log(canBeDrawn(state.settings));trueWhat it prints (run when this page was built)