本文へ移動

Toranpuトランプ

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

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

目次

リファレンス

ジンラミー

import { … } from "@johnmorrisdotca/toranpu/gin-rummy";

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

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

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

エクスポート

名前種類概要
bestLayout関数The hand laid out to leave the least deadwood: the melds chosen, none sharing a card, and what is left.
canKnockWith関数Whether throwing this card, from a hand of eleven, leaves little enough deadwood to knock with.
chooseThrow関数The card to throw: the one leaving the least deadwood; of those, not a card the other player could use, and the highest.
deadwoodIn関数The deadwood left in a hand at its best.
deadwoodOf関数What a list of cards counts as deadwood, added up.
deadwoodValue関数A card's deadwood: an ace one, the numbers their number, a jack, queen or king ten.
decodeGin関数Text read back into the game of Gin Rummy it records, by playing every move again through the rules; null for anything they cannot play out.
encodeGin関数A game of Gin Rummy as text: its table, its seed and its moves, never a hand.
GIN_BONUS定数The bonus for gin, and for an undercut.
GIN_RUMMY_RULES定数Gin Rummy as one CardGameRules: everything a table asks of the game.
GIN_SEATS定数How many play Gin Rummy: two.
ginComputer関数The move a computer in the seat to play makes: always one the rules allow.
GinGame型A GAME OF GIN RUMMY: its table and moves (what is kept), and the hand they have reached.
GinLayout型Each hand's player, laid out: their melds, and the cards left over.
GinMeld型A meld: three or four of a rank, or a run of three or more in one suit.
GinMove型A card drawn from the stock or taken from the discard pile, or a card thrown: laid on the pile, or face down to knock.
ginMoves関数Every move the seat to play may make now; none once the game is over.
GinResult型How a hand ended: who scored and how much, and how each hand was laid down.
ginSensible関数A player a test can play at random who still ends a hand: a random draw and a random throw, but a knock whenever the card thrown allows one.
ginView関数The part of the game the seat to play can see, which is all its computer is given.
GinView型A COMPUTER AT THE GIN RUMMY TABLE: it takes the discard only when the card goes straight into a meld, throws the card that leaves the least deadwood (the highest of those that tie, and never one the other player has shown they are collecting when another will do), and knocks the moment it can.
ginWinners関数The first to the game's total wins.
isMeld関数Whether these cards are a meld: three or four of a rank, or three or more in a row in one suit.
KNOCK_MOST定数The most deadwood a player may knock with.
layOff関数The defender's side of a knock: their own melds first, then every card left that fits one of the knocker's melds laid off onto it — a run grown one card at a time, so a six can follow the five just laid.
meldsIn関数Every meld that can be made from these cards: each set of three or four, and each run of three or more.
playGin関数The game after that move, with the move added to its record, or null for a move the rules refuse.
sortGin関数A hand sorted as a player holds it: by suit (spades, hearts, clubs, diamonds, as the colours alternate), ace low.
startGin関数A new game of Gin Rummy for these players (one name a seat) at this size, dealt from the seed dealt, or null for a table Gin Rummy is not offered for.
UNDERCUT_BONUS定数The bonus for an undercut: the defender has no more deadwood than the knocker.
wanted関数Whether the discard would go straight into a meld: the hand with it and its best throw has less deadwood than now.

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

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