@logic-pad/core 0.22.0 → 0.22.1
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/assets/logic-core.global.d.ts +1 -1
- package/dist/data/rules/connectZonesRule.d.ts +2 -2
- package/dist/data/rules/connectZonesRule.js +25 -16
- package/dist/data/rules/rules.gen.d.ts +1 -1
- package/dist/data/rules/rules.gen.js +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/package.json +1 -1
|
@@ -1660,7 +1660,7 @@ declare global {
|
|
|
1660
1660
|
copyWith({ color }: { color?: Color }): this;
|
|
1661
1661
|
withColor(color: Color): this;
|
|
1662
1662
|
}
|
|
1663
|
-
export declare class
|
|
1663
|
+
export declare class ConnectZonesRule extends Rule {
|
|
1664
1664
|
readonly color: Color;
|
|
1665
1665
|
readonly title = 'Connect Zones';
|
|
1666
1666
|
private static readonly CONFIGS;
|
|
@@ -2,7 +2,7 @@ import { AnyConfig } from '../config.js';
|
|
|
2
2
|
import GridData from '../grid.js';
|
|
3
3
|
import { Color, RuleState } from '../primitives.js';
|
|
4
4
|
import Rule, { SearchVariant } from './rule.js';
|
|
5
|
-
export default class
|
|
5
|
+
export default class ConnectZonesRule extends Rule {
|
|
6
6
|
readonly color: Color;
|
|
7
7
|
readonly title = "Connect Zones";
|
|
8
8
|
private static readonly CONFIGS;
|
|
@@ -26,4 +26,4 @@ export default class CollectZonesRule extends Rule {
|
|
|
26
26
|
}): this;
|
|
27
27
|
withColor(color: Color): this;
|
|
28
28
|
}
|
|
29
|
-
export declare const instance:
|
|
29
|
+
export declare const instance: ConnectZonesRule;
|
|
@@ -3,7 +3,8 @@ import GridData from '../grid.js';
|
|
|
3
3
|
import { array, minBy } from '../dataHelper.js';
|
|
4
4
|
import { Color, State } from '../primitives.js';
|
|
5
5
|
import Rule from './rule.js';
|
|
6
|
-
|
|
6
|
+
import GridZones from '../gridZones.js';
|
|
7
|
+
class ConnectZonesRule extends Rule {
|
|
7
8
|
/**
|
|
8
9
|
* **Connect all <color> cells in each zone**
|
|
9
10
|
*
|
|
@@ -32,15 +33,15 @@ class CollectZonesRule extends Rule {
|
|
|
32
33
|
return `Connect all ${this.color} cells in each zone`;
|
|
33
34
|
}
|
|
34
35
|
get configs() {
|
|
35
|
-
return
|
|
36
|
+
return ConnectZonesRule.CONFIGS;
|
|
36
37
|
}
|
|
37
38
|
createExampleGrid() {
|
|
38
39
|
return this.color === Color.Light
|
|
39
|
-
?
|
|
40
|
-
:
|
|
40
|
+
? ConnectZonesRule.EXAMPLE_GRID_LIGHT
|
|
41
|
+
: ConnectZonesRule.EXAMPLE_GRID_DARK;
|
|
41
42
|
}
|
|
42
43
|
get searchVariants() {
|
|
43
|
-
return
|
|
44
|
+
return ConnectZonesRule.SEARCH_VARIANTS;
|
|
44
45
|
}
|
|
45
46
|
validateGrid(grid) {
|
|
46
47
|
let complete = true;
|
|
@@ -86,13 +87,13 @@ class CollectZonesRule extends Rule {
|
|
|
86
87
|
return { state: complete ? State.Satisfied : State.Incomplete };
|
|
87
88
|
}
|
|
88
89
|
copyWith({ color }) {
|
|
89
|
-
return new
|
|
90
|
+
return new ConnectZonesRule(color ?? this.color);
|
|
90
91
|
}
|
|
91
92
|
withColor(color) {
|
|
92
93
|
return this.copyWith({ color });
|
|
93
94
|
}
|
|
94
95
|
}
|
|
95
|
-
Object.defineProperty(
|
|
96
|
+
Object.defineProperty(ConnectZonesRule, "CONFIGS", {
|
|
96
97
|
enumerable: true,
|
|
97
98
|
configurable: true,
|
|
98
99
|
writable: true,
|
|
@@ -107,26 +108,34 @@ Object.defineProperty(CollectZonesRule, "CONFIGS", {
|
|
|
107
108
|
},
|
|
108
109
|
])
|
|
109
110
|
});
|
|
110
|
-
Object.defineProperty(
|
|
111
|
+
Object.defineProperty(ConnectZonesRule, "EXAMPLE_GRID_LIGHT", {
|
|
111
112
|
enumerable: true,
|
|
112
113
|
configurable: true,
|
|
113
114
|
writable: true,
|
|
114
|
-
value: Object.freeze(GridData.create(['
|
|
115
|
+
value: Object.freeze(GridData.create(['wbbwb', 'wbbwb', 'wbbww', 'wwbbb'])
|
|
116
|
+
.withZones(new GridZones([
|
|
117
|
+
{ x1: 2, y1: 1, x2: 2, y2: 2 },
|
|
118
|
+
{ x1: 1, y1: 0, x2: 2, y2: 0 },
|
|
119
|
+
{ x1: 1, y1: 1, x2: 2, y2: 1 },
|
|
120
|
+
{ x1: 2, y1: 2, x2: 3, y2: 2 },
|
|
121
|
+
{ x1: 2, y1: 3, x2: 3, y2: 3 },
|
|
122
|
+
]))
|
|
123
|
+
.addRule(new ConnectZonesRule(Color.Light)))
|
|
115
124
|
});
|
|
116
|
-
Object.defineProperty(
|
|
125
|
+
Object.defineProperty(ConnectZonesRule, "EXAMPLE_GRID_DARK", {
|
|
117
126
|
enumerable: true,
|
|
118
127
|
configurable: true,
|
|
119
128
|
writable: true,
|
|
120
|
-
value: Object.freeze(
|
|
129
|
+
value: Object.freeze(ConnectZonesRule.EXAMPLE_GRID_LIGHT.withTiles(tiles => tiles.map(row => row.map(tile => tile.withColor(tile.color === Color.Dark ? Color.Light : Color.Dark)))))
|
|
121
130
|
});
|
|
122
|
-
Object.defineProperty(
|
|
131
|
+
Object.defineProperty(ConnectZonesRule, "SEARCH_VARIANTS", {
|
|
123
132
|
enumerable: true,
|
|
124
133
|
configurable: true,
|
|
125
134
|
writable: true,
|
|
126
135
|
value: [
|
|
127
|
-
new
|
|
128
|
-
new
|
|
136
|
+
new ConnectZonesRule(Color.Light).searchVariant(),
|
|
137
|
+
new ConnectZonesRule(Color.Dark).searchVariant(),
|
|
129
138
|
]
|
|
130
139
|
});
|
|
131
|
-
export default
|
|
132
|
-
export const instance = new
|
|
140
|
+
export default ConnectZonesRule;
|
|
141
|
+
export const instance = new ConnectZonesRule(Color.Dark);
|
|
@@ -2,7 +2,7 @@ export { instance as BanPatternRule } from './banPatternRule.js';
|
|
|
2
2
|
export { instance as CellCountRule } from './cellCountRule.js';
|
|
3
3
|
export { instance as CompletePatternRule } from './completePatternRule.js';
|
|
4
4
|
export { instance as ConnectAllRule } from './connectAllRule.js';
|
|
5
|
-
export { instance as
|
|
5
|
+
export { instance as ConnectZonesRule } from './connectZonesRule.js';
|
|
6
6
|
export { instance as ContainsShapeRule } from './containsShapeRule.js';
|
|
7
7
|
export { instance as CustomRule } from './customRule.js';
|
|
8
8
|
export { instance as DifferentCountPerZoneRule } from './differentCountPerZoneRule.js';
|
|
@@ -6,7 +6,7 @@ export { instance as BanPatternRule } from './banPatternRule.js';
|
|
|
6
6
|
export { instance as CellCountRule } from './cellCountRule.js';
|
|
7
7
|
export { instance as CompletePatternRule } from './completePatternRule.js';
|
|
8
8
|
export { instance as ConnectAllRule } from './connectAllRule.js';
|
|
9
|
-
export { instance as
|
|
9
|
+
export { instance as ConnectZonesRule } from './connectZonesRule.js';
|
|
10
10
|
export { instance as ContainsShapeRule } from './containsShapeRule.js';
|
|
11
11
|
export { instance as CustomRule } from './customRule.js';
|
|
12
12
|
export { instance as DifferentCountPerZoneRule } from './differentCountPerZoneRule.js';
|
package/dist/index.d.ts
CHANGED
|
@@ -20,7 +20,7 @@ import CellCountPerZoneRule from './data/rules/cellCountPerZoneRule.js';
|
|
|
20
20
|
import CellCountRule from './data/rules/cellCountRule.js';
|
|
21
21
|
import CompletePatternRule from './data/rules/completePatternRule.js';
|
|
22
22
|
import ConnectAllRule from './data/rules/connectAllRule.js';
|
|
23
|
-
import
|
|
23
|
+
import ConnectZonesRule from './data/rules/connectZonesRule.js';
|
|
24
24
|
import ContainsShapeRule from './data/rules/containsShapeRule.js';
|
|
25
25
|
import CustomRule from './data/rules/customRule.js';
|
|
26
26
|
import DifferentCountPerZoneRule from './data/rules/differentCountPerZoneRule.js';
|
|
@@ -116,4 +116,4 @@ import TileData from './data/tile.js';
|
|
|
116
116
|
import TileConnections from './data/tileConnections.js';
|
|
117
117
|
import validateGrid, { aggregateState, applyFinalOverrides } from './data/validate.js';
|
|
118
118
|
import { GridValidator } from './data/validateAsync.js';
|
|
119
|
-
export { ConfigType, configEquals, Configurable, CachedAccess, allEqual, array, directionToRotation, escape, isSameEdge, maxBy, minBy, move, orientationToRotation, resize, unescape, isEventHandler, handlesFinalValidation, handlesGetTile, handlesGridChange, handlesGridResize, handlesSetGrid, invokeSetGrid, handlesSymbolDisplay, handlesSymbolValidation, GridData, NEIGHBOR_OFFSETS, GridConnections, GridZones, Instruction, COMPARISONS, Color, Comparison, DIRECTIONS, DRUM_SAMPLES, Direction, INSTRUMENTS, Instrument, MajorRule, Mode, ORIENTATIONS, Orientation, PuzzleType, State, WRAPPINGS, Wrapping, directionToggle, isDrumSample, orientationToggle, MetadataSchema, PuzzleSchema, getPuzzleTypes, puzzleEquals, validatePuzzleChecklist, BanPatternRule, CellCountPerZoneRule, CellCountRule, CompletePatternRule, ConnectAllRule,
|
|
119
|
+
export { ConfigType, configEquals, Configurable, CachedAccess, allEqual, array, directionToRotation, escape, isSameEdge, maxBy, minBy, move, orientationToRotation, resize, unescape, isEventHandler, handlesFinalValidation, handlesGetTile, handlesGridChange, handlesGridResize, handlesSetGrid, invokeSetGrid, handlesSymbolDisplay, handlesSymbolValidation, GridData, NEIGHBOR_OFFSETS, GridConnections, GridZones, Instruction, COMPARISONS, Color, Comparison, DIRECTIONS, DRUM_SAMPLES, Direction, INSTRUMENTS, Instrument, MajorRule, Mode, ORIENTATIONS, Orientation, PuzzleType, State, WRAPPINGS, Wrapping, directionToggle, isDrumSample, orientationToggle, MetadataSchema, PuzzleSchema, getPuzzleTypes, puzzleEquals, validatePuzzleChecklist, BanPatternRule, CellCountPerZoneRule, CellCountRule, CompletePatternRule, ConnectAllRule, ConnectZonesRule, ContainsShapeRule, CustomRule, DifferentCountPerZoneRule, ExactCountPerZoneRule, ForesightRule, allRules, LyingSymbolRule, ControlLine, Row, MusicGridRule, MysteryRule, OffByXRule, PerfectionRule, RegionAreaRule, RegionShapeRule, Rule, SameCountPerZoneRule, SameShapeRule, SymbolsPerRegionRule, UndercluedRule, UniqueShapeRule, WrapAroundRule, Serializer, Compressor, ChecksumCompressor, CompressorBase, DeflateCompressor, GzipCompressor, StreamCompressor, SerializerBase, SerializerChecksum, SerializerV0, OFFSETS, orientationChars, getShapeVariants, normalizeShape, positionsToShape, sanitizePatternGrid, shapeEquals, tilesToShape, allSolvers, AutoSolver, BacktrackSolver, BTModule, BTGridData, BTTile, IntArray2D, colorToBTTile, createOneTileResult, getOppositeColor, BanPatternBTModule, CellCountBTModule, ConnectAllBTModule, RegionAreaBTModule, RegionShapeBTModule, SameShapeBTModule, SymbolsPerRegionBTModule, UniqueShapeBTModule, AreaNumberBTModule, DartBTModule, DirectionLinkerBTModule, FocusBTModule, GalaxyBTModule, LetterBTModule, LotusBTModule, MinesweeperBTModule, MyopiaBTModule, ViewpointBTModule, CspuzSolver, gridToJson, EventIteratingSolver, Solver, UniversalSolver, AreaNumberModule, CellCountModule, ConnectAllModule, DartModule, allZ3Modules, LetterModule, MyopiaModule, RegionAreaModule, ViewpointModule, Z3Module, convertDirection, Z3Solver, Z3SolverContext, AreaNumberSymbol, CustomIconSymbol, CustomSymbol, CustomTextSymbol, DartSymbol, DirectionLinkerSymbol, FocusSymbol, GalaxySymbol, HiddenSymbol, HouseSymbol, allSymbols, LetterSymbol, LotusSymbol, MinesweeperSymbol, MultiEntrySymbol, MyopiaSymbol, NumberSymbol, Symbol, ViewpointSymbol, TileData, TileConnections, validateGrid, aggregateState, applyFinalOverrides, GridValidator, };
|
package/dist/index.js
CHANGED
|
@@ -23,7 +23,7 @@ import CellCountPerZoneRule from './data/rules/cellCountPerZoneRule.js';
|
|
|
23
23
|
import CellCountRule from './data/rules/cellCountRule.js';
|
|
24
24
|
import CompletePatternRule from './data/rules/completePatternRule.js';
|
|
25
25
|
import ConnectAllRule from './data/rules/connectAllRule.js';
|
|
26
|
-
import
|
|
26
|
+
import ConnectZonesRule from './data/rules/connectZonesRule.js';
|
|
27
27
|
import ContainsShapeRule from './data/rules/containsShapeRule.js';
|
|
28
28
|
import CustomRule from './data/rules/customRule.js';
|
|
29
29
|
import DifferentCountPerZoneRule from './data/rules/differentCountPerZoneRule.js';
|
|
@@ -119,4 +119,4 @@ import TileData from './data/tile.js';
|
|
|
119
119
|
import TileConnections from './data/tileConnections.js';
|
|
120
120
|
import validateGrid, { aggregateState, applyFinalOverrides } from './data/validate.js';
|
|
121
121
|
import { GridValidator } from './data/validateAsync.js';
|
|
122
|
-
export { ConfigType, configEquals, Configurable, CachedAccess, allEqual, array, directionToRotation, escape, isSameEdge, maxBy, minBy, move, orientationToRotation, resize, unescape, isEventHandler, handlesFinalValidation, handlesGetTile, handlesGridChange, handlesGridResize, handlesSetGrid, invokeSetGrid, handlesSymbolDisplay, handlesSymbolValidation, GridData, NEIGHBOR_OFFSETS, GridConnections, GridZones, Instruction, COMPARISONS, Color, Comparison, DIRECTIONS, DRUM_SAMPLES, Direction, INSTRUMENTS, Instrument, MajorRule, Mode, ORIENTATIONS, Orientation, PuzzleType, State, WRAPPINGS, Wrapping, directionToggle, isDrumSample, orientationToggle, MetadataSchema, PuzzleSchema, getPuzzleTypes, puzzleEquals, validatePuzzleChecklist, BanPatternRule, CellCountPerZoneRule, CellCountRule, CompletePatternRule, ConnectAllRule,
|
|
122
|
+
export { ConfigType, configEquals, Configurable, CachedAccess, allEqual, array, directionToRotation, escape, isSameEdge, maxBy, minBy, move, orientationToRotation, resize, unescape, isEventHandler, handlesFinalValidation, handlesGetTile, handlesGridChange, handlesGridResize, handlesSetGrid, invokeSetGrid, handlesSymbolDisplay, handlesSymbolValidation, GridData, NEIGHBOR_OFFSETS, GridConnections, GridZones, Instruction, COMPARISONS, Color, Comparison, DIRECTIONS, DRUM_SAMPLES, Direction, INSTRUMENTS, Instrument, MajorRule, Mode, ORIENTATIONS, Orientation, PuzzleType, State, WRAPPINGS, Wrapping, directionToggle, isDrumSample, orientationToggle, MetadataSchema, PuzzleSchema, getPuzzleTypes, puzzleEquals, validatePuzzleChecklist, BanPatternRule, CellCountPerZoneRule, CellCountRule, CompletePatternRule, ConnectAllRule, ConnectZonesRule, ContainsShapeRule, CustomRule, DifferentCountPerZoneRule, ExactCountPerZoneRule, ForesightRule, allRules, LyingSymbolRule, ControlLine, Row, MusicGridRule, MysteryRule, OffByXRule, PerfectionRule, RegionAreaRule, RegionShapeRule, Rule, SameCountPerZoneRule, SameShapeRule, SymbolsPerRegionRule, UndercluedRule, UniqueShapeRule, WrapAroundRule, Serializer, Compressor, ChecksumCompressor, CompressorBase, DeflateCompressor, GzipCompressor, StreamCompressor, SerializerBase, SerializerChecksum, SerializerV0, OFFSETS, orientationChars, getShapeVariants, normalizeShape, positionsToShape, sanitizePatternGrid, shapeEquals, tilesToShape, allSolvers, AutoSolver, BacktrackSolver, BTModule, BTGridData, BTTile, IntArray2D, colorToBTTile, createOneTileResult, getOppositeColor, BanPatternBTModule, CellCountBTModule, ConnectAllBTModule, RegionAreaBTModule, RegionShapeBTModule, SameShapeBTModule, SymbolsPerRegionBTModule, UniqueShapeBTModule, AreaNumberBTModule, DartBTModule, DirectionLinkerBTModule, FocusBTModule, GalaxyBTModule, LetterBTModule, LotusBTModule, MinesweeperBTModule, MyopiaBTModule, ViewpointBTModule, CspuzSolver, gridToJson, EventIteratingSolver, Solver, UniversalSolver, AreaNumberModule, CellCountModule, ConnectAllModule, DartModule, allZ3Modules, LetterModule, MyopiaModule, RegionAreaModule, ViewpointModule, Z3Module, convertDirection, Z3Solver, Z3SolverContext, AreaNumberSymbol, CustomIconSymbol, CustomSymbol, CustomTextSymbol, DartSymbol, DirectionLinkerSymbol, FocusSymbol, GalaxySymbol, HiddenSymbol, HouseSymbol, allSymbols, LetterSymbol, LotusSymbol, MinesweeperSymbol, MultiEntrySymbol, MyopiaSymbol, NumberSymbol, Symbol, ViewpointSymbol, TileData, TileConnections, validateGrid, aggregateState, applyFinalOverrides, GridValidator, };
|