リファレンス
管・ルール・解法
import { … } from "@johnmorrisdotca/suido";
最小化と gzip 圧縮をしたサイズは 46.1 kB(読み込むものをすべて含み、esbuild で計測)
リファレンスの説明と例は英語です。見出しと目次は日本語です。
Pipe masks, board codes, water flow, game state, bounded solvers and seeded puzzle generation.
エクスポート
| 名前 | 種類 | 概要 |
|---|---|---|
armsOf | 関数 | How many sides a piece opens on. |
BIG_FAMILIES | 定数 | The families of BIG_SHAPES, each with how many shapes it holds, in the order they first appear there. |
BIG_KIND_LIST | 定数 | Every kind of big piece, in the order the generator draws them, with how often each is drawn. |
BIG_KINDS | 定数 | THE BIG PIECES: squares of four cells that are one piece (Layout.bigs). |
BIG_MIXES | 定数 | The mixes a generator draws a plate from, plainest first. |
BIG_PIECES_LARGEST | 定数 | The most, which scores full marks for size: a board of 20×20. |
BIG_PIECES_SMALLEST | 定数 | The fewest pieces the water goes through that count for anything: a board of 5×5. |
BIG_SCORE_WEIGHTS | 定数 | The weight of the size in the score, and of the tangle; they add to 1. |
BIG_SHAPES | 定数 | Every big piece there is, up to turning (BigShape): 699, ordered by how many pipes they hold, then how many openings they have, then family. |
BigKind | 型 | The name of a kind of big piece. |
bigKindOf | 関数 | Which kind of big piece four masks make, and the fewest quarters clockwise from facing north that bring it to them; null for four masks that are none of the five. |
bigMasksOf | 関数 | The masks of a big piece's four cells (clockwise from the top left) once it has been turned quarters quarters clockwise from facing north. |
BigMix | 型 | Which big pieces a generator draws from, from the plainest to every one there is: |
BigOnBoard | 型 | One big piece on a board: its top left cell, which of the 699 shapes it is, and how many quarters clockwise from the shape's own facing it is turned. |
bigScoreOf | 関数 | How hard a board is across the set, 1 to 100: a whole number. |
BigShape | 型 | EVERY BIG PIECE THERE CAN BE. |
bigShapeById | 関数 | The shape with this id, or undefined for four masks that make none. |
bigShapeOf | 関数 | Which shape four masks make, and the fewest quarters clockwise from the shape's own facing (BigShape.masks) that bring it to them; null for four masks that are none of the 699: a blank cell, a ring, a pipe with no opening to the outside. |
bigShapesIn | 関数 | The big pieces of a board and which shape each is, read from masks (one for every cell of the board, as a board's pieces or an answer's stand): the board's pieces for the facing it starts in, an answer's for the facing the water needs. |
blendBigScore | 関数 | The score of a board of used pieces whose tangle (exactDifficultyOf, 1 to 100 among boards of its size) is tangle, before it is rounded. |
blendOf | 関数 | The blend of a board's five percentiles against reference, 0 to 1, before it is ranked among the blends. |
Block | 型 | A block: its anchor (top left cell), whether it is a big piece, and its four cells clockwise from the top left. |
blockAt | 関数 | The block a cell is in, or null. |
blockCells | 関数 | The four cells of the block whose top left cell is anchor, clockwise from it. |
blockFacings | 関数 | Every distinct way a block can face, as the four masks of its cells (in Block.cells order), the turn of 0 quarters first. |
blockInfo | 関数 | The blocks of a board and the block each cell is in; read once for a layout and kept. |
BlockInfo | 型 | The blocks of a board, in the order of their anchors, and which block each cell is in (-1 for none). |
blockQuartersBetween | 関数 | How many quarters clockwise, 0 to 3, make the block's pieces in from the ones in to; null when no turn does. |
canTurn | 関数 | Whether a piece can be turned into a new facing: ground, and a cross, look the same turned any way. |
canTurnAt | 関数 | Whether a tap on cell of a game turns anything. |
canTurnBlock | 関数 | Whether turning a block changes anything: a block of four crosses, or four pieces that look alike all round, never does. |
cellChar | 関数 | A cell's character: its piece, marked as a source or a drain if it is one. |
checkSuidoAnswer | 関数 | Whether an answer solves a board: the check a page makes to say "solved" and a server makes before it trusts a solve. |
countSolutions | 関数 | How many answers there are, counted up to limit. |
coverageOf | 関数 | The share of a board's pieces the water goes through in an answer, 0 to 1: 1 for a network, which the water reaches every piece of. |
decodeLayout | 関数 | The board a code stands for, or null when it is not one: a bad size, an unknown character, a source or drain on bare ground, or no source at all. |
deduce | 関数 | The deductions of a board, in rounds. |
Deduction | 型 | What a player can work out without guessing, as a person would: look at every piece, fix what is forced, and look again. |
DIFFICULTY_SIDES | 定数 | The sizes (side of the board) there is a reference set for. |
DIFFICULTY_WEIGHTS | 定数 | The weights of the measures in the blend, for each kind. |
difficultyOf | 関数 | How hard a board is, 1 to 100 among boards of its size, from the board as given and one of its answers. |
EAST | 定数 | The east opening bit of a pipe mask. |
encodeLayout | 関数 | The code of a board. |
exactBigScoreOf | 関数 | How hard a board is across the set, 1 to 100, before it is rounded: what the levels are put in order by. |
exactDifficultyOf | 関数 | The same before it is rounded to a whole number, from 1 to 100: the order boards are put in. |
exactScoreOf | 関数 | The score of a measure against a reference set before it is rounded, from 1 to 100: what boards are put in order by, so that two boards of one whole score still have an order. |
Flow | 型 | Where the water is on a board as it is turned: the whole picture, from the pump outwards. |
flowOf | 関数 | The water on a board whose pieces face as masks say. |
flowOfGame | 関数 | The water on a game. |
Game | 型 | A game in play: the board as it was given, how every piece faces now, and how far each has been turned in all (kept as a count rather than a facing, so a drawing can turn a piece the way it was tapped, never the long way round). |
gameCode | 関数 | The game as a code, every piece facing as it does now: what to keep to come back to it, and what to send to be checked. |
gameFromCode | 関数 | A game from a board's code and the code of the board as it was left (gameCode): every piece facing as the kept code says, with the fewest quarters clockwise that get each there. |
gameFromProgress | 関数 | The game a board's code and a kept gameProgress make, or null when the code is not a board or the progress is not one of that board's. |
gameProgress | 関数 | A game half played, as a short string to keep: one digit for each piece (the quarter turns clockwise it has had from the way the board gave it, 0 to 3; the four pieces of a block have the digit of the block), a colon, and the number of taps made. |
GuidePiece | 型 | One piece of the guide. |
guidePieceById | 関数 | The entry with this id, or undefined. |
guidePiecesOf | 関数 | The pieces of one group, in the order of the guide. |
hasBlocks | 関数 | Whether a board has any block. |
hintFor | 関数 | A piece to turn, for a player who asks for help: the first piece that does not face as answer says, nearest the pump first (the water's own order), or null when every piece does. |
inBigMix | 関数 | Whether a shape belongs to a mix of the shapes (BigMix, not five). |
isGameSolved | 関数 | Whether the game is solved: the same test the check makes of an answer. |
isJoinedInside | 関数 | Whether the inside of a big piece is as it must be: wherever two of its cells meet, either both open towards each other or neither does. |
isLocked | 関数 | Whether a piece is locked on this board. |
isSolved | 関数 | Whether a board facing as masks say is solved. |
isTwisted | 関数 | Whether a board has any twist. |
Kind | 型 | What a board asks of the water. |
Layout | 型 | A board. |
laySuido | 関数 | A board laid out and turned at random, with no promise about how many answers it has: the raw material makeSuido shapes. |
Made | 型 | A new board: its code, the code of its one answer, and what it was made from. |
MadeScored | 型 | A new board with how hard it is. |
MakeOptions | 型 | What a new board may be asked for. |
makeSuido | 関数 | Makes a board with exactly one answer and says how hard it is. |
makeUnscored | 関数 | Makes a board that has exactly one answer. |
MAX_SIDE | 定数 | The largest side a board may have. |
Measure | 型 | What is measured of one board. |
MEASURE_NAMES | 定数 | The measures, in the order the reference lists them. |
MeasureName | 型 | The measures, by name. |
measureSuido | 関数 | Every measure of one board, from the board as given and one of its answers. |
neighboursOf | 関数 | Which cell is next to each cell on each side: table[cell * 4 + side], or -1 where there is no cell (the edge of a board that does not wrap) or a wall. |
newGame | 関数 | A game on a board, with every piece as given. |
NORTH | 定数 | A side of a cell. |
opposite | 関数 | The side a piece next door must open on to meet an opening on side side. |
percentileIn | 関数 | Where value stands among sorted quantiles, 0 to 1: how far through them it is, by the share of the way between neighbours. |
PIECE_GROUPS | 定数 | The groups, in the order a guide shows them. |
PieceGroup | 型 | A GUIDE TO EVERY PIECE. |
placeAfter | 関数 | Where the piece that stood in cell when the board was given is now, once its block has been turned quarters times clockwise. |
placeBlocks | 関数 | Places blocks on a board of width by height, where near is the table of neighbours with no walls (neighboursOf): bigs big pieces, each of a kind drawn at random facing a way that has no opening off the edge of the board, and turning blocks that turn as one. |
Placed | 型 | A block placed on a board by the generator: kind is a kind of BIG_KINDS or the id of a BigShape, and null for a block that turns as one. |
quantilesOf | 関数 | Quantiles of a list of numbers, at points even steps from least to greatest, for a reference set. |
quartersBetween | 関数 | The fewest quarter turns, clockwise, that make from into to; null when they are not the same shape. |
Random | 型 | A number in [0, 1), like Math.random, from a stream a seed fixes. |
Reference | 型 | A reference set of boards, as quantiles: every measure at 21 even steps from its least to its greatest, and the blend of the five at 101. |
referenceFor | 関数 | The reference set a board is scored against: that of the board's side (the square root of its cells, to the nearest size there is a set for), kind and wrap. |
referenceKey | 関数 | The key a reference set is kept under. |
rotationsOf | 関数 | Every way a piece can face, each once and in order: one for a cross, two for a straight, four for the rest. |
sameBlock | 関数 | Whether two cells of a board are in the same block. |
scoreOf | 関数 | The score of a measure against a reference set: 1 (the plainest of its size) to 100. |
seededRandom | 関数 | A stream of numbers in [0, 1) fixed by a seed. |
Shape | 型 | What a piece is, by how many sides it opens on and where. |
SHAPE_MASKS | 定数 | A piece of each shape facing north, as the drawings and the tests name them. |
shapeOf | 関数 | The shape of a piece, from the sides it opens on. |
shuffled | 関数 | A copy of the list in a random order (Fisher–Yates); the list given is left alone. |
SIDE_STEPS | 定数 | The step across each side, as columns and rows. |
SIDES | 定数 | The four sides by number, 0 (north) to 3 (west): the bit of side i is 1 << i. |
sizeTermOf | 関数 | How big a board is for scoring, 0 to 1: the pieces its answer uses, on a log scale from BIG_PIECES_SMALLEST to BIG_PIECES_LARGEST. |
solve | 関数 | Counts the answers to a board, up to limit, stopping early when budget positions have been looked at. |
SolveResult | 型 | What the solver found. |
SOUTH | 定数 | The south opening bit of a pipe mask. |
SUIDO_BIG_FAMILIES_GUIDE | 定数 | ONE BIG PIECE OF EACH FAMILY. |
SUIDO_LEVEL_TWISTS | 定数 | The six twists the fixed levels have, in the order they teach them. |
SUIDO_PIECE_GUIDE | 定数 | EVERY PIECE, with a picture to draw it by. |
SUIDO_TWISTS | 定数 | Every twist, the six the fixed levels teach in the order they teach them, then the two of boards made on request. |
SuidoCheck | 型 | What a check says: solved, or the first reason it is not. |
symmetryKey | 関数 | A board's identity up to turning and mirroring it: the smallest of the codes of its eight turns and mirrors, with every piece the water does not go through (it may face any way) set to one facing. |
tapsBetween | 関数 | The taps it takes to face a piece the right way when a tap turns it one way only (both false) or either way (both true, the shorter of the two). |
tapsToAnswer | 関数 | The fewest taps that would turn every piece to face as answer says, when a tap turns a piece either way (both, the default) or clockwise only. |
transformLayout | 関数 | A board's cells, pumps, drains, locks, walls and blocks moved by one of the eight turns and mirrors: op 0 to 3 turn it a quarter at a time, 4 to 7 do so after a mirror. |
turn | 関数 | A piece turned quarters quarter turns clockwise; a negative number turns it the other way. |
turnAt | 関数 | A tap: the piece on cell turned a quarter, clockwise (by 1) or the other way (by -1); a cell in a block turns the whole block, its pieces moving round to the next cell as they turn. |
turnBlock | 関数 | The pieces of a board after a block is turned by quarters clockwise (a negative number turns it the other way): the piece in each cell of the block moves round to the next and turns with the block. |
turnedToFaceAt | 関数 | What a Hint does: the piece at cell turned clockwise, as many taps as it takes, to face as answer says; a block, the whole block, whichever of its cells is named. |
turnsFromAnswer | 関数 | The turns a board needs, when taps turn a piece either way: how far it is from solved. |
Twist | 型 | THE TWISTS: what a board can ask of a player beyond turning every piece until the water reaches all of them. |
twistsOf | 関数 | The twists a board has, in the order the levels teach them: none for a plain board. |
usedPiecesOf | 関数 | How many pieces the water goes through in an answer. |
VERSION | 定数 | The package's version. |
WEST | 定数 | The west opening bit of a pipe mask. |
withMasks | 関数 | The same board with its pieces facing as masks says, which is how a half-played board or an answer is kept. |
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。