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