Reference · Rules, tiles and records
moveOnTablefunction
A tile on the table to another square: to an empty one it moves, onto a tile the two change places.
Import it
import { moveOnTable } from "@johnmorrisdotca/kumimoji";
Definition
function moveOnTable(play: TilePlay, from: string, to: string): TilePlay
Parameters
| Name | Type | Description |
|---|---|---|
play | TilePlay | The current immutable solo-game progress. |
from | string | The source square or seat index. |
to | string | The destination square. |
Returns
TilePlay
A tile on the table to another square: to an empty one it moves, onto a tile the two change places.
Examples
import { deal, moveOnTable, placeFromHand } from "@johnmorrisdotca/kumimoji";
const tiles = new Map([["0,0","c"],["0,1","a"],["0,2","t"]]);
const laid = placeFromHand(deal("catdog",3),0,"0,0");
console.log(moveOnTable(laid,"0,0","1,0").tiles);Map(1) { '1,0' => 'c' }What it prints (run when this page was built)