リファレンス
迷路・矢印・混合の盤
import { … } from "@johnmorrisdotca/meikyuu";
最小化と gzip 圧縮をしたサイズは 12.7 kB(読み込むものをすべて含み、esbuild で計測)
リファレンスの説明と例は英語です。見出しと目次は日本語です。
Meikyuu 迷宮, a maze game: the rules and the making, with no page needed.
- Mazes on any cell graph: squares, hexagons, triangles, circles and shapes cut out of them (
gridOf,MEIKYUU_SHAPES), carved by seven algorithms from a seed (carveMaze), played four ways (buildMaze,MEIKYUU_MODES), measured for difficulty (measureMaze), drawn as a line through them as pure functions (newMazeGame,pressMaze,dragMaze,liftMaze). - Arrow puzzles that can always be cleared (
makeArrows,newArrowGame,tapArrow), and mixed ones with locked arrows and a labyrinth to find the button in (buildMixed). - Every recipe as a short code (
recipeCode,parseRecipe). The numbered levels are in/levels, the drawing in/draw, and the board to play in a page in/play.
エクスポート
| 名前 | 種類 | 概要 |
|---|---|---|
Arrow | 型 | One arrow: its cells from tail to head (indexes into the board, row by row), and the way its head points. |
ARROW_HEARTS | 定数 | The hearts a puzzle starts with. |
ARROW_SHAPES | 定数 | The pictures an arrow board can be: the whole square, or one of the shapes cut from it. |
ARROW_STEPS | 定数 | The up, right, down and left row/column increments of arrow directions. |
ArrowBoard | 型 | The native arrow recipe, shape mask, arrow paths and locked flags. |
ArrowDirection | 型 | Which way an arrow's head points: up, right, down, left. |
ArrowGame | 型 | AN ARROW PUZZLE BEING PLAYED, as pure functions. |
ArrowMeasure | 型 | How hard an arrow puzzle is: the arrows to clear, the rounds of unblocking they take, and how many are blocked at the start. |
ArrowRecipe | 型 | Everything that makes an arrow puzzle. |
arrowRecipeCode | 関数 | A recipe as a short word, such as heart:15:6:77 or square:9x9:5:123:2 (the last number: how many are locked), and back. |
ArrowShape | 型 | One of the supported flat arrow-board masks. |
arrowsLeft | 関数 | The count of arrows still on the board. |
ArrowTap | 型 | What a tap did. |
autoTurn | 関数 | auto: turn a maze when that makes it bigger in the room there is. |
below | 関数 | A whole number in [0, n) from the stream. |
blockedBy | 関数 | The arrows on the way out of id that are still on the board. |
blockersOf | 関数 | Which arrows block others: for each arrow, the arrows whose cells lie on its way out. |
boundaryCells | 関数 | The cells with a side on the edge of the shape: where a door in the outer wall can be. |
Box | 型 | A rectangle, in cells. |
buildMaze | 関数 | Make the maze a recipe names. |
buildMixed | 関数 | Build the maze and locked-arrow layers of one native mixed recipe. |
canLayStone | 関数 | Whether a stone may be laid on a cell now, and if not, why not. |
carveMaze | 関数 | The open neighbours of every cell, for a perfect maze of the grid made by this algorithm from this stream. |
CellGraph | 型 | What a generator reads of a grid: how many cells there are and which are beside which. |
cellsAlong | 関数 | The cells a pointer enters moving from one shown point to the next: the straight path between them cut into steps of a third of a cell and each step carried back into the maze. |
centreCell | 関数 | The cell whose middle is nearest the middle of the shape. |
circleGrid | 関数 | A circle maze: rings rings round a middle cell, cells running round each ring and out between the rings. |
clearArrows | 関数 | Take every arrow off by tapping only free ones, the way a test or a demo plays. |
clearStones | 関数 | Every stone taken up, in one step Undo can put back. |
COVER_FROM | 定数 | Where cover begins to rise and how far it rises: (mean - COVER_FROM) / COVER_SPAN. |
COVER_SPAN | 定数 | The native coverage span used by the geometry-aware score. |
COVERAGE_FLOOR | 定数 | What the score is multiplied by at no cover at all. |
coverageOf | 関数 | How much of a map an answer covers. |
decodeRun | 関数 | The game a run text says, for maze under rules, or null when it is not a run of that maze: a step into a wall or back onto the line, a stone on a cell the line is on, on the start or the goal, on no cell at all or twice, or any stones when rules is null. |
DIFFICULTY_CEILINGS | 定数 | The count at which a term reaches its full weight, on its log scale. |
DIFFICULTY_WEIGHTS | 定数 | What each term is weighed by in the score; they add to 1. |
difficultyOf | 関数 | How hard a maze is, from 0 to 100, and what that is made of. |
difficultyOfGraph | 関数 | The same for any maze, flat or over a solid, given how it lies in space (MazeGeometry). |
Door | 型 | A door in the outer wall: the cell it is beside, and which of that cell's sides. |
dragMaze | 関数 | The finger moved into a cell. |
easyFloorAt | 関数 | What the easy third asks for beyond the least, rising through it so that it climbs: at place place (from 1) of a size, a maze has at least this many traps, forks and wasted cells, and from the end of the easy third the least. |
EFFORT_LEAST | 定数 | The easiest effort a level is given a rating for, and the hardest: 1 and 100 are these. |
EFFORT_MOST | 定数 | The upper native effort bound used when converting effort to a rating. |
encodeRun | 関数 | A run kept as one short text: the line as its steps (lineToSteps), and, if any stones are down, a ~ and their cells in base 36 joined by dots, such as 0231~1a.2f. |
Grid | 型 | The native flat cell graph with geometry, neighbour sides, bounds and point-to-cell lookup. |
gridOf | 関数 | A grid by name. |
hasStone | 関数 | Whether a cell has a stone on it. |
headOf | 関数 | The end of the line, or null while there is none. |
heldByLocks | 関数 | Whether an arrow cannot be cleared before the unlock whatever the player taps: with every free arrow taken off, one after another, it is still on the board. |
hexGrid | 関数 | Columns by rows of hexagons, pointy side up, every odd row shifted half a cell right. |
hintArrow | 関数 | The arrow to tap next: one that is free now and keeps the most arrows waiting behind it, so it also frees the most others. |
hintMaze | 関数 | Where to look next: how many cells of the line to draw back (the part that has strayed from the way to what is still needed), and the next stretch of the right way from there, up to ahead cells, not counting the one the line is on. |
isFree | 関数 | Whether an arrow can be tapped now and slide off: it is on the board, not locked, and nothing is in front of it. |
isPerfect | 関数 | Whether the passages are a spanning tree of the grid: every cell reached, and exactly one way to each. |
isTooEasy | 関数 | Whether a maze is too easy to be a level: it falls short of any of MEIKYUU_LEAST, or, with a place in the easy third of a size, of easyFloorAt(place). |
layoutCells | 関数 | How many cells laying out a recipe's grid takes, counted before anything is built: the grid's own cells for squares, hexagons, triangles and circles, and the whole raster for a shape cut out of one (a cut-out shape keeps fewer, but is built from all of them). |
layStone | 関数 | The game with a stone laid on the cell; the same game when it may not be (canLayStone). |
liftMaze | 関数 | The finger lifted. |
lineToSteps | 関数 | A line, cell by cell from the start, as its steps. |
Links | 型 | Each cell's open neighbours. |
makeArrows | 関数 | The arrows of a recipe, in the order they were added: the last one added is free from the start. |
Mask | 型 | THE OUTLINES cut out of a square raster: a function from a point of the square (both numbers from -1 to 1, y down) to whether that point is inside the shape. |
maskOf | 関数 | The outline a raster shape is cut with. |
Maze | 型 | A seeded flat maze with its cell graph, passages, doors, endpoints and optional keys. |
MazeCore | 型 | What the game, the stones, the measure and the steps read of a maze: the passages, the two ends, the keys, and how many cells there are and which are beside which. |
MazeCoverage | 型 | HOW MUCH OF THE MAP THE ANSWER COVERS (coverageOf): the second half of a maze's difficulty. |
MazeDifficulty | 型 | HOW HARD A MAZE IS TO PLAY, ON ONE SCALE FROM 0 TO 100 (difficultyOf). |
MazeGame | 型 | A MAZE BEING DRAWN, as pure functions: each takes a game and returns a new one (or the same one, when nothing changed), so a page, a server and a test play by the same rules. |
MazeGeometry | 型 | How a maze lies in space, which is all the measure needs to know of it besides the passages: how far a cell is from the goal (any measure that rises with distance will do, the squared distance is cheapest) and how far the line bends going from one cell through another to a third, in radians from 0 (straight on) to pi (back the way it came). |
MazeMeasure | 型 | HOW HARD A MAZE IS, measured from the maze alone (docs/MAZES.md says why each number is here). |
mazeProgress | 関数 | How far the line has got, for a progress line: cells drawn, keys, and whether it is solved. |
MazeRecipe | 型 | Everything that makes a maze. |
measureArrows | 関数 | Measure the arrow count, cells, dependency rounds and native clearing effort. |
measureMaze | 関数 | Measure a maze. |
measureMixed | 関数 | How hard it is: the arrows' effort and half the labyrinth's. |
MEIKYUU_ALGORITHMS | 定数 | THE SEVEN WAYS TO MAKE A PERFECT MAZE, each over any grid: a perfect maze is a spanning tree of the cells, so there is exactly one way between any two of them. |
MEIKYUU_EASY_PLACES | 定数 | How far up a size the easy third reaches: its first 86 places. |
MEIKYUU_LEAST | 定数 | The least a maze must have to be a level at all, wherever it is in a list (isTooEasy): the straight guess draws at least four cells it did not need, is wrong at two forks or more, and the way has three places to choose, three wrong branches and four dead ends. |
MEIKYUU_MODES | 定数 | A MAZE: a grid, the passages carved through it (always a spanning tree, so exactly one way between any two cells), and how it is played. |
MEIKYUU_MOST_ARROW_CELLS | 定数 | The most cells an arrow board may have: a little over twice the biggest level's (1,849). |
MEIKYUU_MOST_CELLS | 定数 | The most cells a recipe may lay out: a little over twice what the biggest level does (19,321, a heart, leaf, star or moon cut from a raster 139 across). |
MEIKYUU_MOST_KEYS | 定数 | The most keys a recipe may ask for: twice the most any level uses (five). |
MEIKYUU_ORIENTATIONS | 定数 | WHICH WAY UP A MAZE IS LOOKED AT. |
MEIKYUU_SHAPES | 定数 | Every shape a maze can be made on. |
MEIKYUU_STONE_REACH_MOST | 定数 | The farthest a stone may be from the line: two cells. |
MeikyuuAlgorithm | 型 | One of the seven native maze-carving algorithms. |
MeikyuuMode | 型 | The enter/leave, goal, centre-out or key-collecting native maze mode. |
MeikyuuOrientation | 型 | The native portrait, landscape or automatic board orientation. |
MeikyuuShape | 型 | A supported flat grid geometry or cut-out mask. |
MixedBoard | 型 | A native mixed recipe with its flat maze and arrow layers. |
MixedGame | 型 | The current native maze and arrow states of one mixed puzzle. |
MixedRecipe | 型 | THE MIXED PUZZLE: an arrow board with some arrows locked, and a labyrinth beside it with an unlock button hidden deep inside. |
mixedRecipeCode | 関数 | Encode a native mixed maze/arrow recipe as reproducible text. |
mixedSolved | 関数 | Whether the puzzle is won: every arrow cleared. |
newArrowGame | 関数 | Create the native arrow state with all arrows present and a starting heart count. |
newMazeGame | 関数 | A game of the maze, with nothing drawn, and, if given, the rules of its stones (stones.ts). |
newMixedGame | 関数 | Create the native game states for both layers of a mixed board. |
parseArrowRecipe | 関数 | A recipe's arrow board from its code, or null when it is not one, or names a board bigger than MEIKYUU_MOST_ARROW_CELLS. |
parseMixedRecipe | 関数 | Read native mixed-recipe text, or null for a malformed maze/arrow recipe. |
parseRecipe | 関数 | A recipe from its code, or null when it is not one, or names a maze bigger than MEIKYUU_MOST_CELLS or more keys than MEIKYUU_MOST_KEYS. |
passageCount | 関数 | How many passages the maze has: one fewer than its cells, if it is perfect. |
peelRounds | 関数 | The order the arrows come off in if every free one is taken each round, as rounds: the length of this is how many times the board has to be looked at again. |
pick | 関数 | One of the items, chosen from the stream. |
playSolution | 関数 | Draw the maze's whole solution through the game, a cell at a time, as a finger would: the way a test or a demo plays. |
Point | 型 | A point, [x, y], in cells. |
pressMaze | 関数 | A finger down on a cell: it begins a stroke if the cell is the start, the line's end, or on the line. |
Random | 型 | A number in [0, 1), like Math.random, from a stream a seed fixes. |
ratingOf | 関数 | An effort as a rating from 1 to 100, on a scale where doubling the effort adds the same each time. |
rayOf | 関数 | The cells in front of an arrow's head, out to the edge of the board, nearest first. |
recipeCode | 関数 | A recipe as one short word, such as square:12x9:wilson:to-goal:48213 or heart:25:prim:keys-3:7, and the other way (parseRecipe). |
resolveTurn | 関数 | The turn an orientation means for a maze, given the room when it is auto. |
restartArrows | 関数 | Restore every native arrow and the original hearts, clearing mistakes and removals. |
restartMaze | 関数 | Everything off the maze again. |
ringCounts | 関数 | How many cells each ring of a circle maze holds: one in the middle, six round it, and a ring doubles its cells when its cells would otherwise be wider than tall. |
seededRandom | 関数 | A stream of numbers in [0, 1) fixed by a seed. |
shuffled | 関数 | A copy of the list in a random order (Fisher–Yates); the list given is left alone. |
Side | 型 | One side of a cell: the cell across it (-1 for the edge of the shape) and the wall it is drawn with. |
SOLID_ZONES_TOP | 定数 | How much of a solid's zones even a whole tour touches. |
solutionOf | 関数 | The one way from the start to the goal, cell by cell, both ends included. |
squareGrid | 関数 | Columns by rows of square cells. |
stepsToLine | 関数 | The cells steps walk from the maze's start, or null if any step goes where a line cannot: into a wall, off the maze, or back onto the line. |
stoneLimitFor | 関数 | How many stones a maze of cells cells gets by default: three, and one more for every hundred cells across (so four for a small maze, nine for a huge one, thirteen for a colossal one). |
StoneOption | 型 | What the stones option of mountMeikyuu takes: true for the defaults, or any of the rules (limit: null for no limit). |
StoneRules | 型 | STONES: a marble laid on a cell of the maze that the line may not enter. |
stoneRulesOf | 関数 | The rules an option means for a maze of cells cells, or null when the option is no stones. |
stonesLeft | 関数 | How many stones can still be laid: null for no limit, and nought for a game with none. |
StoneVerdict | 型 | Why a stone cannot be laid on a cell, or ok. |
takeStone | 関数 | The game with the stone on the cell taken up (and given back); the same game when there is none. |
TALL_RATIO | 定数 | The ratio of a tall container, width over height: two to three. |
TALL_SHAPES | 定数 | The shapes that are made tall. |
TALL_WIDTHS | 定数 | How many cells across each size of the tall levels is. |
tallDimensions | 関数 | The columns and rows of a maze of shape for the size width (a square maze of that size is width by one and a half times that): as near 2:3 as its cells allow, and with about as many cells as that square maze has (width times one and a half width), so that the sizes are as big to draw whatever the shape is. |
tapArrow | 関数 | Attempt to remove a native arrow and return the new game and removed/blocked/locked/ignored result. |
tapMaze | 関数 | A tap on a cell: the line runs along the passage toward it as far as the next place it could have gone another way, or to the cell itself if that comes first. |
toDisplay | 関数 | A logical point as it is shown. |
toggleStone | 関数 | A tap on a cell: a stone there is taken up, and otherwise one is laid. |
toLogical | 関数 | A point of the picture as the maze has it: the inverse of toDisplay. |
triangleGrid | 関数 | Rows of triangles, each pointing up or down in turn, w to a row; a cell is up when its column and row make an even number. |
Turn | 型 | 0 for a maze shown as it was made, 1 for a quarter turn counter-clockwise. |
turnedBox | 関数 | The rectangle a logical rectangle takes when shown. |
turnFor | 関数 | Whether to turn a maze box (as made) for an orientation. |
turnTransform | 関数 | The SVG transform that shows a logical drawing turned, or none. |
undoArrow | 関数 | Put the last arrow taken back, and give back no heart. |
undoMaze | 関数 | Put the whole line back as it was before the last stroke. |
unlockArrows | 関数 | Let the locked arrows be tapped. |
unturnedBox | 関数 | The logical rectangle a shown rectangle covers: the inverse of turnedBox. |
VERSION | 定数 | The package's version. |
walk | 関数 | How far every cell is from from along the passages, and the cell before it on the way: -1 where unreachable. |
Wall | 型 | The line a wall is drawn along, from a to b. |
withArrows | 関数 | The arrows changed. |
withMaze | 関数 | The labyrinth changed: when its button is reached, every locked arrow is unlocked. |
withStoneRules | 関数 | The same game under other rules (the limit or the reach changed, or stones turned on or off): the stones down stay down, and none is ever taken off by a lower limit, only no more laid. |
ZONE_REAL | 定数 | A zone with less than this share of an average zone's cells is not a zone (a cross's corners, a ring's hole). |
ZONE_VISIT | 定数 | The cells of the answer a zone must hold to be visited. |
zonesAcross | 関数 | How many zones along each axis a map of cells is cut into: a flat map by 2, 3 or 4, a solid by 2 or 3. |
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。