AwaseRuntype
A game of Awase, and what the challenge it is played as asks of it.
Import it
import type { AwaseRun } from "@johnmorrisdotca/jarajara/awase";
Definition
type AwaseRun = {
readonly size: number;
readonly seed: number;
readonly givens: string;
readonly rules: AwaseRules;
readonly moves: readonly MahjongMove[];
readonly cells: MahjongCells;
readonly shuffles: number;
readonly hintsUsed: number;
readonly pairs: number;
readonly score: number;
readonly combo: number;
readonly lastPairAt: number | null;
readonly bank: number | null;
readonly bankAt: number | null;
readonly gold: string | null;
readonly purge: (typeof PURGE_GROUPS)[number]["key"] | null;
readonly spark: string | null;
readonly history: readonly Snapshot[];
readonly over: "won" | "lost" | null;
readonly because: "cleared" | "goal" | "gold" | "purged" | "time" | "stuck" | null;
};
Members
| Name | Type | Description |
|---|---|---|
size | number | |
seed | number | |
givens | string | |
rules | AwaseRules | |
moves | readonly MahjongMove[] | Every move so far, in order: pairs by their slots, and shuffles. |
cells | string | |
shuffles | number | |
hintsUsed | number | |
pairs | number | Pairs taken, points scored, and how many pairs in a row were quick enough to build a combo. |
score | number | |
combo | number | |
lastPairAt | number | null | |
bank | number | null | The time held and when it was last counted: null before the clock starts, and for a game with no clock. |
bankAt | number | null | |
gold | string | null | The gold face; the group a purge names; the spark face now. |
purge | "characters" | "circles" | "bamboo" | "honours" | null | |
spark | string | null | |
history | readonly Snapshot[] | |
over | "won" | "lost" | null | Won or lost, once it is; and why: |
because | "gold" | "cleared" | "goal" | "purged" | "time" | "stuck" | null |
Examples
import { generateAwase, startRun } from "@johnmorrisdotca/jarajara/awase";
import type { AwaseRun } from "@johnmorrisdotca/jarajara/awase";
const deal = generateAwase(4,"easy",2026);
const run = startRun(deal,{},0);
const value: AwaseRun = run;
console.log(value);{
size: 4,
seed: 2026,
givens: 'xPNxDBBD',
rules: {
challenge: null,
hints: null,
shuffles: null,
undo: true,
timeMs: null,
reserveMs: null,
pairBonusMs: 0,
sparkBonusMs: 0,
comboBonusMs: 0,
goalPairs: null,
goalScore: null,
hideBlocked: false
},
moves: [],
cells: 'xPNxDBBD',
shuffles: 0,
hintsUsed: 0,
pairs: 0,
score: 0,
combo: 0,
lastPairAt: null,
bank: null,
bankAt: null,
gold: null,
purge: null,
spark: null,
history: [],
over: null,
because: null
}What it prints (run when this page was built)