本文へ移動

Houseki宝石

5つの宝石と石のゲームの仕組みを使い、測定したチャレンジやレッスンで遊び、再現できるゲームを保存できます。

宝石(ほうせき)は、宝石や貴石を意味する日本語です。 名前について(英語)

目次

リファレンス

積み木

import { … } from "@johnmorrisdotca/houseki/tsumiki";

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

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

エクスポート

名前種類概要
Action型One move: a piece from the tray, placed with its top left on a cell.
ActionResult型What an applied action came to: whether it was taken, the state after it, and what happened.
advanceTicks関数Advances nothing: a placement is whole the moment it is made.
applyAction関数Plays one move: a piece is laid, every full row and column clears together, and the tray fills when it is empty.
Block型One filled cell: its run-local identity, its colour, and whether it is a stone a challenge asks to be cleared.
BlockColour型A colour used by a placed block.
BOARD_SIDE定数The board's side: eight cells each way.
canPlace関数Whether a piece from the tray can go with its top left on this cell, for a host to draw a ghost.
ChallengeGoal型What a challenge asks for: a score, a number of lines, or every stone cleared.
ChallengeOptions型An authored game: its identity, seed, goal and the stones it starts with.
createChallenge関数Makes an authored game from its seed, goal and stones.
createGame関数Makes a free game or a Daily: a Daily's seed is its date, so one date is one game for everybody.
createLevel関数Makes a level's game; throws for a level that does not exist.
CreateOptions型The options a free game or a Daily is made from.
createTutorial関数Makes a lesson's game; throws for a lesson that does not exist.
decodeGame関数Reads a save by playing it again from the start, so a save cannot claim what its moves do not do.
encodeGame関数A game as text: what it was and the moves made, never the score or the board, which a replay works out.
GameEvent型What a move made happen, for a host to draw or sound.
GameMode型The free, daily or authored game mode.
GamePhase型Where a game stands: waiting for a placement, won, lost, or finished with a score.
GameSettings型How a game was set up, the whole of what a replay needs but the moves.
GameState型The whole of a game, returned new by every move: nothing in it is changed in place.
GameStatus型A game's figures as a host would show them.
getLevel関数Looks a level up by its id or its display number; null where there is none.
getTutorial関数Looks a lesson up by its id; null where there is none.
legalActions関数Every placement allowed now, a bot's or a test's whole view of what can be done.
levelManifest定数The frozen graded levels, in order; array indices start at zero and display numbers at one.
LocalizedText型Words in both languages.
Piece型A shape in the tray: its name, its colour, and its cells as row and column from its own top left.
restartGame関数The same game from its start, with the same settings.
statusOf関数A game's figures: its phase, its score, its lines and how far along its goal it is.
TsumikiLevel型One graded level: its seed, goal and stones, and a line of moves the engine has been shown to win with.
TsumikiTutorial型One bilingual lesson, with the game it is played on and a line of moves that wins it.
TsumikiTutorialStep型One step of a lesson.
tutorialManifest定数The frozen bilingual lessons.

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

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