本文へ移動

Toranpuトランプ

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

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

目次

リファレンス

スペード

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

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

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

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

エクスポート

名前種類概要
chooseBid関数Nil for a hand of nothing (and never beside a partner's nil); otherwise what the hand is worth, at least one.
contractOf関数A partnership's contract this deal: its bids added, a nil counting none; null while either has still to bid.
dealerOf関数The seat that deals this deal: the first seat, then round to the left.
decodeSpades関数Text read back into the game of Spades it records, by playing every move again through the rules; null for anything they cannot play out.
encodeSpades関数A game of Spades as text: its table, its seed and its moves, never a hand.
handWorth関数The tricks a hand is worth, counted as a card player counts them before bidding.
NIL定数The bid that means no tricks at all.
partnerOf関数The seat across the table.
partnershipScore関数What one partnership made of a deal: its contract (the two bids, a nil counting none) made or not, each nil made or not, and the overtricks — the tricks over the contract, and any trick a nil bidder took — as bags.
playSpades関数The game after that move, with the move added to its record, or null for a move the rules refuse.
sortSpades関数A hand sorted as a player holds it: diamonds, clubs, hearts, spades, low to high within each.
SPADES_BIDS定数The bids open to a player: nil, or one to thirteen tricks.
SPADES_RULES定数Spades as one CardGameRules: everything a table asks of the game.
SPADES_SEATS定数How many play Spades: four, in two partnerships.
SPADES_TRICKS定数The tricks in a deal of Spades: thirteen.
spadesComputer関数The move a computer in the seat to play makes: always one the rules allow.
SpadesDealScore型What one finished deal did to a partnership's score, as the scores table explains it.
SpadesGame型A GAME OF SPADES: its table and moves (what is kept, KeptCardGame), and everything the moves make, read again from them whenever the game is.
spadesHeight関数A card's height in a trick: ace high.
SpadesMove型A bid of tricks, 0 (nil) to 13, or one card played to the trick.
spadesMoves関数Every move the seat to play may make now; none once the game is over.
SpadesPhase型Bidding how many tricks each seat will take, playing the deal out trick by trick, or the game over.
SpadesPlay型One card laid on a trick, and whose it was.
spadesPlayable関数The cards the seat to play may lay on the trick now.
spadesTrickWinner関数Who takes a finished trick (or is winning one still being played): the highest spade, or else the highest card of the suit led.
spadesView関数The part of the game the seat to play can see, which is all its computer is given.
SpadesView型What the seat to move can see: its own hand, every bid, the tricks taken and the cards played.
spadesWinners関数The partnership with the higher score wins, both its seats.
startSpades関数A new game of Spades for these players (one name a seat) at this size, dealt from the seed dealt, or null for a table Spades is not offered for.
teamOf関数A seat's partnership: 0 for seats 0 and 2, 1 for seats 1 and 3.

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

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