spadesComputerfunction
The move a computer in the seat to play makes: always one the rules allow.
Import it
import { spadesComputer } from "@johnmorrisdotca/toranpu/spades";
Definition
function spadesComputer(game: SpadesGame): SpadesMove
Parameters
| Name | Type | Description |
|---|---|---|
game | SpadesGame | The current native game; applying a move returns a new state. |
Returns
SpadesMove
The move a computer in the seat to play makes: always one the rules allow.
Examples
import { CARD_GAME_TABLES, newGame } from "@johnmorrisdotca/toranpu";
import { spadesComputer } from "@johnmorrisdotca/toranpu/spades";
const names = Array.from({ length: CARD_GAME_TABLES.spades.defaultPlayers }, (_, seat) => `Seat ${seat + 1}`);
let game = newGame("spades", { players: names, seed: 42 })!;
console.log(spadesComputer(game));{ bid: 3 }What it prints (run when this page was built)