resignfunction
Gives the game up. The other colour wins at once, with no line to show; the record keeps the moves as they were and says why it ended. A finished game cannot be resigned — there is nothing left to give.
Import it
import { resign } from "@johnmorrisdotca/narabe";
Definition
function resign(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, resign } from "@johnmorrisdotca/narabe";
const state = createGame({variant:"freestyle",size:15});
console.log(resign(state,"black").winner);whiteWhat it prints (run when this page was built)