winOnTimefunction
Ends the game against a player who has run out of time.
A clock is not a rule of gomoku, so the engine does not run one — but the result still has to be a proper game state rather than something the UI paints over the top, or the record and the board would disagree.
Import it
import { winOnTime } from "@johnmorrisdotca/narabe";
Definition
function winOnTime(state: GameState, loser: Stone): GameState
Parameters
| Name | Type | Description |
|---|---|---|
state | GameState | The current immutable game position. |
loser | Stone | The colour that resigned or ran out of time. |
Returns
GameState
The resulting position; a refused or inapplicable action leaves the input position unchanged.
Examples
import { createGame, winOnTime } from "@johnmorrisdotca/narabe";
const state = createGame({variant:"freestyle",size:15});
console.log(winOnTime(state,"black").winner);whiteWhat it prints (run when this page was built)