本文へ移動

Toranpuトランプ

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

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

目次

リファレンス

ウォー

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

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

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

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

エクスポート

名前種類概要
decodeWar関数Text read back into the game of War it records, by playing every move again through the rules; null for anything they cannot play out.
encodeWar関数A game of War as text: its table, its seed and its moves, never a pile.
isWarMove関数Whether something is the one move War has.
playWar関数The game after the cards are turned over: the whole turn, through however many wars it takes, or null for a move the rules refuse.
startWar関数A new game of War for these two players at this size (how many turns it may last), dealt from the seed, or null for a table War is not offered for.
WAR_FACE_DOWN定数The cards a player lays in a war before the one turned up.
WAR_RULES定数War as one CardGameRules: everything a table asks of the game.
warComputer関数The move a computer makes: the only one War has.
WarEnd型Why a game of War ended: one player has every card ("cleared"), a player could not finish a war and the other could, or both could not and one ran out first ("short"), both ran out together ("drawn"), or the turns ran out ("limit").
WarGame型A GAME OF WAR: its table and moves (what is kept), and what they make.
WarLaid型One card laid in a turn: who laid it, and whether it lay face down (the three of a war) or was turned up.
WarMove型The one thing a player does at War: turn the top cards over.
warMoves関数Every move the table may make now: turning the cards over, until the game is over.
warRank関数How a rank counts at War: the ace highest, then king down to two.
WarTurn型What the table saw of the last turn: every card laid, in the order laid, how many wars the turn went through (0 for a plain turn of the cards), and who took the cards (null when the turn ended the game on a war that was not finished).
warWinners関数The seats that won a game that is over: the player with more cards, both when the piles are level or the game was a draw; nobody while it goes on.

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

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