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