本文へ移動

Jarajaraジャラジャラ

麻雀牌を描き、手牌や積み重ねた盤を配置し、シード付きの「合わせ」をひとりでも対戦卓でも遊べます。

「ジャラジャラ」は麻雀牌が触れ合う音を表す言葉です。 名前について(英語)

目次

リファレンス

牌・配置・配り方

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

最小化と gzip 圧縮をしたサイズは 7.9 kB(読み込むものをすべて含み、esbuild で計測)

リファレンスの説明と例は英語です。見出しと目次は日本語です。

Jarajara: mahjong tiles for JavaScript and TypeScript. The full set of 144 tiles in 42 faces, the stacked layouts tile games are played on, which tiles are free, matching, dealing, shuffling and a game written as text. The games are their own entries: @johnmorrisdotca/jarajara/awase (the matching solitaire) and @johnmorrisdotca/jarajara/table (Awase for two to four, pairs that score).

エクスポート

名前種類概要
ALL_LAYOUTS定数Every layout there is: the five above, which itsutsu.com's kept games are made on and which never change, then Jarajara's own more (layouts-more.ts), each of a width none of the others has.
arrangeIndexes関数The places the tiles take in an order, as the numbers of the tiles in the order they come: [2, 0, 1] has the third tile first.
arrangeTiles関数The tiles in an order, as a new list; see arrangeIndexes for what each order is.
AwaseCheck型What a check of a finished game says: cleared, or the first reason it is not.
AwaseDeal型A deal of Awase: its layout's size, its level and seed, the tiles where they lie, and one way to clear them.
AwaseLevel型How hard a deal of Awase is: the easiest of a seed's candidate deals to clear, the middle one, or the hardest.
blockedBy関数Why a tile cannot be taken now: covered by a tile on it, or held on both sides.
bonusRuleOf関数The deal's rule, read from the deal itself: a bonus tile dealt twice can only be the Identical rule, since the usual one deals each flower and season once.
canTake関数Whether these two slots are a pair that may be taken now.
copiesOf関数How many of a face the set holds: four of every ordinary face, one of each flower and season.
countTiles関数How many of each face a list of tiles holds, by code; faces it holds none of are left out.
dealFits関数Whether a deal is written right for a layout: one face a slot, nothing empty.
decodeMoves関数The moves a string holds, each slot below slots; null for anything else.
describeSlot関数Where a slot is, in tiles: across and down from the layout's corner (halves where a tile sits between two), and which layer, from 1.
EMPTY_SLOT定数The cell marker for a tile already removed from the layout.
encodeMoves関数Write pair takes and shuffles as the native compact move record.
faceOf関数The face a letter stands for, or null for anything that is not one.
faceWords関数What a face is called, in English: "3 of characters", "east wind", "red dragon", "plum (flower)".
faceWordsJa関数What a face is called in Japanese: 三萬, 五筒, 七索, 東, 中, 梅, 春.
findFace関数The tile a text names, or null.
findFaces関数Every tile a text names: the one face findFace finds, or, for the name of a group (winds, honours, circles), all of its faces.
freePairs関数Every pair that could be taken now, each once, lower slot first, in slot order.
freeSlots関数Every free tile, by slot.
geometryOf関数What lies on and beside each slot, worked out once for a layout and kept.
groupFaces関数The faces of a group, in the set's order.
groupStarts関数The places in a list, already in order, where a new group starts: every place whose tile is of another suit (or kind) than the one before it.
groupTiles関数The tiles split into the runs a gap is drawn between: by suit or by kind, each run in the set's order.
groupWords関数What a group is called, in English and in Japanese.
hashText関数A 32-bit FNV-1a hash of a string: the seed a shuffle is drawn from, so the same tiles shuffled the same time come out the same.
Hint型A hint: the pair to show (the chosen tile first, for a match) and what kind of answer it is.
hintFor関数A HINT, WHICH LOOKS FIRST FOR THE CHOSEN TILE'S MATCH.
HintKind型What a hint found: a pair with the chosen tile in it (match), another pair because the chosen tile has no free match (other), a pair when no tile was chosen (any), or no pair at all (none).
isBonus関数A flower or a season: one of a kind in the set, and matched by its group under the usual rule.
isCleared関数Whether every tile has been taken.
isFaceCode関数Whether a single character names a supported tile face.
isFree関数Whether the tile in this slot is free.
isFreeAmong関数Whether a slot's tile could be taken now, among the slots present says are still filled.
isNotation関数Whether a text is written as hand notation, 123m456p: nothing but digit runs each closed by a suit letter.
isTileGroup関数Whether a text names a group.
kindOf関数The kind of a tile: 0 numbers (characters, circles, bamboo), 1 honours (winds, dragons), 2 bonus tiles (flowers, seasons); 3 for a letter that is none.
Laid型A deal laid out and the order it can be cleared in, pair by pair.
layoutExtent関数The layout's extent in half units: how far right and down its tiles reach, and how many layers.
layoutFor関数The layout a size names, or null for one there is not.
layPairs関数Lay these pairs of tiles into the slots present names, or null when no attempt reached the end.
MAHJONG_FACES定数The forty-two tile faces in stable code order, including bonus tiles.
MAHJONG_LAYOUTS定数The built-in native layouts in supported size order.
MahjongBonusRule型How a flower or a season matches.
MahjongCells型The tiles as they lie: a face code for each slot of the layout, "." where the tile has been taken.
MahjongFace型One face of the set: its suit and its rank within it (1–9 for a suit, 1–4 or 1–3 for the rest).
MahjongGeometry型What stands on and beside each slot, worked out once per layout: the slots over it (any higher layer overlapping it), and the slots touching its left and right sides on its own layer.
MahjongLayout型A stacked layout: its slots in reading order (layer by layer, row by row), which is the order a deal is written in.
MahjongMove型One move of a solve: a pair taken, by its two slots, or a shuffle of what is left.
MahjongSlot型A place in a layout: a tile's top-left corner in half-tile units across and down, and its layer.
MahjongSuit型The suits and honours of a mahjong set, and the two kinds of bonus tile.
matchClass関数THE MATCHING RULE.
matchesOf関数EVERY TILE THAT MATCHES A SLOT'S, under the bonus rule in play, told apart by whether it could be taken with it now.
MatchesOf型Which tile Find would show for a slot: the ones that could be taken with it now, and the ones that match but are held.
MEGA_LAYOUTS定数The large native stacked layouts and their supported size identifiers.
mixTiles関数The same tiles in another order, at random, or the same order for the same seed; never the order they were in unless there is only one to be in.
MORE_LAYOUTS定数The additional native stacked layouts and their supported size identifiers.
overlapsOnLayer関数Whether two slots of one layer overlap, which no layout may have: a tile cannot share a place.
pairGoesAgain関数Whether taking this pair gives its taker another turn at the table: a flower or season pair.
pairPoints関数WHAT A PAIR IS WORTH AT THE TABLE (table.ts): the plain suit tiles one, the ones and nines two, the winds three and the dragons four — the honours and terminals are the tiles a mahjong hand prizes — and a flower or season pair two, with another turn, as a bonus tile draws again in the full game.
pairsLeft関数The tiles left on a layout as pairs that match, each pair's tiles together: what a shuffle lays again.
playSolve関数PLAY THE MOVES ON THE DEAL, refusing the first that the rules do not allow: a pair that is not two free tiles that match, or a shuffle while a pair could still be taken (Shuffle is for when you are stuck), or one that cannot help.
Random型A number in [0, 1), like Math.random, from a stream a seed fixes.
readNotation関数The tiles a hand's notation writes, as codes in the order written; null when the text is not notation or names a tile there is not (8z).
readSlotKeys関数The keys a text names, "z y x", "x,-z", in order; anything that is no axis is dropped.
readTiles関数A LIST OF TILES AS TEXT, read the forgiving way: each word is a tile's name (east, red-dragon, 3p) or a run of one-letter codes (abcF), and hand notation (123m456p) is read as it is written.
Replayed型Where a solve stands after its moves: the tiles, and how many shuffles it has had.
seededRandom関数A stream of numbers in [0, 1) fixed by a seed.
setInventory関数The whole set as an inventory: each of the 42 faces and how many of it the 144 tiles hold.
setPairs関数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.
SHUFFLE_MARK定数A SOLVE AS IT IS WRITTEN: every move in order, a pair as its two slots in two base-36 characters each ("0a1c"), a shuffle as "*".
shuffled関数A copy of the list in a random order (Fisher–Yates); the list given is left alone.
shuffleTiles関数SHUFFLE: the tiles left, laid again in the slots they fill, so that play can go on.
SlotAxis型What a layout's slots are put in order by: where a tile is across (x), down (y), and how high (z).
SlotSortKey型One key of a sort: an axis, and - before it for the other way round (-z, the highest first).
sortSlots関数The slots of a layout, as their numbers, put in order by the keys: ["z", "y", "x"] is layer by layer, row by row, across (the layout's own order), ["x"] lines them up from the left, ["-z"] has the top of the stacks first.
SUIT_WORDS定数What a suit or group is called, in English and in Japanese.
takePair関数The tiles with a pair taken.
TILE_GROUPS定数THE GROUPS A SET FALLS INTO, for a viewer: each suit, and the bigger families people name them by: honours (winds and dragons), bonus (flowers and seasons), the numbers (the three suits), and the terminals (the ones and nines) and simples (two to eight) a hand is judged by.
TILE_ORDERS定数The orders, in the order a list offers them.
TileGroup型A group's name.
TileGrouping型How tiles are grouped, with a gap between groups: by suit (circles with circles), or by kind (numbers, honours, bonus tiles).
TileLanguage型The two languages a tile is named in.
tileName関数A tile's name in a language, from its code; the code itself for a letter that is no face.
TileOrder型How a hand is put in order: as dealt, by suit then rank, by rank across the suits, by kind, or by the letters.
tilesLeft関数How many tiles are still on the layout.
tilesMatch関数Whether two tile face codes match under the selected bonus rule.
VERSION定数The package's version.
writeNotation関数Tiles written the way hands are: digits then a suit letter, 123m456p789s1112z.
writeTiles関数Tiles as their one-letter codes run together, abcF: what readTiles reads and a layout's cells are written in.

ソースを見るGitHub で編集@johnmorrisdotca/jarajara 1.7.0 のソースから作成しました。

この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。