本文へ移動

Toranpuトランプ

デッキを使い、11種類のゲームでコンピューターと対戦し、ソリティアを解いたり、独自の絵柄でカードを表示したりできます。

「トランプ」は、日本語で playing cards を指す言葉です。 名前について(英語)

目次

リファレンス

ハーツ

import { … } from "@johnmorrisdotca/toranpu/hearts";

最小化と gzip 圧縮をしたサイズは 3.6 kB(読み込むものをすべて含み、esbuild で計測)

リファレンスの説明と例は英語です。見出しと目次は日本語です。

Hearts: its rules, its computer player and its saved-game format.

エクスポート

名前種類概要
choosePass関数The three cards a computer passes from a hand of Hearts: the queen of spades and the high spades that catch her, high hearts, and cards from a short suit.
decodeHearts関数Text read back into the game of Hearts it records, by playing every move again through the rules; null for anything they cannot play out.
encodeHearts関数A game of Hearts as text: its table, its seed and its moves, never a hand.
HEARTS_ALL_POINTS定数Every point in a deal: thirteen hearts and the queen.
HEARTS_RULES定数Hearts as one CardGameRules: everything a table asks of the game.
heartsComputer関数The move a computer in the seat to play makes: always one the rules allow.
HeartsGame型A GAME OF HEARTS: its table and moves (what is kept, KeptCardGame), and everything the moves make, read again from them whenever the game is.
heartsHeight関数A card's height in a trick: ace high.
HeartsMove型Three cards passed (all three at once, as a player hands them over), or one card played to the trick.
heartsMoves関数Every move the seat to play may make now; none once the game is over.
HeartsPhase型Passing three cards before the deal is played, playing it out trick by trick, or the game over.
HeartsPlay型One card laid on a trick, and whose it was.
heartsPlayable関数The cards the seat to play may lay on the trick now.
heartsPoints関数A card's points: a heart one, the queen of spades thirteen.
heartsView関数The part of the game the seat to play can see, which is all its computer is given.
HeartsView型What the seat to move can see: its own hand and the table.
heartsWinners関数The lowest score wins; level on the lowest shares it.
passOffset関数How far round the table the cards go this deal: 1 to the left, seats − 1 to the right, 2 across, 0 held.
playHearts関数The game after that move, with the move added to its record, or null for a move the rules refuse.
QUEEN_OF_SPADES定数The queen of spades, worth thirteen points to whoever takes her.
sortHearts関数A hand sorted as a player holds it: clubs, diamonds, spades, hearts, low to high within each.
startHearts関数A new game of Hearts for these players (one name a seat) at this size, dealt from the seed dealt, or null for a table Hearts is not offered for.
trickWinner関数Who takes a finished trick: the highest card of the suit led.
TWO_OF_CLUBS定数The two of clubs, which leads the first trick of every deal.

ソースを見るGitHub で編集@johnmorrisdotca/toranpu 2.15.0 のソースから作成しました。

この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。