dealRoundfunction
Deals the cards one at a time round the table, from the first seat, as a
dealer does: each to a seat, or every card when each is absent (so some
seats hold one more than others). What is not dealt is the stock, in order,
its top card first.
Import it
import { dealRound } from "@johnmorrisdotca/toranpu";
Definition
function dealRound(deck: readonly CardId[], seats: number, each?: number): { hands: CardId[][]; stock: CardId[]; }
Parameters
| Name | Type | Description |
|---|---|---|
deck | readonly string[] | The deck in its current order; the input is left unchanged. |
seats | number | The seat count or seat state supplied by this API. |
each (optional) | number | undefined | The number of cards dealt to each hand. |
Returns
{ hands: CardId[][]; stock: CardId[]; }
Deals the cards one at a time round the table, from the first seat, as a dealer does: each to a seat, or every card when each is absent (so some seats hold one more than others). What is not dealt is the stock, in order, its top card first.
Examples
import { FULL_DECK, dealRound } from "@johnmorrisdotca/toranpu";
console.log(dealRound(FULL_DECK, 4, 5).hands.map((hand) => hand.length));[ 5, 5, 5, 5 ]What it prints (run when this page was built)