swapWithHand関数
リファレンスの説明と例は英語です。見出しと目次は日本語です。
A tile from the hand onto a square that holds one: they change places, the table's tile going to the hand where the other was.
インポート
import { swapWithHand } from "@johnmorrisdotca/kumimoji";
定義
function swapWithHand(play: TilePlay, handAt: number, square: string): TilePlay
引数
| 名前 | 型 | 説明 |
|---|---|---|
play | TilePlay | The current immutable solo-game progress. |
handAt | number | The zero-based index of a tile in hand. |
square | string | The row,column square name. |
戻り値
TilePlay
A tile from the hand onto a square that holds one: they change places, the table's tile going to the hand where the other was.
例
import { deal, placeFromHand, swapWithHand } from "@johnmorrisdotca/kumimoji";
const laid = placeFromHand(deal("catdog",3),0,"0,0");
console.log(swapWithHand(laid,0,"0,0").hand);[ 'c', 't' ]出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。