Reference · Rules, tiles and records
TilePlaytype
A KUMIMOJI BEING PLAYED: the bag, the tiles traded back into it, how many
have been taken out, the tiles on the table and the hand. Every move is a
function that returns a new state and leaves the one it was given alone,
the way the engine's moves are. Nothing here knows how the table is being
looked at — zoom and pan are the view's (tableView.ts), never the game's.
THE BAG IS A LINE, not a heap. Its tiles come out in the order the seed dealt
them (givens), and a tile traded back joins the END of the line, so the
tiles still to come are always bag + returned from taken on. That keeps
a game the same for everybody at a seed, trades and all, and lets a kept
game be checked: what is held — hand and table — is exactly what was taken,
less what was given back.
Import it
import type { TilePlay } from "@johnmorrisdotca/kumimoji";
Definition
type TilePlay = {
bag: string;
returned: string;
taken: number;
tiles: Tiles;
hand: readonly string[];
};
Members
| Name | Type | Description |
|---|---|---|
bag | string | The tiles in the order they come out: the puzzle's givens. |
returned | string | Tiles traded back, in order; they come out after the bag. |
taken | number | How many tiles have been taken from |
tiles | Tiles | The tiles on the table, by square ("row,col"). |
hand | readonly string[] | The hand, in the order the player keeps it. |
Examples
import { deal } from "@johnmorrisdotca/kumimoji";
import type { TilePlay } from "@johnmorrisdotca/kumimoji";
const play = deal("catdog",3);
const value: TilePlay = play;
console.log(value);{
bag: 'catdog',
returned: '',
taken: 3,
tiles: Map(0) {},
hand: [ 'c', 'a', 't' ]
}What it prints (run when this page was built)