Skip to the content

Toranpuトランプ

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

Toranpu is Japanese for playing cards. About the name

Contents

Reference · Stack Up

stackUpComputerfunction

The move a computer makes: the best play it has, or else the card it would miss least, put where it does least harm.

Import it

import { stackUpComputer } from "@johnmorrisdotca/toranpu/stack-up";

Definition

function stackUpComputer(game: StackUpGame): StackUpMove

Parameters

NameTypeDescription
gameStackUpGame

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

Returns

StackUpMove

The move a computer makes.

Examples

import { stackUpComputer, startStackUp } from "@johnmorrisdotca/toranpu/stack-up";
console.log(stackUpComputer(startStackUp(15, ["Aki", "Ben"], undefined, 42)!));
{ play: 'n01', from: 'hand', to: 0 }

What it prints (run when this page was built)

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