playStackUpfunction
The game after a move, or null for a move the rules refuse. A card played from the last of a hand draws five more; the last card of a stock ends the game; a building pile of twelve is set aside.
Import it
import { playStackUp } from "@johnmorrisdotca/toranpu/stack-up";
Definition
function playStackUp(game: StackUpGame, move: StackUpMove): StackUpGame | null
Parameters
| Name | Type | Description |
|---|---|---|
game | StackUpGame | The current native game; applying a move returns a new state. |
move | StackUpMove | The move to apply. |
Returns
StackUpGame | null
The game after a move, or null for a move the rules refuse.
Examples
import { playStackUp, stackUpMoves, startStackUp } from "@johnmorrisdotca/toranpu/stack-up";
const game = startStackUp(15, ["Aki", "Ben"], undefined, 42)!;
console.log(playStackUp(game, stackUpMoves(game)[0]!)?.moves.length);1What it prints (run when this page was built)