Skip to the content

Toranpuトランプ

Use a deck, play eleven games with computers, solve a solitaire, or display cards in your own design.

Toranpu is Japanese for playing cards. About the name

Contents

Reference · Oh Hell

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

NameTypeDescription
gameOhHellGame

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)

View sourceEdit on GitHubMade from the source of @johnmorrisdotca/toranpu 2.15.0.