Reference · Rules, games and records
resolveRulesfunction
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 it
import { resolveRules } from "@johnmorrisdotca/sugoroku";
Definition
function resolveRules(rules?: Partial<Rules>, variant?: VariantSpec): Rules
Parameters
| Name | Type | Description |
|---|---|---|
rules (optional) | Partial<Rules> | The complete or partial native rules specified by the signature. |
variant (optional) | VariantSpec | undefined | The variant key or resolved specification. |
Returns
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.
Examples
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
}What it prints (run when this page was built)