GameSettingstype
Native rule, layout, opening, handicap and optional action settings.
Import it
import type { GameSettings } from "@johnmorrisdotca/narabe";
Definition
type GameSettings = {
size: number;
winLength: number;
variant: RuleVariant;
opening: OpeningRule;
handicap: Handicap;
headStart: HeadStart;
seed: number;
capturesToWin: number;
firstPlayer: FirstPlayer;
obstacles: ObstacleLayout;
openingDiscs?: StartingDiscs;
allowUndo: boolean;
allowSkip: boolean;
allowSwap: boolean;
swapsPerSeat: number;
allowResize: boolean;
drawLimit: DrawLimit;
};
Members
| Name | Type | Description |
|---|---|---|
size | number | Board is |
winLength | number | Stones in a line needed to win. |
variant | RuleVariant | |
opening | OpeningRule | |
handicap | Handicap | |
headStart | HeadStart | A start for one colour, see HeadStart. |
seed | number | The random seed the game was created with: it places dead and hot squares and draws the piece queues, so a stored game reproduces them. |
capturesToWin | number | Pairs a colour must capture to win, in the variants that capture. |
firstPlayer | FirstPlayer | |
obstacles | ObstacleLayout | |
openingDiscs (optional) | StartingDiscs | undefined | In the flipping games, whether the centre four discs start placed or are laid by the players. Absent, the game's own rule applies. |
allowUndo | boolean | Taking a move back. Off by default in the stricter variants. |
allowSkip | boolean | Burning a turn on a corner stone rather than playing where it matters. |
allowSwap | boolean | Trading seats with the opponent. |
swapsPerSeat | number | |
allowResize | boolean | Letting the board change size mid-game, re-centring the stones: up when a game has run out of room, down when it is dragging and the outer ring is unused. Both directions need the other player to agree. |
drawLimit | DrawLimit | Calling a long game a draw. |
Examples
import type { GameSettings } from "@johnmorrisdotca/narabe";
import { createGame } from "@johnmorrisdotca/narabe";
const value: GameSettings = createGame({variant:"go",size:9}).settings;
console.log(value);{
size: 9,
winLength: 5,
variant: 'go',
opening: 'free',
handicap: {
stone: null,
doubleThree: false,
doubleFour: false,
overline: false,
exactLine: false,
openLine: false,
longerLine: false,
singleStone: false,
noCaptures: false,
secondStoneExclusion: 0
},
headStart: { stone: null, freeTurns: 0, traditional: 0 },
seed: 0,
capturesToWin: 10,
firstPlayer: 'black',
obstacles: 'none',
allowUndo: true,
allowSkip: false,
allowSwap: false,
allowResize: false,
swapsPerSeat: 1,
drawLimit: 'none'
}What it prints (run when this page was built)