dealAllfunction
Deal the whole deck round the table: the first hands get one more where it does not divide evenly.
Import it
import { dealAll } from "@johnmorrisdotca/toranpu/deck";
Definition
function dealAll(deck: readonly Card[], hands: number): Card[][]
Parameters
| Name | Type | Description |
|---|---|---|
deck | readonly Card[] | The deck in its current order; the input is left unchanged. |
hands | number | The hands by seat, or the number of hands where numeric. |
Returns
Card[][]
Deal the whole deck round the table: the first hands get one more where it does not divide evenly.
Examples
import { dealAll, shuffledDeck } from "@johnmorrisdotca/toranpu/deck";
console.log(dealAll(shuffledDeck(42), 4).map((hand) => hand.length));[ 13, 13, 13, 13 ]What it prints (run when this page was built)