リファレンス
スペード
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. |
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。