Skip to the content

Jarajaraジャラジャラ

Draw mahjong tiles, arrange racks and stacked boards, and play seeded Awase alone or at a shared table.

Jarajara is the Japanese sound of mahjong tiles rattling together. About the name

Contents

Reference · Awase solitaire

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

NameTypeDescription
sizenumber
seednumber
givensstring
rulesAwaseRules
movesreadonly MahjongMove[]

Every move so far, in order: pairs by their slots, and shuffles.

cellsstring
shufflesnumber
hintsUsednumber
pairsnumber

Pairs taken, points scored, and how many pairs in a row were quick enough to build a combo.

scorenumber
combonumber
lastPairAtnumber | null
banknumber | null

The time held and when it was last counted: null before the clock starts, and for a game with no clock.

bankAtnumber | null
goldstring | null

The gold face; the group a purge names; the spark face now.

purge"characters" | "circles" | "bamboo" | "honours" | null
sparkstring | null
historyreadonly Snapshot[]
over"won" | "lost" | null

Won or lost, once it is; and why: cleared, goal, gold, purged, time or stuck.

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)

View sourceEdit on GitHubMade from the source of @johnmorrisdotca/jarajara 1.7.0.