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 · Shared Awase table

AwaseTableStatetype

Where a game at the table stands, read from its pairs.

Import it

import type { AwaseTableState } from "@johnmorrisdotca/jarajara/table";

Definition

type AwaseTableState = {
    cells: string;
    turn: number;
    scores: number[];
    pairs: number[];
    taken: AwaseTake[];
    shuffles: number;
    shuffledAfter: number | null;
    over: boolean;
    winners: number[];
};

Members

NameTypeDescription
cellsstring

The tiles as they lie now.

turnnumber

The seat to move; meaningless once over.

scoresnumber[]

Points, and pairs taken, seat by seat.

pairsnumber[]
takenAwaseTake[]
shufflesnumber

How many times the table ran out of pairs and the tiles were shuffled; and after which take the last was.

shuffledAfternumber | null
overboolean

Over: every tile taken, or the tiles left could not be freed by any shuffle.

winnersnumber[]

The seats with the most points, once it is over: one, or several sharing it.

Examples

import { generateAwase } from "@johnmorrisdotca/jarajara/awase";
import { readTable, startTable } from "@johnmorrisdotca/jarajara/table";
import type { AwaseTableState } from "@johnmorrisdotca/jarajara/table";

const deal = generateAwase(4,"easy",2026);
const table = startTable(deal,[{name:"Seat 1"},{name:"Seat 2"}]);
const state = readTable(table)!;
const value: AwaseTableState = state;
console.log(value);
{
  cells: 'xPNxDBBD',
  turn: 0,
  scores: [ 0, 0 ],
  pairs: [ 0, 0 ],
  taken: [],
  shuffles: 0,
  shuffledAfter: null,
  over: false,
  winners: []
}

What it prints (run when this page was built)

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