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

WarMovetype

The one thing a player does at War: turn the top cards over. War has no choices, so this is its only move, and a computer's turn is the same move as a person's.

Import it

import type { WarMove } from "@johnmorrisdotca/toranpu/war";

Definition

type WarMove = {
    turn: true;
};

Members

NameTypeDescription
turntrue

Examples

import { CARD_GAME_TABLES, newGame, rulesFor } from "@johnmorrisdotca/toranpu";
import type { WarMove } from "@johnmorrisdotca/toranpu/war";

const names = Array.from({ length: CARD_GAME_TABLES.war.defaultPlayers }, (_, seat) => `Seat ${seat + 1}`);
const game = newGame("war", { players: names, seed: 42 })!;
const value: WarMove = rulesFor("war").moves(game)[0]!;
console.log(value);
{ turn: true }

What it prints (run when this page was built)

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