VariantSpec型
リファレンスの説明と例は英語です。見出しと目次は日本語です。
A native variant’s checker counts, starting layout, dice, directions, opening and winning goal.
インポート
import type { VariantSpec } from "@johnmorrisdotca/sugoroku";
定義
type VariantSpec = {
readonly key: VariantKey;
readonly checkers: number;
readonly layout: readonly (readonly [
number,
number
])[];
readonly dice: 2 | 3;
readonly doubles: "four" | "none";
readonly direction: Direction;
readonly opening: Opening;
readonly goal: Goal;
readonly holdBelow: number;
readonly drawAfter: number;
};
メンバー
| 名前 | 型 | 説明 |
|---|---|---|
key | VariantKey | |
checkers | number | Checkers each side has. |
layout | readonly (readonly [number, number])[] | Where the checkers are at the start, as |
dice | 2 | 3 | How many dice a roll is: two, or three for Tabula. |
doubles | "four" | "none" | Whether doubles are played four times ( |
direction | Direction | |
opening | Opening | |
goal | Goal | |
holdBelow | number | While any checker is still to enter the board, no checker may land on this own point or any below it. 0 for no such rule. Tabula holds every checker in the first half until all fifteen are in. |
drawAfter | number | A game that reaches this many turns for each side is a draw. 0 for no limit. |
例
import { settingsFor } from "@johnmorrisdotca/sugoroku";
import type { VariantSpec } from "@johnmorrisdotca/sugoroku";
const settings = settingsFor("backgammon",{points:5,cube:true});
const spec = settings.variant;
const value: VariantSpec = spec;
console.log(value);{
checkers: 15,
dice: 2,
doubles: 'four',
direction: 'opposed',
opening: 'roll-off',
goal: 'first-off',
holdBelow: 0,
drawAfter: 0,
key: 'backgammon',
layout: [ [ 24, 2 ], [ 13, 5 ], [ 8, 3 ], [ 6, 5 ] ]
}出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。