resolveRules関数
リファレンスの説明と例は英語です。見出しと目次は日本語です。
The rules with anything left out filled from DEFAULT_RULES. Throws if the result is not a set of rules that can be played.
インポート
import { resolveRules } from "@johnmorrisdotca/sugoroku";
定義
function resolveRules(rules?: Partial<Rules>, variant?: VariantSpec): Rules
引数
| 名前 | 型 | 説明 |
|---|---|---|
rules (省略可) | Partial<Rules> | The complete or partial native rules specified by the signature. |
variant (省略可) | VariantSpec | undefined | The variant key or resolved specification. |
戻り値
Rules
The rules with anything left out filled from DEFAULT_RULES. Throws if the result is not a set of rules that can be played.
例
import { resolveRules, settingsFor } from "@johnmorrisdotca/sugoroku";
const settings = settingsFor("backgammon",{points:5,cube:true});
const spec = settings.variant;
console.log(resolveRules({points:5,cube:true},spec));{
points: 5,
cube: true,
crawford: true,
jacoby: false,
beaver: false,
gammons: false
}出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。