ohHellPlayablefunction
The cards the seat to play may lay: the suit led if it holds any.
Import it
import { ohHellPlayable } from "@johnmorrisdotca/toranpu/oh-hell";
Definition
function ohHellPlayable(game: OhHellGame): CardId[]
Parameters
| Name | Type | Description |
|---|---|---|
game | OhHellGame | The current native game; applying a move returns a new state. |
Returns
string[]
The cards the seat to play may lay: the suit led if it holds any.
Examples
import { CARD_GAME_TABLES, newGame, rulesFor } from "@johnmorrisdotca/toranpu";
import { ohHellPlayable } from "@johnmorrisdotca/toranpu/oh-hell";
const names = Array.from({ length: CARD_GAME_TABLES.ohHell.defaultPlayers }, (_, seat) => `Seat ${seat + 1}`);
let game = newGame("ohHell", { players: names, seed: 42 })!;
const rules = rulesFor("ohHell");
for (let setup = 0; setup < 100 && game.phase !== "playing" && game.phase !== "over"; setup += 1) {
const next = rules.play(game, rules.computer(game));
if (next === null) throw new Error("Unexpected illegal setup move");
game = next;
}
if (game.phase !== "playing") throw new Error("Setup did not reach playing");
console.log(ohHellPlayable(game));[ '9S' ]What it prints (run when this page was built)