Reference · Tiles, layouts and deals
arrangeIndexesfunction
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. Every sort is stable, so equal tiles stay as they were. suit is the set's own order (characters,
circles, bamboo, winds, dragons, flowers, seasons, each by rank); rank puts every one together, then every two,
and so on, within each rank by suit, the honours after; kind groups numbers, honours and bonus tiles and puts each
in suit order; code is the letters' own order; dealt is the list as it was.
Import it
import { arrangeIndexes } from "@johnmorrisdotca/jarajara";
Definition
function arrangeIndexes(codes: readonly string[], order?: TileOrder): number[]
Parameters
| Name | Type | Description |
|---|---|---|
codes | readonly string[] | The tile face codes in current order. |
order (optional) | TileOrder | The native tile sorting mode. |
Returns
number[]
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. Every sort is stable, so equal tiles stay as they were. suit is the set's own order (characters, circles, bamboo, winds, dragons, flowers, seasons, each by rank); rank puts every one together, then every two, and so on, within each rank by suit, the honours after; kind groups numbers, honours and bonus tiles and puts each in suit order; code is the letters' own order; dealt is the list as it was.
Examples
import { arrangeIndexes } from "@johnmorrisdotca/jarajara";
console.log(arrangeIndexes(["F","a","b"],"suit"));[ 1, 2, 0 ]What it prints (run when this page was built)