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

contractOffunction

A partnership's contract this deal: its bids added, a nil counting none; null while either has still to bid.

Import it

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

Definition

function contractOf(game: SpadesGame, team: 0 | 1): number | null

Parameters

NameTypeDescription
gameSpadesGame

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

team0 | 1

The zero-based team index.

Returns

number | null

A partnership's contract this deal: its bids added, a nil counting none; null while either has still to bid.

Examples

import { CARD_GAME_TABLES, newGame } from "@johnmorrisdotca/toranpu";
import { contractOf } 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(contractOf(game, 0));
null

What it prints (run when this page was built)

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