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

presidentMovesfunction

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

Import it

import { presidentMoves } from "@johnmorrisdotca/toranpu/president";

Definition

function presidentMoves(game: PresidentGame): PresidentMove[]

Parameters

NameTypeDescription
gamePresidentGame

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

Returns

PresidentMove[]

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 { presidentMoves } from "@johnmorrisdotca/toranpu/president";

const names = Array.from({ length: CARD_GAME_TABLES.president.defaultPlayers }, (_, seat) => `Seat ${seat + 1}`);
let game = newGame("president", { players: names, seed: 42 })!;
console.log(presidentMoves(game));
[
  { play: [ '3C' ] },
  { play: [ '5H' ] },
  { play: [ '7C' ] },
  { play: [ '8H' ] },
  { play: [ 'JS' ] },
  { play: [ 'QC' ] },
  { play: [ 'QC', 'QD' ] },
  { play: [ 'QC', 'QD', 'QS' ] },
  { play: [ 'KC' ] },
  { play: [ 'KC', 'KH' ] },
  { play: [ 'AS' ] },
  { play: [ '2C' ] },
  { play: [ '2C', '2S' ] }
]

What it prints (run when this page was built)

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