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 · Spades

spadesMovesfunction

Every move the seat to play may make now; none once the game is over.

Import it

import { spadesMoves } from "@johnmorrisdotca/toranpu/spades";

Definition

function spadesMoves(game: SpadesGame): SpadesMove[]

Parameters

NameTypeDescription
gameSpadesGame

The current native game; applying a move returns a new state.

Returns

SpadesMove[]

Every move the seat to play may make now; none once the game is over.

Examples

import { CARD_GAME_TABLES, newGame } from "@johnmorrisdotca/toranpu";
import { spadesMoves } 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(spadesMoves(game));
[
  { bid: 0 },  { bid: 1 },
  { bid: 2 },  { bid: 3 },
  { bid: 4 },  { bid: 5 },
  { bid: 6 },  { bid: 7 },
  { bid: 8 },  { bid: 9 },
  { bid: 10 }, { bid: 11 },
  { bid: 12 }, { bid: 13 }
]

What it prints (run when this page was built)

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