playComputersfunction
Every computer move due, played in turn until a person is to move or the game is over. Returns the game and the moves the computers made, in order, so a table can show them one at a time.
Import it
import { playComputers } from "@johnmorrisdotca/toranpu";
Definition
function playComputers<K extends CardGameKind>(kind: K, game: GameOf<K>): { game: GameOf<K>; moves: MoveOf<K>[]; }
Parameters
| Name | Type | Description |
|---|---|---|
kind | K | The named card game or sound kind. |
game | GameOf<K> | The current native game; applying a move returns a new state. |
Returns
{ game: GameOf<K>; moves: MoveOf<K>[]; }
Every computer move due, played in turn until a person is to move or the game is over. Returns the game and the moves the computers made, in order, so a table can show them one at a time.
Examples
import { newGame, playComputers } from "@johnmorrisdotca/toranpu";
const game = newGame("hearts", { players: ["Aki", "Ben", "Cy", "Dev"], seed: 42 })!;
console.log(playComputers("hearts", game).moves.length);0What it prints (run when this page was built)