リファレンス
規則・生成・推論
import { … } from "@johnmorrisdotca/jirai";
最小化と gzip 圧縮をしたサイズは 7.8 kB(読み込むものをすべて含み、esbuild で計測)
リファレンスの説明と例は英語です。見出しと目次は日本語です。
Jirai 地雷: the rules and deductions, plain functions over plain data. No DOM and no dependencies.
エクスポート
| 名前 | 種類 | 概要 |
|---|---|---|
activeCell | 関数 | Row-major addresses stay stable; omitted cells have no clue and no neighbours. |
activeCells | 関数 | Returns all active cells in stable row-major order. |
Board | 型 | A dealt board including its answer; keep it off public clients. |
Constraint | 型 | An exact count over unknown cells, with the clues that supplied it. |
dailySeed | 関数 | UTC by definition, so two people sharing a daily seed get the same board. |
decodeOrthogonalGame | 関数 | Restores only version 2 orthogonal progress records. |
deduce | 関数 | What the clues prove, without reading the answer or trusting a player's flags. |
Deduction | 型 | Certain safe cells and mines proved from visible clues. |
DEFAULT_SETTINGS | 定数 | Default easy game, with a verified no-guess board and clear opening. |
encodeOrthogonalGame | 関数 | Encodes an orthogonal game with an explicit variant marker and version 2. |
ENUMERATION_CELLS | 定数 | Largest frontier enumerated for exact deductions. |
ENUMERATION_NODES | 定数 | Maximum partial assignments checked in one exact deduction search. |
Game | 型 | Rules data includes the answer; never send it to a competitive client. |
gameFromProgress | 関数 | A saved game is rebuilt under the rules. |
gameProgress | 関数 | Keep settings and moves, never an unchecked answer array. |
GENERATION_ATTEMPTS | 定数 | Default number of random layouts tried before a no-guess deal falls back to repairing the closest one. |
GenerationError | クラス | A bounded generator must say it failed, never quietly return a guessing board. |
GenerationOptions | 型 | Work limits for seeded board generation and its no-guess check. |
Grid | 型 | Neighbour topology used to count the clues around each cell. |
GRID_SPECS | 定数 | Neighbour offsets and edge behaviour for each topology. |
GRIDS | 定数 | Names for the supported square, four-neighbour, hex, and wrap grids. |
hintFor | 関数 | Keep discovering certain mines until there is a safe cell or nothing more is proved. |
HUGE_SIZES | 定数 | The huge fields: four times the area of a 16×16 (the medium level), 1,024 to 1,152 squares, for a long solve. |
hugeSettings | 関数 | The size and mine count of a level on a huge field: a field of HUGE_SIZES (32 × 32 unless size says another of them), with the level's own share of mines over its squares. |
HugeSize | 型 | The outline of a huge field: one of HUGE_SIZES' width and height. |
isSolvable | 関数 | Verify a board from one opening, using only clues that have been uncovered. |
Language | 型 | Supported interface copy locales. |
Level | 型 | A difficulty level: easy, medium, hard or extra-hard. |
LEVEL_ALIASES | 定数 | The 0.1 and 0.2 names for the first three levels. |
LEVEL_SIZES | 定数 | Size and mine count of each level on a rectangular board. |
LevelAlias | 型 | The 0.1 and 0.2 names for easy, medium and hard, still accepted wherever a level is. |
levelNamed | 関数 | The level a name means, or null. |
LEVELS | 定数 | The four difficulty levels, easiest first. |
levelSettings | 関数 | The size and mine count of a level. |
LevelSize | 型 | Board size and mine count a level asks for. |
makeBoard | 関数 | Deal after the first reveal. |
makeOrthogonalBoard | 関数 | Deals a board whose clues count only up, down, left and right. |
Mark | 型 | Player-facing state of one cell; the answer is never a mark. |
MARKS | 定数 | Names for the cell mark cycle. |
Material | 型 | Board colours for drawing and mounted play. |
MAX_CELLS | 定数 | Largest total cell count accepted by settings validation. |
MAX_SIDE | 定数 | Largest width or height accepted by settings validation. |
Measure | 型 | How demanding a dealt board is to solve by deduction, measured by solving it. |
measureBoard | 関数 | Solve a dealt board from its opening and report what it took. |
Move | 型 | A reveal, mark-cycle, or numbered-cell chord applied to a game. |
MOVES | 定数 | Names for the moves accepted by the engine. |
neighbours | 関数 | Every neighbour once. |
neighboursOf | 関数 | Precomputes the neighbour list for each row-major cell. |
newGame | 関数 | Creates an unstarted game with covered cells and no dealt answer. |
newOrthogonalGame | 関数 | Starts a game under four-neighbour rules. |
ORTHOGONAL_VARIANT | 定数 | Identifies the four-neighbour rules and progress-code format. |
orthogonalHint | 関数 | Gives a clue-only deduction; flags remain notes and cannot influence the result. |
orthogonalNeighbours | 関数 | Returns the adjacent cells under the orthogonal rules. |
OrthogonalSettings | 型 | Settings accepted by the four-neighbour-specific helpers. |
Pieces | 型 | Symbols used to mark mines. |
play | 関数 | A legal move returns a new game; an unavailable move returns the same one. |
PRESETS | 定数 | Common minefield dimensions and mine counts. |
ProofKind | 型 | Why a cell was proved: one clue, two overlapping clues, the mine counter, or every arrangement of a small frontier. |
ProofTally | 型 | Cells proved by each kind of reasoning. |
seededRandom | 関数 | Mulberry32, pinned by the replay tests: changing it would change every kept board. |
Settings | 型 | Board dimensions and rules used to deal and validate a game. |
SHAPES | 定数 | Board silhouettes supported by settings. |
Status | 型 | Current game state, including whether a mine has been hit. |
STATUSES | 定数 | Names for the game lifecycle states. |
validCell | 関数 | Reports whether a row-major cell is inside the board's active shape. |
validSettings | 関数 | Reject a setting before it reaches a board allocation or a shuffle. |
VERSION | 定数 | Package version, kept in step with the release metadata. |
visibleGame | 関数 | The clue-only view used by the solver. |
VisibleGame | 型 | Answer-free state suitable for deductions, hints, and public display. |
withBoard | 関数 | Attaches a worker-dealt board that matches the game's settings, preserving existing moves. |
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。