Reference · Rules, tiles and records
leavePartyfunction
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 it
import { leaveParty } from "@johnmorrisdotca/kumimoji";
Definition
function leaveParty(game: PartyGame, at: number): PartyGame
Parameters
| Name | Type | Description |
|---|---|---|
game | PartyGame | The current immutable shared-bag party game. |
at | number | The word offset, seat index or date specified by this signature. |
Returns
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.
Examples
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);1What it prints (run when this page was built)