本文へ移動

Jarajaraジャラジャラ

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

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

目次

リファレンス · 牌・配置・配り方

layPairs関数

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

Lay these pairs of tiles into the slots present names, or null when no attempt reached the end. Higher slots are a little likelier to be taken first, which keeps the stacks coming down together and leaves fewer attempts stuck on a tower of two.

インポート

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

定義

function layPairs(geometry: MahjongGeometry, present: readonly boolean[], pairs: readonly (readonly [string, string])[], random: Random): Laid | null

引数

名前型説明
geometryMahjongGeometry

The stacked layout’s covering and side-blocking relationships.

presentreadonly boolean[]

Whether each native slot is still occupied or selected for laying.

pairsreadonly (readonly [string, string])[]

Matching tile-face pairs to lay into slots.

randomRandom

A reproducible random source returning values in [0,1).

戻り値

Laid | null

Lay these pairs of tiles into the slots present names, or null when no attempt reached the end. Higher slots are a little likelier to be taken first, which keeps the stacks coming down together and leaves fewer attempts stuck on a tower of two.

例

import { generateAwase } from "@johnmorrisdotca/jarajara/awase";
import { geometryOf, layPairs, layoutFor, pairsLeft, seededRandom } from "@johnmorrisdotca/jarajara";

const deal = generateAwase(4,"easy",2026);
const layout = layoutFor(4)!;
const geometry = geometryOf(layout);
const cells = deal.givens;
console.log(layPairs(geometry,layout.slots.map(()=>true),pairsLeft(cells,"group"),seededRandom(42))?.order.length);
4

出力(このページを作ったときに実行した結果)

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

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