リファレンス
磁石ブロック
import { … } from "@johnmorrisdotca/houseki/magnetic-blocks";
最小化と gzip 圧縮をしたサイズは 28.2 kB(読み込むものをすべて含み、esbuild で計測)
リファレンスの説明と例は英語です。見出しと目次は日本語です。
エクスポート
| 名前 | 種類 | 概要 |
|---|---|---|
Action | 型 | A native player action accepted or rejected according to the current phase and rules. |
advanceTicks | 関数 | Advances fixed 60 Hz time, resolving phases in all modes and falling/locking only in Arcade. |
applyAction | 関数 | Applies one movement, rotation, floor-switch or placement action without mutation. |
Block | 型 | The native active 2×2 block, orientation and fixed-tick descent/lock counters. |
blockBonds | 関数 | List the native stable-id bonds connecting adjacent gems in the active block. |
blockCells | 関数 | Returns stable-gem addresses after rotating the square block around its centre. |
Bond | 型 | An undirected stable-id connection between two gems in a magnetic block. |
calmGravity | 関数 | Settles bonded connected components one cell per deterministic bottom/ID priority step. |
campaignManifest | 定数 | The frozen native campaign manifest with its ordering, revisions, checksum and measured levels. |
canPlace | 関数 | Test whether the whole native block fits passable empty board cells. |
Colour | 型 | A standard gem colour used by a magnetic block. |
createGame | 関数 | Creates an immutable seeded 2×2-block game with a fixed queue and explicit floor schedule. |
createLesson | 関数 | Creates a fresh lesson game with its authored setup and queue. |
createLevel | 関数 | Creates a fresh game with the authored rules, board, queue, and finite move budget. |
CreateOptions | 型 | Creation settings for this native engine; dimensions, mode, seed and optional mechanics are validated together. |
decodeGame | 関数 | Replays bounded canonical input and verifies every saved checkpoint field. |
encodeGame | 関数 | Encodes canonical settings, accepted tick-stamped actions and a verified replay checkpoint. |
Floor | 型 | The native calm or magnetic floor used when settling blocks. |
FloorSchedule | 型 | A fixed, periodic or authored schedule selecting the floor for committed block placements. |
GameEvent | 型 | An event emitted by one native transition; type selects the event’s additional fields. |
GameState | 型 | The immutable authoritative native game state, including its board, random state and recording. |
GameStatus | 型 | A compact native status derived from the authoritative state for a host’s labels. |
Gem | 型 | A native gem with a stable run-local id and colour. |
getLesson | 関数 | Finds one of the three bilingual rules lessons by stable ID. |
getLevel | 関数 | Finds a Magnetic Blocks campaign level by stable ID or one-based display number. |
getTutorial | 関数 | Find a magnetic-block lesson by stable id; returns undefined when no lesson has that id. |
Goal | 型 | The native authored goal; its discriminant selects the required collection or clearing condition. |
GRAVITY_TICKS | 定数 | Fixed 60 Hz ticks in the magnetic-block gravity phase. |
impactSupportIds | 関数 | Collects the occupied one-cell support layer under both block columns at first contact. |
landingY | 関数 | Find the last legal block row before downward collision. |
legalActions | 関数 | Lists accepted controls for the current falling or resolution phase. |
lessonManifest | 定数 | The frozen native bilingual lessons and their authored teaching steps. |
levelManifest | 定数 | The frozen ordered native levels; array indices start at zero and display numbers start at one. |
LocalizedText | 型 | One authored text in English and Japanese. |
MagneticBlocksOptionsError | クラス | A typed native magnetic-block setup validation error. |
MagneticCampaignLevel | 型 | One authored native challenge with its stable id, setup, winning witness, measurements and review status. |
MagneticCampaignManifest | 型 | The ordered native campaign, its generation/grading revisions, checksum and measured levels. |
MagneticDifficultyMetrics | 型 | The bounded engine measurements used to grade this campaign; they do not claim human difficulty. |
magneticGravity | 関数 | Magnetic floor removes all bonds and settles each column segment independently. |
MagneticLesson | 型 | One bilingual native lesson with its authored setup, teaching steps and winning witness. |
MARK_TICKS | 定数 | The fixed 60 Hz ticks showing the magnetic-block match mark phase. |
matchGroups | 関数 | Computes deterministic orthogonal colour components of at least four gems. |
Mode | 型 | The native game mode; authored challenges have fixed setup and queue rules. |
Phase | 型 | The native falling, resolution, pause and ending phases. |
RecordedAction | 型 | A native action recording with the logical position needed for deterministic replay. |
REMOVE_TICKS | 定数 | Fixed 60 Hz ticks in the magnetic-block removal phase. |
removeIds | 関数 | Remove the selected native cell indices and discard bonds whose endpoint gems were removed. |
restartGame | 関数 | Restarts the same seed, custom starting board, fixed queue, rules and floor options. |
Settings | 型 | Validated settings fixed at native game creation. |
settle | 関数 | Settle surviving gems with the chosen floor rule and retain valid stable-id bonds. |
statusOf | 関数 | Returns a compact immutable status including current and upcoming floor state. |
Transition | 型 | The resulting native state, emitted events and acceptance decision; rejected actions preserve the input. |
tutorialManifest | 定数 | Alias kept alongside other Houseki campaign lesson APIs. |
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。