leaveParty関数
リファレンスの説明と例は英語です。見出しと目次は日本語です。
A PLAYER LEAVES. Their tiles go back into the bag and the bag is shuffled — with the game's own seed and how far it has gone, so the same game left the same way deals the same tiles after a reload. A wild goes back blank.
The bag is kept as a line whose first taken tiles are the ones held, less
what was traded back (holdsItsBag); after a leave it is written afresh as
exactly that: the tiles everybody still holds, then the shuffled rest, with
nothing traded back. Every seat after the leaver's moves up one, and the
unnamed players keep the names they were shown ("Player 3" stays Player 3).
If it was their turn, the turn passes to the next still in, or in the last round to the next still to have their last turn; a last round with nobody left to play ends. With nobody still in — everybody left has resigned — the game ends tied between them.
インポート
import { leaveParty } from "@johnmorrisdotca/kumimoji";
定義
function leaveParty(game: PartyGame, at: number): PartyGame
引数
| 名前 | 型 | 説明 |
|---|---|---|
game | PartyGame | The current immutable shared-bag party game. |
at | number | The word offset, seat index or date specified by this signature. |
戻り値
PartyGame
A PLAYER LEAVES. Their tiles go back into the bag and the bag is shuffled — with the game's own seed and how far it has gone, so the same game left the same way deals the same tiles after a reload. A wild goes back blank.
例
import { leaveParty, startParty } from "@johnmorrisdotca/kumimoji";
const settings = {size:3,level:"hard",seed:44,gameLength:"short",language:"english",doubleSet:false,diagonals:false,hints:false} as const;
const bag = "catdogsun";
const game = startParty(settings,bag,["Seat 1","Seat 2"]);
console.log(leaveParty(game,0).players.length);1出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。