Reference · Tiles, layouts and deals
setPairsfunction
EVERY PAIR THE SET HOLDS, 72 of them: each ordinary face twice (four
copies), and the eight bonus tiles as four pairs — two flowers and two
seasons, split at random under the usual rule, or four faces drawn twice
each under the Identical rule. random decides the splits; the order is the
set's, and the deal shuffles it.
sets is how many sets a mega layout is dealt (2 for 288 tiles, 4 for 576), 1 unless said, and a deal of one set is
exactly what it has always been. More sets are each set's pairs again, with one difference under the usual rule: a
flower or a season is dealt once, since a deal that held one twice would be read as the Identical rule
(bonusRuleOf). The bonus pairs a further set would have held are four more pairs of ordinary faces, drawn at
random, so the tile count is the same.
Import it
import { setPairs } from "@johnmorrisdotca/jarajara";
Definition
function setPairs(rule: MahjongBonusRule, random: () => number, sets?: number): [string, string][]
Parameters
| Name | Type | Description |
|---|---|---|
rule | MahjongBonusRule | Grouped or identical bonus matching. |
random | () => number | A reproducible random source returning values in [0,1). |
sets (optional) | number | The number of complete physical tile sets. |
Returns
[string, string][]
EVERY PAIR THE SET HOLDS, 72 of them: each ordinary face twice (four copies), and the eight bonus tiles as four pairs — two flowers and two seasons, split at random under the usual rule, or four faces drawn twice each under the Identical rule. random decides the splits; the order is the set's, and the deal shuffles it.
Examples
import { seededRandom, setPairs } from "@johnmorrisdotca/jarajara";
console.log(setPairs("group",seededRandom(42)).length);72What it prints (run when this page was built)