本文へ移動

Toranpuトランプ

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

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

目次

リファレンス

クロンダイク

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

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

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

Klondike, the Solitaire: its table, its rules, its moves written as text, a solver, and what a tap on the table means.

エクスポート

名前種類概要
allFaceUp関数Whether every card on the columns is face up: from here the game plays itself out (autoFinish).
bestFirst関数A winning line from this table — every move a replay of it makes, the settling ones included — or null when none was found within budget tables.
BestFirstGame型A BEST-FIRST SEARCH for a card game played alone, shared by FreeCell's solver and Spider's (freecell/solve.ts, spider/solve.ts).
carriedFrom関数Which card of a column a carry to to would take: the one face-up card whose run fits there, or null.
COLUMN_PILES定数The columns, as a move names them.
columnAt関数Which column, from 0, a pile a move names is.
COLUMNS定数How many columns the tableau has.
dealKlondike関数Deal a deck (card numbers, the first dealt first) into a table: column by column along each row, as a dealer does.
dealOf関数A deal string from card numbers.
dealOfSeed関数The deal of a seed: the site's one shuffle (shuffledDeck), written down.
deckOf関数The deck a deal string names, as card numbers, or null for one that is not a whole deck.
decodeMoves関数A move list read back, or null for one with a character that is no move.
DRAW_CODE定数The letter a draw from the stock is written as, in a move list.
encodeMove関数One move written as text: one or two letters.
encodeMoves関数A list of moves written as text, one after another with nothing between.
finishingMoves関数THE GAME PLAYS ITSELF OUT once every card on the columns is face up: the moves that bring the rest home, found by the solver on a small budget (a table with nothing hidden is solved in a handful of tables), or null while a card is still face down or no way home is found — then the player goes on.
fitsColumn関数Whether a card may go onto a column: onto a card one higher of the other colour, or a King onto an empty one.
fitsFoundation関数Whether a card may go onto its suit's foundation now.
FOUNDATION_PILES定数The foundations' letters, in SUITS order (spades, hearts, diamonds, clubs), as a card id writes a suit.
foundationAt関数Which foundation, from 0 in SUITS order, a pile a move names is.
foundationPileOf関数The foundation a card goes to.
homeMove関数The move that sends a top card home, if it can go: what a double tap does.
isColumnPile関数Whether a pile a move names is a column.
isFoundationPile関数Whether a pile a move names is a suit's foundation.
isSafeHome関数Whether a card is one the solver treats as home safely: exported for its test.
KlondikeColumn型One of the seven columns: its cards from the bottom up, of which the first down lie face down.
KlondikeMove型One move: turn cards from the stock (draw), turn the waste back over (recycle), or carry cards from one pile to another.
KlondikePile型A place on the table a move names: the stock s, the waste w, a suit's foundation by its letter (S H D C, as a card id writes a suit), or a column 1–7.
KlondikeRules型How the game was set up: cards turned from the stock at a time, and how many times through the stock (Infinity for no limit).
KlondikeTable型A game of Klondike as it stands: every pile, and the rules it is played under.
klondikeWon関数Whether every card is home.
liftable関数The cards a person can take hold of from a spot, the one held and every one on it, or none: the waste's top card, a foundation's top card, or any face-up card of a column with the run on top of it.
moveFor関数The move that carries the cards held at from to to, if the rules allow exactly those cards there.
movesFrom関数Every move the rules allow from this table, in a fixed order: to the foundations first, then onto the columns, then the stock.
pileCards関数The cards of a pile, bottom first, as the table holds them.
playKlondike関数The table after a move, or null where the rules refuse it.
rankOf関数A card's rank, 1 for an ace to 13 for a king.
RANKS_A_SUIT定数How many ranks a suit has, ace to king.
RECYCLE_CODE定数The letter turning the waste back over is written as, in a move list.
recyclesLeft関数How many times the waste may still be turned back: passes less one, less those already made.
redCard関数Hearts and diamonds, the second and third suits.
replay関数A game played out from its deal: every table it passed through, the first the deal, or null where the deal is not a deck or a move is one the rules refuse.
solveKlondike関数A winning line from this table — every move, the safe ones home included, that a replay of it makes — or null when none was found within budget tables.
stockMove関数What a press on the stock does: turn it, or turn the waste back over, or nothing once the passes are spent.
stuck関数Whether nothing can be done but give up: no card can move anywhere, and the stock can be neither turned nor turned back.
suitOf関数A card's suit, 0 to 3 in SUITS order.
TableSpot型A card on the table, as a person points at it: the pile, and its place from the bottom (-1 for the pile's empty place).

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

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