@logic-pad/core 0.26.1 → 0.26.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +31 -31
- package/assets/logic-core.global.d.ts +3264 -3262
- package/package.json +4 -1
- package/dist/benchmark/helper.d.ts +0 -21
- package/dist/benchmark/helper.js +0 -34
- package/dist/benchmark/prepareBench.d.ts +0 -1
- package/dist/benchmark/prepareBench.js +0 -140
- package/dist/benchmark/runBench.d.ts +0 -1
- package/dist/benchmark/runBench.js +0 -206
- package/dist/src/data/config.d.ts +0 -119
- package/dist/src/data/config.js +0 -72
- package/dist/src/data/configurable.d.ts +0 -14
- package/dist/src/data/configurable.js +0 -26
- package/dist/src/data/dataHelper.d.ts +0 -92
- package/dist/src/data/dataHelper.js +0 -217
- package/dist/src/data/events/eventHelper.d.ts +0 -1
- package/dist/src/data/events/eventHelper.js +0 -6
- package/dist/src/data/events/onFinalValidation.d.ts +0 -14
- package/dist/src/data/events/onFinalValidation.js +0 -4
- package/dist/src/data/events/onGetTile.d.ts +0 -7
- package/dist/src/data/events/onGetTile.js +0 -4
- package/dist/src/data/events/onGridChange.d.ts +0 -6
- package/dist/src/data/events/onGridChange.js +0 -4
- package/dist/src/data/events/onGridResize.d.ts +0 -9
- package/dist/src/data/events/onGridResize.js +0 -4
- package/dist/src/data/events/onSetGrid.d.ts +0 -7
- package/dist/src/data/events/onSetGrid.js +0 -19
- package/dist/src/data/events/onSymbolDisplay.d.ts +0 -16
- package/dist/src/data/events/onSymbolDisplay.js +0 -4
- package/dist/src/data/events/onSymbolMerge.d.ts +0 -10
- package/dist/src/data/events/onSymbolMerge.js +0 -4
- package/dist/src/data/events/onSymbolValidation.d.ts +0 -18
- package/dist/src/data/events/onSymbolValidation.js +0 -4
- package/dist/src/data/grid.d.ts +0 -410
- package/dist/src/data/grid.js +0 -1106
- package/dist/src/data/gridConnections.d.ts +0 -25
- package/dist/src/data/gridConnections.js +0 -309
- package/dist/src/data/gridZones.d.ts +0 -26
- package/dist/src/data/gridZones.js +0 -117
- package/dist/src/data/instruction.d.ts +0 -26
- package/dist/src/data/instruction.js +0 -29
- package/dist/src/data/primitives.d.ts +0 -138
- package/dist/src/data/primitives.js +0 -177
- package/dist/src/data/puzzle.d.ts +0 -73
- package/dist/src/data/puzzle.js +0 -105
- package/dist/src/data/rules/banPatternRule.d.ts +0 -30
- package/dist/src/data/rules/banPatternRule.js +0 -125
- package/dist/src/data/rules/cellCountPerZoneRule.d.ts +0 -23
- package/dist/src/data/rules/cellCountPerZoneRule.js +0 -39
- package/dist/src/data/rules/cellCountRule.d.ts +0 -33
- package/dist/src/data/rules/cellCountRule.js +0 -138
- package/dist/src/data/rules/completePatternRule.d.ts +0 -24
- package/dist/src/data/rules/completePatternRule.js +0 -46
- package/dist/src/data/rules/connectAllRule.d.ts +0 -29
- package/dist/src/data/rules/connectAllRule.js +0 -88
- package/dist/src/data/rules/connectZonesRule.d.ts +0 -29
- package/dist/src/data/rules/connectZonesRule.js +0 -111
- package/dist/src/data/rules/containsShapeRule.d.ts +0 -34
- package/dist/src/data/rules/containsShapeRule.js +0 -125
- package/dist/src/data/rules/customRule.d.ts +0 -34
- package/dist/src/data/rules/customRule.js +0 -74
- package/dist/src/data/rules/differentCountPerZoneRule.d.ts +0 -30
- package/dist/src/data/rules/differentCountPerZoneRule.js +0 -96
- package/dist/src/data/rules/exactCountPerZoneRule.d.ts +0 -33
- package/dist/src/data/rules/exactCountPerZoneRule.js +0 -99
- package/dist/src/data/rules/foresightRule.d.ts +0 -36
- package/dist/src/data/rules/foresightRule.js +0 -107
- package/dist/src/data/rules/index.d.ts +0 -3
- package/dist/src/data/rules/index.js +0 -10
- package/dist/src/data/rules/lyingSymbolRule.d.ts +0 -31
- package/dist/src/data/rules/lyingSymbolRule.js +0 -207
- package/dist/src/data/rules/musicControlLine.d.ts +0 -82
- package/dist/src/data/rules/musicControlLine.js +0 -167
- package/dist/src/data/rules/musicGridRule.d.ts +0 -51
- package/dist/src/data/rules/musicGridRule.js +0 -212
- package/dist/src/data/rules/mysteryRule.d.ts +0 -39
- package/dist/src/data/rules/mysteryRule.js +0 -146
- package/dist/src/data/rules/noLoopsRule.d.ts +0 -29
- package/dist/src/data/rules/noLoopsRule.js +0 -218
- package/dist/src/data/rules/offByXRule.d.ts +0 -32
- package/dist/src/data/rules/offByXRule.js +0 -124
- package/dist/src/data/rules/perfectionRule.d.ts +0 -45
- package/dist/src/data/rules/perfectionRule.js +0 -158
- package/dist/src/data/rules/regionAreaRule.d.ts +0 -34
- package/dist/src/data/rules/regionAreaRule.js +0 -149
- package/dist/src/data/rules/regionShapeRule.d.ts +0 -22
- package/dist/src/data/rules/regionShapeRule.js +0 -58
- package/dist/src/data/rules/rule.d.ts +0 -18
- package/dist/src/data/rules/rule.js +0 -19
- package/dist/src/data/rules/rules.gen.d.ts +0 -23
- package/dist/src/data/rules/rules.gen.js +0 -27
- package/dist/src/data/rules/sameCountPerZoneRule.d.ts +0 -30
- package/dist/src/data/rules/sameCountPerZoneRule.js +0 -95
- package/dist/src/data/rules/sameShapeRule.d.ts +0 -28
- package/dist/src/data/rules/sameShapeRule.js +0 -68
- package/dist/src/data/rules/symbolsPerRegionRule.d.ts +0 -38
- package/dist/src/data/rules/symbolsPerRegionRule.js +0 -181
- package/dist/src/data/rules/undercluedRule.d.ts +0 -24
- package/dist/src/data/rules/undercluedRule.js +0 -53
- package/dist/src/data/rules/uniqueShapeRule.d.ts +0 -28
- package/dist/src/data/rules/uniqueShapeRule.js +0 -65
- package/dist/src/data/rules/wrapAroundRule.d.ts +0 -36
- package/dist/src/data/rules/wrapAroundRule.js +0 -241
- package/dist/src/data/serializer/allSerializers.d.ts +0 -32
- package/dist/src/data/serializer/allSerializers.js +0 -71
- package/dist/src/data/serializer/compressor/allCompressors.d.ts +0 -14
- package/dist/src/data/serializer/compressor/allCompressors.js +0 -43
- package/dist/src/data/serializer/compressor/checksumCompressor.d.ts +0 -6
- package/dist/src/data/serializer/compressor/checksumCompressor.js +0 -21
- package/dist/src/data/serializer/compressor/compressorBase.d.ts +0 -16
- package/dist/src/data/serializer/compressor/compressorBase.js +0 -2
- package/dist/src/data/serializer/compressor/deflateCompressor.d.ts +0 -7
- package/dist/src/data/serializer/compressor/deflateCompressor.js +0 -17
- package/dist/src/data/serializer/compressor/gzipCompressor.d.ts +0 -5
- package/dist/src/data/serializer/compressor/gzipCompressor.js +0 -9
- package/dist/src/data/serializer/compressor/streamCompressor.d.ts +0 -6
- package/dist/src/data/serializer/compressor/streamCompressor.js +0 -41
- package/dist/src/data/serializer/serializerBase.d.ts +0 -32
- package/dist/src/data/serializer/serializerBase.js +0 -2
- package/dist/src/data/serializer/serializer_checksum.d.ts +0 -35
- package/dist/src/data/serializer/serializer_checksum.js +0 -179
- package/dist/src/data/serializer/serializer_v0.d.ts +0 -55
- package/dist/src/data/serializer/serializer_v0.js +0 -484
- package/dist/src/data/shapes.d.ts +0 -19
- package/dist/src/data/shapes.js +0 -137
- package/dist/src/data/solver/allSolvers.d.ts +0 -3
- package/dist/src/data/solver/allSolvers.js +0 -13
- package/dist/src/data/solver/auto/autoSolver.d.ts +0 -18
- package/dist/src/data/solver/auto/autoSolver.js +0 -156
- package/dist/src/data/solver/backtrack/backtrackSolver.d.ts +0 -11
- package/dist/src/data/solver/backtrack/backtrackSolver.js +0 -54
- package/dist/src/data/solver/backtrack/backtrackWorker.d.ts +0 -1
- package/dist/src/data/solver/backtrack/backtrackWorker.js +0 -312
- package/dist/src/data/solver/backtrack/data.d.ts +0 -47
- package/dist/src/data/solver/backtrack/data.js +0 -151
- package/dist/src/data/solver/backtrack/rules/banPattern.d.ts +0 -9
- package/dist/src/data/solver/backtrack/rules/banPattern.js +0 -77
- package/dist/src/data/solver/backtrack/rules/cellCount.d.ts +0 -7
- package/dist/src/data/solver/backtrack/rules/cellCount.js +0 -25
- package/dist/src/data/solver/backtrack/rules/connectAll.d.ts +0 -7
- package/dist/src/data/solver/backtrack/rules/connectAll.js +0 -44
- package/dist/src/data/solver/backtrack/rules/regionArea.d.ts +0 -8
- package/dist/src/data/solver/backtrack/rules/regionArea.js +0 -71
- package/dist/src/data/solver/backtrack/rules/regionShape.d.ts +0 -8
- package/dist/src/data/solver/backtrack/rules/regionShape.js +0 -57
- package/dist/src/data/solver/backtrack/rules/sameShape.d.ts +0 -8
- package/dist/src/data/solver/backtrack/rules/sameShape.js +0 -14
- package/dist/src/data/solver/backtrack/rules/symbolsPerRegion.d.ts +0 -10
- package/dist/src/data/solver/backtrack/rules/symbolsPerRegion.js +0 -82
- package/dist/src/data/solver/backtrack/rules/uniqueShape.d.ts +0 -8
- package/dist/src/data/solver/backtrack/rules/uniqueShape.js +0 -14
- package/dist/src/data/solver/backtrack/symbols/areaNumber.d.ts +0 -9
- package/dist/src/data/solver/backtrack/symbols/areaNumber.js +0 -75
- package/dist/src/data/solver/backtrack/symbols/dart.d.ts +0 -8
- package/dist/src/data/solver/backtrack/symbols/dart.js +0 -45
- package/dist/src/data/solver/backtrack/symbols/directionLinker.d.ts +0 -11
- package/dist/src/data/solver/backtrack/symbols/directionLinker.js +0 -121
- package/dist/src/data/solver/backtrack/symbols/focus.d.ts +0 -9
- package/dist/src/data/solver/backtrack/symbols/focus.js +0 -48
- package/dist/src/data/solver/backtrack/symbols/galaxy.d.ts +0 -9
- package/dist/src/data/solver/backtrack/symbols/galaxy.js +0 -14
- package/dist/src/data/solver/backtrack/symbols/letter.d.ts +0 -9
- package/dist/src/data/solver/backtrack/symbols/letter.js +0 -95
- package/dist/src/data/solver/backtrack/symbols/lotus.d.ts +0 -11
- package/dist/src/data/solver/backtrack/symbols/lotus.js +0 -55
- package/dist/src/data/solver/backtrack/symbols/minesweeper.d.ts +0 -9
- package/dist/src/data/solver/backtrack/symbols/minesweeper.js +0 -44
- package/dist/src/data/solver/backtrack/symbols/myopia.d.ts +0 -7
- package/dist/src/data/solver/backtrack/symbols/myopia.js +0 -73
- package/dist/src/data/solver/backtrack/symbols/viewpoint.d.ts +0 -7
- package/dist/src/data/solver/backtrack/symbols/viewpoint.js +0 -51
- package/dist/src/data/solver/cspuz/cspuzSolver.d.ts +0 -13
- package/dist/src/data/solver/cspuz/cspuzSolver.js +0 -124
- package/dist/src/data/solver/cspuz/cspuzWorker.d.ts +0 -1
- package/dist/src/data/solver/cspuz/cspuzWorker.js +0 -82
- package/dist/src/data/solver/cspuz/jsonify.d.ts +0 -3
- package/dist/src/data/solver/cspuz/jsonify.js +0 -215
- package/dist/src/data/solver/eventIteratingSolver.d.ts +0 -8
- package/dist/src/data/solver/eventIteratingSolver.js +0 -54
- package/dist/src/data/solver/solver.d.ts +0 -77
- package/dist/src/data/solver/solver.js +0 -59
- package/dist/src/data/solver/universal/universalSolver.d.ts +0 -7
- package/dist/src/data/solver/universal/universalSolver.js +0 -13
- package/dist/src/data/solver/universal/universalWorker.d.ts +0 -1
- package/dist/src/data/solver/universal/universalWorker.js +0 -128
- package/dist/src/data/symbols/areaNumberSymbol.d.ts +0 -31
- package/dist/src/data/symbols/areaNumberSymbol.js +0 -80
- package/dist/src/data/symbols/customIconSymbol.d.ts +0 -35
- package/dist/src/data/symbols/customIconSymbol.js +0 -94
- package/dist/src/data/symbols/customSymbol.d.ts +0 -25
- package/dist/src/data/symbols/customSymbol.js +0 -45
- package/dist/src/data/symbols/customTextSymbol.d.ts +0 -35
- package/dist/src/data/symbols/customTextSymbol.js +0 -95
- package/dist/src/data/symbols/dartSymbol.d.ts +0 -36
- package/dist/src/data/symbols/dartSymbol.js +0 -96
- package/dist/src/data/symbols/directionLinkerSymbol.d.ts +0 -29
- package/dist/src/data/symbols/directionLinkerSymbol.js +0 -232
- package/dist/src/data/symbols/everyLetterSymbol.d.ts +0 -32
- package/dist/src/data/symbols/everyLetterSymbol.js +0 -119
- package/dist/src/data/symbols/focusSymbol.d.ts +0 -40
- package/dist/src/data/symbols/focusSymbol.js +0 -159
- package/dist/src/data/symbols/galaxySymbol.d.ts +0 -27
- package/dist/src/data/symbols/galaxySymbol.js +0 -61
- package/dist/src/data/symbols/hiddenSymbol.d.ts +0 -38
- package/dist/src/data/symbols/hiddenSymbol.js +0 -113
- package/dist/src/data/symbols/houseSymbol.d.ts +0 -33
- package/dist/src/data/symbols/houseSymbol.js +0 -104
- package/dist/src/data/symbols/index.d.ts +0 -3
- package/dist/src/data/symbols/index.js +0 -10
- package/dist/src/data/symbols/letterSymbol.d.ts +0 -32
- package/dist/src/data/symbols/letterSymbol.js +0 -118
- package/dist/src/data/symbols/lotusSymbol.d.ts +0 -30
- package/dist/src/data/symbols/lotusSymbol.js +0 -132
- package/dist/src/data/symbols/minesweeperSymbol.d.ts +0 -33
- package/dist/src/data/symbols/minesweeperSymbol.js +0 -106
- package/dist/src/data/symbols/myopiaSymbol.d.ts +0 -37
- package/dist/src/data/symbols/myopiaSymbol.js +0 -182
- package/dist/src/data/symbols/numberSymbol.d.ts +0 -19
- package/dist/src/data/symbols/numberSymbol.js +0 -32
- package/dist/src/data/symbols/symbol.d.ts +0 -29
- package/dist/src/data/symbols/symbol.js +0 -87
- package/dist/src/data/symbols/symbols.gen.d.ts +0 -15
- package/dist/src/data/symbols/symbols.gen.js +0 -19
- package/dist/src/data/symbols/unsupportedSymbol.d.ts +0 -23
- package/dist/src/data/symbols/unsupportedSymbol.js +0 -47
- package/dist/src/data/symbols/viewpointSymbol.d.ts +0 -32
- package/dist/src/data/symbols/viewpointSymbol.js +0 -95
- package/dist/src/data/tile.d.ts +0 -26
- package/dist/src/data/tile.js +0 -56
- package/dist/src/data/tileConnections.d.ts +0 -25
- package/dist/src/data/tileConnections.js +0 -74
- package/dist/src/data/validate.d.ts +0 -5
- package/dist/src/data/validate.js +0 -131
- package/dist/src/data/validateAsync.d.ts +0 -15
- package/dist/src/data/validateAsync.js +0 -71
- package/dist/src/data/validateAsyncWorker.d.ts +0 -1
- package/dist/src/data/validateAsyncWorker.js +0 -9
- package/dist/src/index.d.ts +0 -109
- package/dist/src/index.js +0 -112
- package/dist/src/polyfill/streamPolyfill.d.ts +0 -2
- package/dist/src/polyfill/streamPolyfill.js +0 -1
package/dist/src/data/grid.d.ts
DELETED
|
@@ -1,410 +0,0 @@
|
|
|
1
|
-
import GridConnections from './gridConnections.js';
|
|
2
|
-
import { CachedAccess } from './dataHelper.js';
|
|
3
|
-
import { Color, Direction, Orientation, Position } from './primitives.js';
|
|
4
|
-
import Rule from './rules/rule.js';
|
|
5
|
-
import Symbol from './symbols/symbol.js';
|
|
6
|
-
import TileData from './tile.js';
|
|
7
|
-
import MusicGridRule from './rules/musicGridRule.js';
|
|
8
|
-
import CompletePatternRule from './rules/completePatternRule.js';
|
|
9
|
-
import UndercluedRule from './rules/undercluedRule.js';
|
|
10
|
-
import GridZones from './gridZones.js';
|
|
11
|
-
import WrapAroundRule from './rules/wrapAroundRule.js';
|
|
12
|
-
export declare const NEIGHBOR_OFFSETS: Position[];
|
|
13
|
-
export declare const NEIGHBOR_OFFSETS_8: Position[];
|
|
14
|
-
export default class GridData {
|
|
15
|
-
readonly width: number;
|
|
16
|
-
readonly height: number;
|
|
17
|
-
readonly tiles: readonly (readonly TileData[])[];
|
|
18
|
-
readonly connections: GridConnections;
|
|
19
|
-
readonly zones: GridZones;
|
|
20
|
-
readonly symbols: ReadonlyMap<string, readonly Symbol[]>;
|
|
21
|
-
readonly rules: readonly Rule[];
|
|
22
|
-
readonly musicGrid: CachedAccess<MusicGridRule | undefined>;
|
|
23
|
-
readonly completePattern: CachedAccess<CompletePatternRule | undefined>;
|
|
24
|
-
readonly underclued: CachedAccess<UndercluedRule | undefined>;
|
|
25
|
-
readonly wrapAround: CachedAccess<WrapAroundRule | undefined>;
|
|
26
|
-
/**
|
|
27
|
-
* Create a new grid with tiles, connections, symbols and rules.
|
|
28
|
-
*
|
|
29
|
-
* @param width The width of the grid.
|
|
30
|
-
* @param height The height of the grid.
|
|
31
|
-
* @param tiles The tiles of the grid.
|
|
32
|
-
* @param connections The connections of the grid, which determines which tiles are merged.
|
|
33
|
-
* @param zones The zones of the grid.
|
|
34
|
-
* @param symbols The symbols in the grid.
|
|
35
|
-
* @param rules The rules of the grid.
|
|
36
|
-
*/
|
|
37
|
-
constructor(width: number, height: number, tiles?: readonly (readonly TileData[])[], connections?: GridConnections, zones?: GridZones, symbols?: ReadonlyMap<string, readonly Symbol[]>, rules?: readonly Rule[]);
|
|
38
|
-
/**
|
|
39
|
-
* Create a new GridData object from a string array.
|
|
40
|
-
*
|
|
41
|
-
* - Use `b` for dark cells, `w` for light cells, and `n` for gray cells.
|
|
42
|
-
* - Capitalize the letter to make the tile fixed.
|
|
43
|
-
* - Use `.` to represent empty space.
|
|
44
|
-
*
|
|
45
|
-
* @param array - The string array to create the grid from.
|
|
46
|
-
* @returns The created grid.
|
|
47
|
-
*/
|
|
48
|
-
static create(array: string[]): GridData;
|
|
49
|
-
/**
|
|
50
|
-
* Create a new grid with tiles, connections, symbols and rules. Sanitize the provided list of symbols and rules,
|
|
51
|
-
* and trigger grid change events.
|
|
52
|
-
*
|
|
53
|
-
* @param width The width of the grid.
|
|
54
|
-
* @param height The height of the grid.
|
|
55
|
-
* @param tiles The tiles of the grid.
|
|
56
|
-
* @param connections The connections of the grid, which determines which tiles are merged.
|
|
57
|
-
* @param zones The zones of the grid.
|
|
58
|
-
* @param symbols The symbols in the grid.
|
|
59
|
-
* @param rules The rules of the grid.
|
|
60
|
-
*/
|
|
61
|
-
static create(width: number, height: number, tiles?: readonly (readonly TileData[])[], connections?: GridConnections, zones?: GridZones, symbols?: ReadonlyMap<string, readonly Symbol[]>, rules?: readonly Rule[], sanitize?: boolean, triggerEvents?: boolean): GridData;
|
|
62
|
-
/**
|
|
63
|
-
* Copy the current grid while modifying the provided properties.
|
|
64
|
-
* @param param0 The properties to modify.
|
|
65
|
-
* @returns The new grid with the modified properties.
|
|
66
|
-
*/
|
|
67
|
-
copyWith({ width, height, tiles, connections, zones, symbols, rules, }: {
|
|
68
|
-
width?: number;
|
|
69
|
-
height?: number;
|
|
70
|
-
tiles?: readonly (readonly TileData[])[];
|
|
71
|
-
connections?: GridConnections;
|
|
72
|
-
zones?: GridZones;
|
|
73
|
-
symbols?: ReadonlyMap<string, readonly Symbol[]>;
|
|
74
|
-
rules?: readonly Rule[];
|
|
75
|
-
}, sanitize?: boolean, triggerEvents?: boolean): GridData;
|
|
76
|
-
toArrayCoordinates(x: number, y: number): Position;
|
|
77
|
-
isPositionValid(x: number, y: number): boolean;
|
|
78
|
-
/**
|
|
79
|
-
* Safely get the tile at the given position.
|
|
80
|
-
* @param x The x-coordinate of the tile.
|
|
81
|
-
* @param y The y-coordinate of the tile.
|
|
82
|
-
* @returns The tile at the given position, or a non-existent tile if the position is invalid.
|
|
83
|
-
*/
|
|
84
|
-
getTile(x: number, y: number): TileData;
|
|
85
|
-
/**
|
|
86
|
-
* Safely set the tile at the given position.
|
|
87
|
-
* If the position is invalid, the tile array is returned unchanged.
|
|
88
|
-
* If the tile is merged with other tiles, the colors of all connected tiles are changed.
|
|
89
|
-
*
|
|
90
|
-
* @param x The x-coordinate of the tile.
|
|
91
|
-
* @param y The y-coordinate of the tile.
|
|
92
|
-
* @param tile The new tile to set.
|
|
93
|
-
* @returns The new tile array with updated tiles.
|
|
94
|
-
*/
|
|
95
|
-
setTile(x: number, y: number, tile: TileData | ((tile: TileData) => TileData)): readonly (readonly TileData[])[];
|
|
96
|
-
/**
|
|
97
|
-
* Replace or modify all tiles in the grid.
|
|
98
|
-
*
|
|
99
|
-
* @param tiles The new tile array or a function to mutate the existing tile array.
|
|
100
|
-
* @returns The new grid with the new tiles.
|
|
101
|
-
*/
|
|
102
|
-
withTiles(tiles: readonly (readonly TileData[])[] | ((value: TileData[][]) => readonly (readonly TileData[])[])): GridData;
|
|
103
|
-
/**
|
|
104
|
-
* Add or modify the connections in the grid.
|
|
105
|
-
* @param connections The new connections to add or modify.
|
|
106
|
-
* @returns The new grid with the new connections.
|
|
107
|
-
*/
|
|
108
|
-
withConnections(connections: GridConnections | ((value: GridConnections) => GridConnections)): GridData;
|
|
109
|
-
/**
|
|
110
|
-
* Add or modify the zones in the grid.
|
|
111
|
-
* @param zones The new zones to add or modify.
|
|
112
|
-
* @returns The new grid with the new zones.
|
|
113
|
-
*/
|
|
114
|
-
withZones(zones: GridZones | ((value: GridZones) => GridZones)): GridData;
|
|
115
|
-
/**
|
|
116
|
-
* Add or modify the symbols in the grid.
|
|
117
|
-
* @param symbols The new symbols to add or modify.
|
|
118
|
-
* @returns The new grid with the new symbols.
|
|
119
|
-
*/
|
|
120
|
-
withSymbols(symbols: readonly Symbol[] | ReadonlyMap<string, readonly Symbol[]> | ((value: Map<string, readonly Symbol[]>) => ReadonlyMap<string, readonly Symbol[]>)): GridData;
|
|
121
|
-
/**
|
|
122
|
-
* Add a new symbol to the grid.
|
|
123
|
-
* @param symbol The symbol to add.
|
|
124
|
-
* @returns The new grid with the new symbol.
|
|
125
|
-
*/
|
|
126
|
-
addSymbol(symbol: Symbol): GridData;
|
|
127
|
-
/**
|
|
128
|
-
* Remove an instance of the symbol from the grid.
|
|
129
|
-
* @param symbol The symbol to remove.
|
|
130
|
-
* @returns The new grid with the symbol removed.
|
|
131
|
-
*/
|
|
132
|
-
removeSymbol(symbol: Symbol): GridData;
|
|
133
|
-
/**
|
|
134
|
-
* Remove all symbols that satisfy the predicate.
|
|
135
|
-
* @param predicate The predicate to test each symbol with.
|
|
136
|
-
* @returns The new grid with the symbols removed.
|
|
137
|
-
*/
|
|
138
|
-
removeSymbolIf(predicate: (symbol: Symbol) => boolean): GridData;
|
|
139
|
-
/**
|
|
140
|
-
* Find the first symbol that satisfies the predicate.
|
|
141
|
-
* @param predicate The predicate to test each symbol with.
|
|
142
|
-
* @returns The first symbol that satisfies the predicate, or undefined if no symbol is found.
|
|
143
|
-
*/
|
|
144
|
-
findSymbol(predicate: (symbol: Symbol) => boolean): Symbol | undefined;
|
|
145
|
-
/**
|
|
146
|
-
* Replace an existing symbol with a new symbol.
|
|
147
|
-
* @param oldSymbol The symbol to replace.
|
|
148
|
-
* @param newSymbol The new symbol to replace with.
|
|
149
|
-
* @returns The new grid with the symbol replaced.
|
|
150
|
-
*/
|
|
151
|
-
replaceSymbol(oldSymbol: Symbol, newSymbol: Symbol): GridData;
|
|
152
|
-
/**
|
|
153
|
-
* Add or modify the rules in the grid.
|
|
154
|
-
* @param rules The new rules to add or modify.
|
|
155
|
-
* @returns The new grid with the new rules.
|
|
156
|
-
*/
|
|
157
|
-
withRules(rules: readonly Rule[] | ((value: readonly Rule[]) => readonly Rule[])): GridData;
|
|
158
|
-
/**
|
|
159
|
-
* Add a new rule to the grid.
|
|
160
|
-
* @param rule The rule to add.
|
|
161
|
-
* @returns The new grid with the new rule.
|
|
162
|
-
*/
|
|
163
|
-
addRule(rule: Rule): GridData;
|
|
164
|
-
/**
|
|
165
|
-
* Remove an instance of the rule from the grid.
|
|
166
|
-
* @param rule The rule to remove.
|
|
167
|
-
* @returns The new grid with the rule removed.
|
|
168
|
-
*/
|
|
169
|
-
removeRule(rule: Rule): GridData;
|
|
170
|
-
/**
|
|
171
|
-
* Remove all rules that satisfy the predicate.
|
|
172
|
-
* @param predicate The predicate to test each rule with.
|
|
173
|
-
* @returns The new grid with the rules removed.
|
|
174
|
-
*/
|
|
175
|
-
removeRuleIf(predicate: (rule: Rule) => boolean): GridData;
|
|
176
|
-
/**
|
|
177
|
-
* Find the first rule that satisfies the predicate.
|
|
178
|
-
* @param predicate The predicate to test each rule with.
|
|
179
|
-
* @returns The first rule that satisfies the predicate, or undefined if no rule is found.
|
|
180
|
-
*/
|
|
181
|
-
findRule(predicate: (rule: Rule) => boolean): Rule | undefined;
|
|
182
|
-
/**
|
|
183
|
-
* Replace an existing rule with a new rule.
|
|
184
|
-
* @param oldRule The rule to replace.
|
|
185
|
-
* @param newRule The new rule to replace with.
|
|
186
|
-
* @returns The new grid with the rule replaced.
|
|
187
|
-
*/
|
|
188
|
-
replaceRule(oldRule: Rule, newRule: Rule): GridData;
|
|
189
|
-
/**
|
|
190
|
-
* Insert a new column at the given index, shifting all components of the grid accordingly. Newly inserted tiles are gray.
|
|
191
|
-
* @param index The index to insert the column at.
|
|
192
|
-
* @returns The new grid with the new column inserted.
|
|
193
|
-
*/
|
|
194
|
-
insertColumn(index: number): GridData;
|
|
195
|
-
/**
|
|
196
|
-
* Insert a new row at the given index, shifting all components of the grid accordingly. Newly inserted tiles are gray.
|
|
197
|
-
* @param index The index to insert the row at.
|
|
198
|
-
* @returns The new grid with the new row inserted.
|
|
199
|
-
*/
|
|
200
|
-
insertRow(index: number): GridData;
|
|
201
|
-
/**
|
|
202
|
-
* Remove a column at the given index, shifting all components of the grid accordingly.
|
|
203
|
-
* @param index The index to remove the column at.
|
|
204
|
-
* @returns The new grid with the column removed.
|
|
205
|
-
*/
|
|
206
|
-
removeColumn(index: number): GridData;
|
|
207
|
-
/**
|
|
208
|
-
* Remove a row at the given index, shifting all components of the grid accordingly.
|
|
209
|
-
* @param index The index to remove the row at.
|
|
210
|
-
* @returns The new grid with the row removed.
|
|
211
|
-
*/
|
|
212
|
-
removeRow(index: number): GridData;
|
|
213
|
-
/**
|
|
214
|
-
* Resize the grid to the new width and height, shifting all components of the grid accordingly. Newly inserted tiles are gray.
|
|
215
|
-
* @param width The new width of the grid.
|
|
216
|
-
* @param height The new height of the grid.
|
|
217
|
-
* @returns The new grid with the new dimensions.
|
|
218
|
-
*/
|
|
219
|
-
resize(width: number, height: number): this;
|
|
220
|
-
/**
|
|
221
|
-
* Create a new mutable TileData array from a string array.
|
|
222
|
-
*
|
|
223
|
-
* - Use `b` for dark cells, `w` for light cells, and `n` for gray cells.
|
|
224
|
-
* - Capitalize the letter to make the tile fixed.
|
|
225
|
-
* - Use `.` to represent empty space.
|
|
226
|
-
*
|
|
227
|
-
* @param array - The string array to create the tiles from.
|
|
228
|
-
* @returns The created tile array.
|
|
229
|
-
*/
|
|
230
|
-
static createTiles(array: string[]): TileData[][];
|
|
231
|
-
/**
|
|
232
|
-
* Find a tile in the grid that satisfies the predicate.
|
|
233
|
-
*
|
|
234
|
-
* @param predicate The predicate to test each tile with.
|
|
235
|
-
* @returns The position of the first tile that satisfies the predicate, or undefined if no tile is found.
|
|
236
|
-
*/
|
|
237
|
-
find(predicate: (tile: TileData, x: number, y: number) => boolean): Position | undefined;
|
|
238
|
-
/**
|
|
239
|
-
* Iterate over all tiles in the same region as the given position that satisfy the predicate.
|
|
240
|
-
* The iteration stops when the callback returns a value that is not undefined.
|
|
241
|
-
* Non-existent tiles are not included in the iteration.
|
|
242
|
-
*
|
|
243
|
-
* @param position The position to start the iteration from. This position is included in the iteration.
|
|
244
|
-
* @param predicate The predicate to test each tile with. The callback is only called for tiles that satisfy this predicate.
|
|
245
|
-
* @param callback The callback to call for each tile that satisfies the predicate. The iteration stops when this callback returns a value that is not undefined.
|
|
246
|
-
* @param visited A 2D array to keep track of visited tiles. This array is modified by the function.
|
|
247
|
-
* @returns The value returned by the callback that stopped the iteration, or undefined if the iteration completed.
|
|
248
|
-
*/
|
|
249
|
-
iterateArea<T>(position: Position, predicate: (tile: TileData, logicalX: number, logicalY: number) => boolean, callback: (tile: TileData, x: number, y: number, logicalX: number, logicalY: number) => undefined | T, visited?: boolean[][]): T | undefined;
|
|
250
|
-
/**
|
|
251
|
-
* Iterate over all tiles in a straight line from the given position in the given direction that satisfy the predicate.
|
|
252
|
-
* The iteration stops when the callback returns a value that is not undefined.
|
|
253
|
-
* Non-existent tiles break the iteration.
|
|
254
|
-
*
|
|
255
|
-
* @param position The position to start the iteration from. This position is included in the iteration.
|
|
256
|
-
* @param direction The direction to iterate in.
|
|
257
|
-
* @param predicate The predicate to test each tile with. The callback is only called for tiles that satisfy this predicate.
|
|
258
|
-
* @param callback The callback to call for each tile that satisfies the predicate. The iteration stops when this callback returns a value that is not undefined.
|
|
259
|
-
* @param visited A 2D array to keep track of visited tiles. This array is modified by the function.
|
|
260
|
-
* @returns The value returned by the callback that stopped the iteration, or undefined if the iteration completed.
|
|
261
|
-
*/
|
|
262
|
-
iterateDirection<T>(position: Position, direction: Direction | Orientation, predicate: (tile: TileData, logicalX: number, logicalY: number) => boolean, callback: (tile: TileData, x: number, y: number, logicalX: number, logicalY: number) => T | undefined, visited?: boolean[][]): T | undefined;
|
|
263
|
-
/**
|
|
264
|
-
* Iterate over all tiles in a straight line from the given position in the given direction that satisfy the predicate.
|
|
265
|
-
* The iteration stops when the callback returns a value that is not undefined.
|
|
266
|
-
* Non-existent tiles are included in the iteration.
|
|
267
|
-
*
|
|
268
|
-
* @param position The position to start the iteration from. This position is included in the iteration.
|
|
269
|
-
* @param direction The direction to iterate in.
|
|
270
|
-
* @param predicate The predicate to test each tile with. The callback is only called for tiles that satisfy this predicate.
|
|
271
|
-
* @param callback The callback to call for each tile that satisfies the predicate. The iteration stops when this callback returns a value that is not undefined.
|
|
272
|
-
* @param visited A 2D array to keep track of visited tiles. This array is modified by the function.
|
|
273
|
-
* @returns The value returned by the callback that stopped the iteration, or undefined if the iteration completed.
|
|
274
|
-
*/
|
|
275
|
-
iterateDirectionAll<T>(position: Position, direction: Direction | Orientation, predicate: (tile: TileData, logicalX: number, logicalY: number) => boolean, callback: (tile: TileData, x: number, y: number, logicalX: number, logicalY: number) => T | undefined, visited?: boolean[][]): T | undefined;
|
|
276
|
-
/**
|
|
277
|
-
* Reduce the grid by zones defined in the GridZones.
|
|
278
|
-
*
|
|
279
|
-
* @param reducer The reducer function to apply to each zone.
|
|
280
|
-
* @param initializer The initializer function to create the initial value for each zone.
|
|
281
|
-
* @param visited A 2D array to keep track of visited tiles. This array is modified by the function.
|
|
282
|
-
* @returns An array of reduced values, one for each zone.
|
|
283
|
-
*/
|
|
284
|
-
reduceByZone<T>(reducer: (acc: T, tile: TileData, x: number, y: number, logicalX: number, logicalY: number) => T, initializer: () => T, visited?: boolean[][]): T[];
|
|
285
|
-
/**
|
|
286
|
-
* Check if every tile in the grid is filled with a color other than gray.
|
|
287
|
-
*
|
|
288
|
-
* @returns True if every tile is filled with a color other than gray, false otherwise.
|
|
289
|
-
*/
|
|
290
|
-
isComplete(): boolean;
|
|
291
|
-
/**
|
|
292
|
-
* Iterate over all tiles in the grid.
|
|
293
|
-
* The iteration stops when the callback returns a value that is not undefined.
|
|
294
|
-
*
|
|
295
|
-
* @param callback The callback to call for each tile.
|
|
296
|
-
* @returns The value returned by the callback that stopped the iteration, or undefined if the iteration completed.
|
|
297
|
-
*/
|
|
298
|
-
forEach<T>(callback: (tile: TileData, x: number, y: number) => T | undefined): T | undefined;
|
|
299
|
-
/**
|
|
300
|
-
* Flood fill a continuous region starting from the given position with the given color.
|
|
301
|
-
*
|
|
302
|
-
* @param position The position to start the flood fill from.
|
|
303
|
-
* @param from The color of the tiles to fill.
|
|
304
|
-
* @param to The color to fill the tiles with.
|
|
305
|
-
* @param allowFixed Whether to fill fixed tiles.
|
|
306
|
-
* @returns The new grid with the region filled with the new color.
|
|
307
|
-
*/
|
|
308
|
-
floodFill(position: Position, from: Color, to: Color, allowFixed: boolean): GridData;
|
|
309
|
-
/**
|
|
310
|
-
* Flood fill all tiles with the given color to a new color, even if they are not connected.
|
|
311
|
-
*
|
|
312
|
-
* @param from The color of the tiles to fill.
|
|
313
|
-
* @param to The color to fill the tiles with.
|
|
314
|
-
* @param allowFixed Whether to fill fixed tiles.
|
|
315
|
-
* @returns The new grid with all tiles filled with the new color.
|
|
316
|
-
*/
|
|
317
|
-
floodFillAll(from: Color, to: Color, allowFixed: boolean): GridData;
|
|
318
|
-
/**
|
|
319
|
-
* Check if the grid has any instructions that require a custom solution.
|
|
320
|
-
* @returns True if the grid has any instructions that require a custom solution, false otherwise.
|
|
321
|
-
*/
|
|
322
|
-
requireSolution(): boolean;
|
|
323
|
-
/**
|
|
324
|
-
* Reset all non-fixed tiles to gray.
|
|
325
|
-
*
|
|
326
|
-
* @returns The new grid with all non-fixed tiles reset to gray.
|
|
327
|
-
*/
|
|
328
|
-
resetTiles(): this;
|
|
329
|
-
/**
|
|
330
|
-
* Copy the tiles in the given region to a new grid.
|
|
331
|
-
* All connections and symbols within the selected region are copied.
|
|
332
|
-
* All rules are included as well.
|
|
333
|
-
*
|
|
334
|
-
* @param origin The top-left corner of the region to copy.
|
|
335
|
-
* @param width The width of the region to copy.
|
|
336
|
-
* @param height The height of the region to copy.
|
|
337
|
-
* @returns The new grid with the copied tiles.
|
|
338
|
-
*/
|
|
339
|
-
copyTiles(origin: Position, width: number, height: number): GridData;
|
|
340
|
-
/**
|
|
341
|
-
* Paste the tiles from the given grid to the current grid at the given position.
|
|
342
|
-
* All connections, symbols, and rules are merged.
|
|
343
|
-
*
|
|
344
|
-
* @param origin The top-left corner of the region to paste the tiles to.
|
|
345
|
-
* @param grid The grid to paste the tiles from.
|
|
346
|
-
* @returns The new grid with the pasted tiles.
|
|
347
|
-
*/
|
|
348
|
-
pasteTiles(origin: Position, grid: GridData): GridData;
|
|
349
|
-
/**
|
|
350
|
-
* Paste the tiles from the given array to the current grid at the given position.
|
|
351
|
-
*
|
|
352
|
-
* @param origin The top-left corner of the region to paste the tiles to.
|
|
353
|
-
* @param tile The array of tiles to paste.
|
|
354
|
-
* @returns The new grid with the pasted tiles.
|
|
355
|
-
*/
|
|
356
|
-
pasteTiles(origin: Position, tile: readonly (readonly TileData[])[]): GridData;
|
|
357
|
-
/**
|
|
358
|
-
* Check if this grid is equal to another grid in terms of size and tile colors.
|
|
359
|
-
* Rules, symbols, and connections are not compared.
|
|
360
|
-
*
|
|
361
|
-
* @param grid The grid to compare with.
|
|
362
|
-
* @returns True if the grids are equal in size and tile colors, false otherwise.
|
|
363
|
-
*/
|
|
364
|
-
colorEquals(grid: GridData): boolean;
|
|
365
|
-
/**
|
|
366
|
-
* Check if this grid is equal to another grid in terms of size, tile colors, connections, symbols, and rules.
|
|
367
|
-
*
|
|
368
|
-
* @param other The grid to compare with.
|
|
369
|
-
* @returns True if the grids are equal, false otherwise.
|
|
370
|
-
*/
|
|
371
|
-
equals(other: GridData): boolean;
|
|
372
|
-
/**
|
|
373
|
-
* Get the count of tiles that satisfy the given conditions.
|
|
374
|
-
* @param exists Whether the tile exists or not.
|
|
375
|
-
* @param fixed Whether the tile is fixed or not. If undefined, the fixed state is ignored.
|
|
376
|
-
* @param color The color of the tile. If undefined, all colors are included.
|
|
377
|
-
* @returns The count of tiles that satisfy the given conditions.
|
|
378
|
-
*/
|
|
379
|
-
getTileCount(exists: boolean, fixed?: boolean, color?: Color): number;
|
|
380
|
-
/**
|
|
381
|
-
* Get the count of tiles that satisfy the given conditions for each color.
|
|
382
|
-
* @param color The color of the tiles.
|
|
383
|
-
* @returns The count of tiles that satisfy the given conditions for each color.
|
|
384
|
-
*/
|
|
385
|
-
getColorCount(color: Color): {
|
|
386
|
-
min: number;
|
|
387
|
-
max: number;
|
|
388
|
-
};
|
|
389
|
-
/**
|
|
390
|
-
* Deduplicate the rules in the given list.
|
|
391
|
-
*
|
|
392
|
-
* @param rules The list of rules to deduplicate.
|
|
393
|
-
* @returns The deduplicated list of rules.
|
|
394
|
-
*/
|
|
395
|
-
static deduplicateRules(rules: readonly Rule[]): Rule[];
|
|
396
|
-
/**
|
|
397
|
-
* Deduplicate the singleton rules in the given list.
|
|
398
|
-
*
|
|
399
|
-
* @param rules The list of rules to deduplicate.
|
|
400
|
-
* @returns The deduplicated list of rules.
|
|
401
|
-
*/
|
|
402
|
-
static deduplicateSingletonRules(rules: readonly Rule[]): Rule[];
|
|
403
|
-
/**
|
|
404
|
-
* Deduplicate the symbols in the given map.
|
|
405
|
-
*
|
|
406
|
-
* @param symbols The map of symbols to deduplicate.
|
|
407
|
-
* @returns The deduplicated map of symbols.
|
|
408
|
-
*/
|
|
409
|
-
static deduplicateSymbols(symbols: ReadonlyMap<string, readonly Symbol[]>): Map<string, Symbol[]>;
|
|
410
|
-
}
|