@logic-pad/core 0.4.5 → 0.5.0
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 +54 -3434
- package/dist/data/primitives.d.ts +19 -1
- package/dist/data/primitives.js +20 -0
- package/dist/data/rules/banPatternRule.js +3 -1
- package/dist/data/rules/lyingSymbolRule.d.ts +30 -0
- package/dist/data/rules/lyingSymbolRule.js +214 -0
- package/dist/data/rules/mysteryRule.js +1 -1
- package/dist/data/rules/offByXRule.d.ts +1 -1
- package/dist/data/rules/offByXRule.js +7 -3
- package/dist/data/rules/rules.gen.d.ts +1 -0
- package/dist/data/rules/rules.gen.js +1 -0
- package/dist/data/solver/backtrack/symbols/directionLinker.js +7 -6
- package/dist/data/solver/z3/z3SolverContext.d.ts +2 -797
- package/dist/data/validate.d.ts +1 -1
- package/dist/data/validate.js +3 -3
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/package.json +1 -1
package/dist/data/validate.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import GridData from './grid.js';
|
|
2
2
|
import { GridState, RuleState, State } from './primitives.js';
|
|
3
|
-
export declare function aggregateState(rules: RuleState[], grid: GridData, symbols:
|
|
3
|
+
export declare function aggregateState(rules: readonly RuleState[], grid: GridData, symbols: ReadonlyMap<string, State[]>): State.Error | State.Satisfied | State.Incomplete;
|
|
4
4
|
export declare function applyFinalOverrides(grid: GridData, solution: GridData | null, state: GridState): GridState;
|
|
5
5
|
export default function validateGrid(grid: GridData, solution: GridData | null): GridState;
|
package/dist/data/validate.js
CHANGED
|
@@ -72,18 +72,18 @@ export default function validateGrid(grid, solution) {
|
|
|
72
72
|
return;
|
|
73
73
|
if (states.some(s => s === State.Error))
|
|
74
74
|
ruleStates[i] = { state: State.Error, positions: [] };
|
|
75
|
-
else if (states.length > 0 && states.every(s =>
|
|
75
|
+
else if (states.length > 0 && states.every(s => State.isSatisfied(s)))
|
|
76
76
|
ruleStates[i] = { state: State.Satisfied };
|
|
77
77
|
});
|
|
78
78
|
let final = aggregateState(ruleStates, grid, symbolStates);
|
|
79
79
|
// in addition to satisfying all rules and symbols, a solution must also fill the grid completely
|
|
80
|
-
if (!requireSolution &&
|
|
80
|
+
if (!requireSolution && State.isSatisfied(final)) {
|
|
81
81
|
final = grid.forEach(tile => tile.exists && tile.color === Color.Gray ? true : undefined)
|
|
82
82
|
? State.Incomplete
|
|
83
83
|
: State.Satisfied;
|
|
84
84
|
}
|
|
85
85
|
// return early if there is no need to validate against a solution
|
|
86
|
-
if (
|
|
86
|
+
if (State.isSatisfied(final) ||
|
|
87
87
|
!requireSolution ||
|
|
88
88
|
!solution ||
|
|
89
89
|
solution.width !== grid.width ||
|
package/dist/index.d.ts
CHANGED
|
@@ -22,6 +22,7 @@ import ConnectAllRule from './data/rules/connectAllRule.js';
|
|
|
22
22
|
import CustomRule from './data/rules/customRule.js';
|
|
23
23
|
import ForesightRule from './data/rules/foresightRule.js';
|
|
24
24
|
import { allRules } from './data/rules/index.js';
|
|
25
|
+
import LyingSymbolRule from './data/rules/lyingSymbolRule.js';
|
|
25
26
|
import { ControlLine, Row } from './data/rules/musicControlLine.js';
|
|
26
27
|
import MusicGridRule from './data/rules/musicGridRule.js';
|
|
27
28
|
import MysteryRule from './data/rules/mysteryRule.js';
|
|
@@ -98,4 +99,4 @@ import ViewpointSymbol from './data/symbols/viewpointSymbol.js';
|
|
|
98
99
|
import TileData from './data/tile.js';
|
|
99
100
|
import TileConnections from './data/tileConnections.js';
|
|
100
101
|
import validateGrid, { aggregateState, applyFinalOverrides } from './data/validate.js';
|
|
101
|
-
export { ConfigType, configEquals, Configurable, CachedAccess, allEqual, array, directionToRotation, escape, isSameEdge, maxBy, minBy, move, orientationToRotation, resize, unescape, isEventHandler, handlesFinalValidation, handlesGridChange, handlesGridResize, handlesSetGrid, invokeSetGrid, handlesSymbolDisplay, handlesSymbolValidation, GridData, NEIGHBOR_OFFSETS, GridConnections, GridZones, Instruction, COMPARISONS, Color, Comparison, DIRECTIONS, Direction, MajorRule, Mode, ORIENTATIONS, Orientation, State, directionToggle, orientationToggle, MetadataSchema, PuzzleSchema, BanPatternRule, CellCountPerZoneRule, CellCountRule, CompletePatternRule, ConnectAllRule, CustomRule, ForesightRule, allRules, ControlLine, Row, MusicGridRule, MysteryRule, OffByXRule, PerfectionRule, RegionAreaRule, RegionShapeRule, Rule, SameShapeRule, SymbolsPerRegionRule, UndercluedRule, UniqueShapeRule, Serializer, Compressor, CompressorBase, DeflateCompressor, GzipCompressor, StreamCompressor, SerializerBase, SerializerV0, getShapeVariants, normalizeShape, positionsToShape, shapeEquals, tilesToShape, allSolvers, BacktrackSolver, BTModule, BTGridData, BTTile, IntArray2D, colorToBTTile, createOneTileResult, getOppositeColor, BanPatternBTModule, CellCountBTModule, ConnectAllBTModule, RegionAreaBTModule, RegionShapeBTModule, SameShapeBTModule, SymbolsPerRegionBTModule, UniqueShapeBTModule, AreaNumberBTModule, DartBTModule, DirectionLinkerBTModule, GalaxyBTModule, LetterBTModule, LotusBTModule, MinesweeperBTModule, MyopiaBTModule, ViewpointBTModule, Solver, UndercluedSolver, AreaNumberModule, CellCountModule, ConnectAllModule, DartModule, allZ3Modules, LetterModule, MyopiaModule, RegionAreaModule, ViewpointModule, Z3Module, convertDirection, Z3Solver, Z3SolverContext, AreaNumberSymbol, CustomIconSymbol, CustomSymbol, CustomTextSymbol, DartSymbol, DirectionLinkerSymbol, GalaxySymbol, HiddenSymbol, allSymbols, LetterSymbol, LotusSymbol, MinesweeperSymbol, MultiEntrySymbol, MyopiaSymbol, NumberSymbol, Symbol, ViewpointSymbol, TileData, TileConnections, validateGrid, aggregateState, applyFinalOverrides, };
|
|
102
|
+
export { ConfigType, configEquals, Configurable, CachedAccess, allEqual, array, directionToRotation, escape, isSameEdge, maxBy, minBy, move, orientationToRotation, resize, unescape, isEventHandler, handlesFinalValidation, handlesGridChange, handlesGridResize, handlesSetGrid, invokeSetGrid, handlesSymbolDisplay, handlesSymbolValidation, GridData, NEIGHBOR_OFFSETS, GridConnections, GridZones, Instruction, COMPARISONS, Color, Comparison, DIRECTIONS, Direction, MajorRule, Mode, ORIENTATIONS, Orientation, State, directionToggle, orientationToggle, MetadataSchema, PuzzleSchema, BanPatternRule, CellCountPerZoneRule, CellCountRule, CompletePatternRule, ConnectAllRule, CustomRule, ForesightRule, allRules, LyingSymbolRule, ControlLine, Row, MusicGridRule, MysteryRule, OffByXRule, PerfectionRule, RegionAreaRule, RegionShapeRule, Rule, SameShapeRule, SymbolsPerRegionRule, UndercluedRule, UniqueShapeRule, Serializer, Compressor, CompressorBase, DeflateCompressor, GzipCompressor, StreamCompressor, SerializerBase, SerializerV0, getShapeVariants, normalizeShape, positionsToShape, shapeEquals, tilesToShape, allSolvers, BacktrackSolver, BTModule, BTGridData, BTTile, IntArray2D, colorToBTTile, createOneTileResult, getOppositeColor, BanPatternBTModule, CellCountBTModule, ConnectAllBTModule, RegionAreaBTModule, RegionShapeBTModule, SameShapeBTModule, SymbolsPerRegionBTModule, UniqueShapeBTModule, AreaNumberBTModule, DartBTModule, DirectionLinkerBTModule, GalaxyBTModule, LetterBTModule, LotusBTModule, MinesweeperBTModule, MyopiaBTModule, ViewpointBTModule, Solver, UndercluedSolver, AreaNumberModule, CellCountModule, ConnectAllModule, DartModule, allZ3Modules, LetterModule, MyopiaModule, RegionAreaModule, ViewpointModule, Z3Module, convertDirection, Z3Solver, Z3SolverContext, AreaNumberSymbol, CustomIconSymbol, CustomSymbol, CustomTextSymbol, DartSymbol, DirectionLinkerSymbol, GalaxySymbol, HiddenSymbol, allSymbols, LetterSymbol, LotusSymbol, MinesweeperSymbol, MultiEntrySymbol, MyopiaSymbol, NumberSymbol, Symbol, ViewpointSymbol, TileData, TileConnections, validateGrid, aggregateState, applyFinalOverrides, };
|
package/dist/index.js
CHANGED
|
@@ -25,6 +25,7 @@ import ConnectAllRule from './data/rules/connectAllRule.js';
|
|
|
25
25
|
import CustomRule from './data/rules/customRule.js';
|
|
26
26
|
import ForesightRule from './data/rules/foresightRule.js';
|
|
27
27
|
import { allRules } from './data/rules/index.js';
|
|
28
|
+
import LyingSymbolRule from './data/rules/lyingSymbolRule.js';
|
|
28
29
|
import { ControlLine, Row } from './data/rules/musicControlLine.js';
|
|
29
30
|
import MusicGridRule from './data/rules/musicGridRule.js';
|
|
30
31
|
import MysteryRule from './data/rules/mysteryRule.js';
|
|
@@ -101,4 +102,4 @@ import ViewpointSymbol from './data/symbols/viewpointSymbol.js';
|
|
|
101
102
|
import TileData from './data/tile.js';
|
|
102
103
|
import TileConnections from './data/tileConnections.js';
|
|
103
104
|
import validateGrid, { aggregateState, applyFinalOverrides } from './data/validate.js';
|
|
104
|
-
export { ConfigType, configEquals, Configurable, CachedAccess, allEqual, array, directionToRotation, escape, isSameEdge, maxBy, minBy, move, orientationToRotation, resize, unescape, isEventHandler, handlesFinalValidation, handlesGridChange, handlesGridResize, handlesSetGrid, invokeSetGrid, handlesSymbolDisplay, handlesSymbolValidation, GridData, NEIGHBOR_OFFSETS, GridConnections, GridZones, Instruction, COMPARISONS, Color, Comparison, DIRECTIONS, Direction, MajorRule, Mode, ORIENTATIONS, Orientation, State, directionToggle, orientationToggle, MetadataSchema, PuzzleSchema, BanPatternRule, CellCountPerZoneRule, CellCountRule, CompletePatternRule, ConnectAllRule, CustomRule, ForesightRule, allRules, ControlLine, Row, MusicGridRule, MysteryRule, OffByXRule, PerfectionRule, RegionAreaRule, RegionShapeRule, Rule, SameShapeRule, SymbolsPerRegionRule, UndercluedRule, UniqueShapeRule, Serializer, Compressor, CompressorBase, DeflateCompressor, GzipCompressor, StreamCompressor, SerializerBase, SerializerV0, getShapeVariants, normalizeShape, positionsToShape, shapeEquals, tilesToShape, allSolvers, BacktrackSolver, BTModule, BTGridData, BTTile, IntArray2D, colorToBTTile, createOneTileResult, getOppositeColor, BanPatternBTModule, CellCountBTModule, ConnectAllBTModule, RegionAreaBTModule, RegionShapeBTModule, SameShapeBTModule, SymbolsPerRegionBTModule, UniqueShapeBTModule, AreaNumberBTModule, DartBTModule, DirectionLinkerBTModule, GalaxyBTModule, LetterBTModule, LotusBTModule, MinesweeperBTModule, MyopiaBTModule, ViewpointBTModule, Solver, UndercluedSolver, AreaNumberModule, CellCountModule, ConnectAllModule, DartModule, allZ3Modules, LetterModule, MyopiaModule, RegionAreaModule, ViewpointModule, Z3Module, convertDirection, Z3Solver, Z3SolverContext, AreaNumberSymbol, CustomIconSymbol, CustomSymbol, CustomTextSymbol, DartSymbol, DirectionLinkerSymbol, GalaxySymbol, HiddenSymbol, allSymbols, LetterSymbol, LotusSymbol, MinesweeperSymbol, MultiEntrySymbol, MyopiaSymbol, NumberSymbol, Symbol, ViewpointSymbol, TileData, TileConnections, validateGrid, aggregateState, applyFinalOverrides, };
|
|
105
|
+
export { ConfigType, configEquals, Configurable, CachedAccess, allEqual, array, directionToRotation, escape, isSameEdge, maxBy, minBy, move, orientationToRotation, resize, unescape, isEventHandler, handlesFinalValidation, handlesGridChange, handlesGridResize, handlesSetGrid, invokeSetGrid, handlesSymbolDisplay, handlesSymbolValidation, GridData, NEIGHBOR_OFFSETS, GridConnections, GridZones, Instruction, COMPARISONS, Color, Comparison, DIRECTIONS, Direction, MajorRule, Mode, ORIENTATIONS, Orientation, State, directionToggle, orientationToggle, MetadataSchema, PuzzleSchema, BanPatternRule, CellCountPerZoneRule, CellCountRule, CompletePatternRule, ConnectAllRule, CustomRule, ForesightRule, allRules, LyingSymbolRule, ControlLine, Row, MusicGridRule, MysteryRule, OffByXRule, PerfectionRule, RegionAreaRule, RegionShapeRule, Rule, SameShapeRule, SymbolsPerRegionRule, UndercluedRule, UniqueShapeRule, Serializer, Compressor, CompressorBase, DeflateCompressor, GzipCompressor, StreamCompressor, SerializerBase, SerializerV0, getShapeVariants, normalizeShape, positionsToShape, shapeEquals, tilesToShape, allSolvers, BacktrackSolver, BTModule, BTGridData, BTTile, IntArray2D, colorToBTTile, createOneTileResult, getOppositeColor, BanPatternBTModule, CellCountBTModule, ConnectAllBTModule, RegionAreaBTModule, RegionShapeBTModule, SameShapeBTModule, SymbolsPerRegionBTModule, UniqueShapeBTModule, AreaNumberBTModule, DartBTModule, DirectionLinkerBTModule, GalaxyBTModule, LetterBTModule, LotusBTModule, MinesweeperBTModule, MyopiaBTModule, ViewpointBTModule, Solver, UndercluedSolver, AreaNumberModule, CellCountModule, ConnectAllModule, DartModule, allZ3Modules, LetterModule, MyopiaModule, RegionAreaModule, ViewpointModule, Z3Module, convertDirection, Z3Solver, Z3SolverContext, AreaNumberSymbol, CustomIconSymbol, CustomSymbol, CustomTextSymbol, DartSymbol, DirectionLinkerSymbol, GalaxySymbol, HiddenSymbol, allSymbols, LetterSymbol, LotusSymbol, MinesweeperSymbol, MultiEntrySymbol, MyopiaSymbol, NumberSymbol, Symbol, ViewpointSymbol, TileData, TileConnections, validateGrid, aggregateState, applyFinalOverrides, };
|