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

import { … } from "@johnmorrisdotca/jarajara/table";

4.7 kB minified and gzipped, with everything it imports (measured with esbuild)

Awase at a table, for two to four: one layout, turns taken, each pair scoring (the plain suits one, ones and nines two, a wind three, a dragon four, a flower or season two and another turn), most points wins. With a computer player for any seat.

Exports

NameKindWhat it is
AWASE_TABLEconstantTHE RULES AT THE TABLE.
AwaseSeattypeWho sits in a seat: a name typed on the device, or a computer.
AwaseTabletypeA GAME AT THE TABLE, as it is kept: the deal, who sits where, and every pair taken, in order.
AwaseTableStatetypeWhere a game at the table stands, read from its pairs.
AwaseTaketypeOne pair taken, as the table remembers it.
computerPairfunctionThe pair a computer in the seat to move takes, or null when there is nothing to take.
decodeTablefunctionA kept table read back, its shape checked and every pair played again; null for anything that is not one.
encodeTablefunctionAs kept in the browser: the table as JSON, its takes as slot pairs.
isComputerSeatfunctionWhether a computer plays this seat.
playAtTablefunctionThe player to move takes this pair: the table and where it now stands, or null where the rules do not allow it.
readTablefunctionWHERE THE GAME STANDS, played again from its pairs: null for a deal that is not one, or a pair the rules would not have allowed.
SEAT_WINDSconstantThe four seats' winds, east first, as a mahjong table seats its players.
seatNamefunctionWhat a seat is called: its name, "Computer 2", or its wind.
startTablefunctionA new game at the table: the deal made from the seed, these seats, and nothing taken.
tablePairsfunctionThe pairs the player to move may take: none once the game is over.
tablePlayersAskedfunctionA players count from an address, or 1 (the solitaire) for anything that is not two to four.
takeAtTablefunctionThe table after the player to move takes this pair, or null where the rules do not allow it.
tidySeatNamefunctionA name as kept: trimmed, one line, and no longer than a line holds.
undoAtTablefunctionThe table with its last pair given back: the undo a table agrees to.

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