@logic-pad/core 0.6.0 → 0.7.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 +81 -4
- package/dist/data/config.d.ts +6 -2
- package/dist/data/config.js +1 -0
- package/dist/data/events/onGetTile.d.ts +7 -0
- package/dist/data/events/onGetTile.js +4 -0
- package/dist/data/grid.d.ts +9 -3
- package/dist/data/grid.js +49 -10
- package/dist/data/primitives.d.ts +8 -1
- package/dist/data/primitives.js +12 -0
- package/dist/data/rules/banPatternRule.js +3 -6
- package/dist/data/rules/cellCountPerZoneRule.js +9 -7
- package/dist/data/rules/musicGridRule.d.ts +1 -1
- package/dist/data/rules/musicGridRule.js +7 -2
- package/dist/data/rules/regionShapeRule.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/rules/wrapAroundRule.d.ts +36 -0
- package/dist/data/rules/wrapAroundRule.js +205 -0
- package/dist/data/serializer/serializer_v0.js +3 -0
- package/dist/data/solver/universal/universalWorker.js +4 -0
- package/dist/data/symbols/directionLinkerSymbol.js +4 -7
- package/dist/data/symbols/viewpointSymbol.js +3 -2
- package/dist/index.d.ts +4 -2
- package/dist/index.js +4 -2
- package/package.json +1 -1
|
@@ -29,6 +29,7 @@ declare global {
|
|
|
29
29
|
MusicGrid = 'music',
|
|
30
30
|
CompletePattern = 'complete_pattern',
|
|
31
31
|
Underclued = 'underclued',
|
|
32
|
+
WrapAround = 'wrap_around',
|
|
32
33
|
}
|
|
33
34
|
export declare enum State {
|
|
34
35
|
/**
|
|
@@ -81,6 +82,12 @@ declare global {
|
|
|
81
82
|
AtMost = 'le',
|
|
82
83
|
}
|
|
83
84
|
export declare const COMPARISONS: readonly Comparison[];
|
|
85
|
+
export declare enum Wrapping {
|
|
86
|
+
None = 'none',
|
|
87
|
+
Wrap = 'wrap',
|
|
88
|
+
WrapReverse = 'wrap-reverse',
|
|
89
|
+
}
|
|
90
|
+
export declare const WRAPPINGS: readonly Wrapping[];
|
|
84
91
|
export declare enum Direction {
|
|
85
92
|
Up = 'up',
|
|
86
93
|
Down = 'down',
|
|
@@ -560,7 +567,7 @@ declare global {
|
|
|
560
567
|
get configs(): readonly AnyConfig[] | null;
|
|
561
568
|
createExampleGrid(): GridData;
|
|
562
569
|
get searchVariants(): SearchVariant[];
|
|
563
|
-
validateGrid(
|
|
570
|
+
validateGrid(grid: GridData): RuleState;
|
|
564
571
|
onSetGrid(
|
|
565
572
|
_oldGrid: GridData,
|
|
566
573
|
newGrid: GridData,
|
|
@@ -632,6 +639,45 @@ declare global {
|
|
|
632
639
|
get validateWithSolution(): boolean;
|
|
633
640
|
get isSingleton(): boolean;
|
|
634
641
|
}
|
|
642
|
+
export interface GetTileHandler {
|
|
643
|
+
onGetTile(x: number, y: number, grid: GridData): Position$1;
|
|
644
|
+
}
|
|
645
|
+
export declare function handlesGetTile<T extends Instruction>(
|
|
646
|
+
val: T
|
|
647
|
+
): val is T & GetTileHandler;
|
|
648
|
+
export declare class WrapAroundRule extends Rule implements GetTileHandler {
|
|
649
|
+
readonly horizontal: Wrapping;
|
|
650
|
+
readonly vertical: Wrapping;
|
|
651
|
+
private static readonly EXAMPLE_GRID_NONE;
|
|
652
|
+
private static readonly EXAMPLE_GRID_HORIZONTAL;
|
|
653
|
+
private static readonly EXAMPLE_GRID_HORIZONTAL_REVERSE;
|
|
654
|
+
private static readonly EXAMPLE_GRID_VERTICAL;
|
|
655
|
+
private static readonly EXAMPLE_GRID_VERTICAL_REVERSE;
|
|
656
|
+
private static readonly SEARCH_VARIANTS;
|
|
657
|
+
private static readonly CONFIGS;
|
|
658
|
+
/**
|
|
659
|
+
* **The left and right edges are connected (in reverse)**
|
|
660
|
+
*
|
|
661
|
+
* @param horizontal - The horizontal wrapping.
|
|
662
|
+
* @param vertical - The vertical wrapping.
|
|
663
|
+
*/
|
|
664
|
+
constructor(horizontal: Wrapping, vertical: Wrapping);
|
|
665
|
+
onGetTile(x: number, y: number, grid: GridData): Position$1;
|
|
666
|
+
get id(): string;
|
|
667
|
+
get explanation(): string;
|
|
668
|
+
createExampleGrid(): GridData;
|
|
669
|
+
get configs(): readonly AnyConfig[] | null;
|
|
670
|
+
get searchVariants(): SearchVariant[];
|
|
671
|
+
validateGrid(grid: GridData): RuleState;
|
|
672
|
+
copyWith({
|
|
673
|
+
horizontal,
|
|
674
|
+
vertical,
|
|
675
|
+
}: {
|
|
676
|
+
horizontal?: Wrapping;
|
|
677
|
+
vertical?: Wrapping;
|
|
678
|
+
}): this;
|
|
679
|
+
get isSingleton(): boolean;
|
|
680
|
+
}
|
|
635
681
|
export declare const NEIGHBOR_OFFSETS: Position$1[];
|
|
636
682
|
export declare class GridData {
|
|
637
683
|
readonly width: number;
|
|
@@ -644,6 +690,7 @@ declare global {
|
|
|
644
690
|
readonly musicGrid: CachedAccess<MusicGridRule | undefined>;
|
|
645
691
|
readonly completePattern: CachedAccess<CompletePatternRule | undefined>;
|
|
646
692
|
readonly underclued: CachedAccess<UndercluedRule | undefined>;
|
|
693
|
+
readonly wrapAround: CachedAccess<WrapAroundRule | undefined>;
|
|
647
694
|
/**
|
|
648
695
|
* Create a new grid with tiles, connections, symbols and rules.
|
|
649
696
|
*
|
|
@@ -742,6 +789,7 @@ declare global {
|
|
|
742
789
|
symbols?: ReadonlyMap<string, readonly Symbol$1[]>;
|
|
743
790
|
rules?: readonly Rule[];
|
|
744
791
|
}): GridData;
|
|
792
|
+
toArrayCoordinates(x: number, y: number): Position$1;
|
|
745
793
|
isPositionValid(x: number, y: number): boolean;
|
|
746
794
|
/**
|
|
747
795
|
* Safely get the tile at the given position.
|
|
@@ -934,12 +982,20 @@ declare global {
|
|
|
934
982
|
* @param position The position to start the iteration from. This position is included in the iteration.
|
|
935
983
|
* @param predicate The predicate to test each tile with. The callback is only called for tiles that satisfy this predicate.
|
|
936
984
|
* @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.
|
|
985
|
+
* @param visited A 2D array to keep track of visited tiles. This array is modified by the function.
|
|
937
986
|
* @returns The value returned by the callback that stopped the iteration, or undefined if the iteration completed.
|
|
938
987
|
*/
|
|
939
988
|
iterateArea<T>(
|
|
940
989
|
position: Position$1,
|
|
941
990
|
predicate: (tile: TileData) => boolean,
|
|
942
|
-
callback: (
|
|
991
|
+
callback: (
|
|
992
|
+
tile: TileData,
|
|
993
|
+
x: number,
|
|
994
|
+
y: number,
|
|
995
|
+
logicalX: number,
|
|
996
|
+
logicalY: number
|
|
997
|
+
) => undefined | T,
|
|
998
|
+
visited?: boolean[][]
|
|
943
999
|
): T | undefined;
|
|
944
1000
|
/**
|
|
945
1001
|
* Iterate over all tiles in a straight line from the given position in the given direction that satisfy the predicate.
|
|
@@ -950,13 +1006,21 @@ declare global {
|
|
|
950
1006
|
* @param direction The direction to iterate in.
|
|
951
1007
|
* @param predicate The predicate to test each tile with. The callback is only called for tiles that satisfy this predicate.
|
|
952
1008
|
* @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.
|
|
1009
|
+
* @param visited A 2D array to keep track of visited tiles. This array is modified by the function.
|
|
953
1010
|
* @returns The value returned by the callback that stopped the iteration, or undefined if the iteration completed.
|
|
954
1011
|
*/
|
|
955
1012
|
iterateDirection<T>(
|
|
956
1013
|
position: Position$1,
|
|
957
1014
|
direction: Direction | Orientation,
|
|
958
1015
|
predicate: (tile: TileData) => boolean,
|
|
959
|
-
callback: (
|
|
1016
|
+
callback: (
|
|
1017
|
+
tile: TileData,
|
|
1018
|
+
x: number,
|
|
1019
|
+
y: number,
|
|
1020
|
+
logicalX: number,
|
|
1021
|
+
logicalY: number
|
|
1022
|
+
) => T | undefined,
|
|
1023
|
+
visited?: boolean[][]
|
|
960
1024
|
): T | undefined;
|
|
961
1025
|
/**
|
|
962
1026
|
* Iterate over all tiles in a straight line from the given position in the given direction that satisfy the predicate.
|
|
@@ -967,13 +1031,21 @@ declare global {
|
|
|
967
1031
|
* @param direction The direction to iterate in.
|
|
968
1032
|
* @param predicate The predicate to test each tile with. The callback is only called for tiles that satisfy this predicate.
|
|
969
1033
|
* @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.
|
|
1034
|
+
* @param visited A 2D array to keep track of visited tiles. This array is modified by the function.
|
|
970
1035
|
* @returns The value returned by the callback that stopped the iteration, or undefined if the iteration completed.
|
|
971
1036
|
*/
|
|
972
1037
|
iterateDirectionAll<T>(
|
|
973
1038
|
position: Position$1,
|
|
974
1039
|
direction: Direction | Orientation,
|
|
975
1040
|
predicate: (tile: TileData) => boolean,
|
|
976
|
-
callback: (
|
|
1041
|
+
callback: (
|
|
1042
|
+
tile: TileData,
|
|
1043
|
+
x: number,
|
|
1044
|
+
y: number,
|
|
1045
|
+
logicalX: number,
|
|
1046
|
+
logicalY: number
|
|
1047
|
+
) => T | undefined,
|
|
1048
|
+
visited?: boolean[][]
|
|
977
1049
|
): T | undefined;
|
|
978
1050
|
/**
|
|
979
1051
|
* Check if every tile in the grid is filled with a color other than gray.
|
|
@@ -1125,6 +1197,7 @@ declare global {
|
|
|
1125
1197
|
String = 'string',
|
|
1126
1198
|
Color = 'color',
|
|
1127
1199
|
Comparison = 'comparison',
|
|
1200
|
+
Wrapping = 'wrapping',
|
|
1128
1201
|
Direction = 'direction',
|
|
1129
1202
|
DirectionToggle = 'directionToggle',
|
|
1130
1203
|
Orientation = 'orientation',
|
|
@@ -1174,6 +1247,9 @@ declare global {
|
|
|
1174
1247
|
export interface ComparisonConfig extends Config<Comparison> {
|
|
1175
1248
|
readonly type: ConfigType.Comparison;
|
|
1176
1249
|
}
|
|
1250
|
+
export interface WrappingConfig extends Config<Wrapping> {
|
|
1251
|
+
readonly type: ConfigType.Wrapping;
|
|
1252
|
+
}
|
|
1177
1253
|
export interface DirectionConfig extends Config<Direction> {
|
|
1178
1254
|
readonly type: ConfigType.Direction;
|
|
1179
1255
|
}
|
|
@@ -1217,6 +1293,7 @@ declare global {
|
|
|
1217
1293
|
| StringConfig
|
|
1218
1294
|
| ColorConfig
|
|
1219
1295
|
| ComparisonConfig
|
|
1296
|
+
| WrappingConfig
|
|
1220
1297
|
| DirectionConfig
|
|
1221
1298
|
| DirectionToggleConfig
|
|
1222
1299
|
| OrientationConfig
|
package/dist/data/config.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import GridData from './grid.js';
|
|
2
|
-
import { Color, Comparison, Direction, DirectionToggle, Orientation, OrientationToggle, Position } from './primitives.js';
|
|
2
|
+
import { Color, Comparison, Direction, DirectionToggle, Orientation, OrientationToggle, Position, Wrapping } from './primitives.js';
|
|
3
3
|
import { ControlLine } from './rules/musicControlLine.js';
|
|
4
4
|
export declare enum ConfigType {
|
|
5
5
|
Boolean = "boolean",
|
|
@@ -9,6 +9,7 @@ export declare enum ConfigType {
|
|
|
9
9
|
String = "string",
|
|
10
10
|
Color = "color",
|
|
11
11
|
Comparison = "comparison",
|
|
12
|
+
Wrapping = "wrapping",
|
|
12
13
|
Direction = "direction",
|
|
13
14
|
DirectionToggle = "directionToggle",
|
|
14
15
|
Orientation = "orientation",
|
|
@@ -58,6 +59,9 @@ export interface ColorConfig extends Config<Color> {
|
|
|
58
59
|
export interface ComparisonConfig extends Config<Comparison> {
|
|
59
60
|
readonly type: ConfigType.Comparison;
|
|
60
61
|
}
|
|
62
|
+
export interface WrappingConfig extends Config<Wrapping> {
|
|
63
|
+
readonly type: ConfigType.Wrapping;
|
|
64
|
+
}
|
|
61
65
|
export interface DirectionConfig extends Config<Direction> {
|
|
62
66
|
readonly type: ConfigType.Direction;
|
|
63
67
|
}
|
|
@@ -93,7 +97,7 @@ export interface NullableNoteConfig extends Config<string | null> {
|
|
|
93
97
|
export interface SolvePathConfig extends Config<Position[]> {
|
|
94
98
|
readonly type: ConfigType.SolvePath;
|
|
95
99
|
}
|
|
96
|
-
export type AnyConfig = BooleanConfig | NullableBooleanConfig | NumberConfig | NullableNumberConfig | StringConfig | ColorConfig | ComparisonConfig | DirectionConfig | DirectionToggleConfig | OrientationConfig | OrientationToggleConfig | TileConfig | GridConfig | NullableGridConfig | IconConfig | ControlLinesConfig | NullableNoteConfig | SolvePathConfig;
|
|
100
|
+
export type AnyConfig = BooleanConfig | NullableBooleanConfig | NumberConfig | NullableNumberConfig | StringConfig | ColorConfig | ComparisonConfig | WrappingConfig | DirectionConfig | DirectionToggleConfig | OrientationConfig | OrientationToggleConfig | TileConfig | GridConfig | NullableGridConfig | IconConfig | ControlLinesConfig | NullableNoteConfig | SolvePathConfig;
|
|
97
101
|
/**
|
|
98
102
|
* Compare two config values for equality, using an appropriate method for the config type.
|
|
99
103
|
*
|
package/dist/data/config.js
CHANGED
|
@@ -8,6 +8,7 @@ export var ConfigType;
|
|
|
8
8
|
ConfigType["String"] = "string";
|
|
9
9
|
ConfigType["Color"] = "color";
|
|
10
10
|
ConfigType["Comparison"] = "comparison";
|
|
11
|
+
ConfigType["Wrapping"] = "wrapping";
|
|
11
12
|
ConfigType["Direction"] = "direction";
|
|
12
13
|
ConfigType["DirectionToggle"] = "directionToggle";
|
|
13
14
|
ConfigType["Orientation"] = "orientation";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import Instruction from '../instruction.js';
|
|
2
|
+
import { Position } from '../primitives.js';
|
|
3
|
+
import GridData from '../grid.js';
|
|
4
|
+
export interface GetTileHandler {
|
|
5
|
+
onGetTile(x: number, y: number, grid: GridData): Position;
|
|
6
|
+
}
|
|
7
|
+
export declare function handlesGetTile<T extends Instruction>(val: T): val is T & GetTileHandler;
|
package/dist/data/grid.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ import MusicGridRule from './rules/musicGridRule.js';
|
|
|
8
8
|
import CompletePatternRule from './rules/completePatternRule.js';
|
|
9
9
|
import UndercluedRule from './rules/undercluedRule.js';
|
|
10
10
|
import GridZones from './gridZones.js';
|
|
11
|
+
import WrapAroundRule from './rules/wrapAroundRule.js';
|
|
11
12
|
export declare const NEIGHBOR_OFFSETS: Position[];
|
|
12
13
|
export default class GridData {
|
|
13
14
|
readonly width: number;
|
|
@@ -20,6 +21,7 @@ export default class GridData {
|
|
|
20
21
|
readonly musicGrid: CachedAccess<MusicGridRule | undefined>;
|
|
21
22
|
readonly completePattern: CachedAccess<CompletePatternRule | undefined>;
|
|
22
23
|
readonly underclued: CachedAccess<UndercluedRule | undefined>;
|
|
24
|
+
readonly wrapAround: CachedAccess<WrapAroundRule | undefined>;
|
|
23
25
|
/**
|
|
24
26
|
* Create a new grid with tiles, connections, symbols and rules.
|
|
25
27
|
*
|
|
@@ -86,6 +88,7 @@ export default class GridData {
|
|
|
86
88
|
symbols?: ReadonlyMap<string, readonly Symbol[]>;
|
|
87
89
|
rules?: readonly Rule[];
|
|
88
90
|
}): GridData;
|
|
91
|
+
toArrayCoordinates(x: number, y: number): Position;
|
|
89
92
|
isPositionValid(x: number, y: number): boolean;
|
|
90
93
|
/**
|
|
91
94
|
* Safely get the tile at the given position.
|
|
@@ -255,9 +258,10 @@ export default class GridData {
|
|
|
255
258
|
* @param position The position to start the iteration from. This position is included in the iteration.
|
|
256
259
|
* @param predicate The predicate to test each tile with. The callback is only called for tiles that satisfy this predicate.
|
|
257
260
|
* @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.
|
|
261
|
+
* @param visited A 2D array to keep track of visited tiles. This array is modified by the function.
|
|
258
262
|
* @returns The value returned by the callback that stopped the iteration, or undefined if the iteration completed.
|
|
259
263
|
*/
|
|
260
|
-
iterateArea<T>(position: Position, predicate: (tile: TileData) => boolean, callback: (tile: TileData, x: number, y: number) => undefined | T): T | undefined;
|
|
264
|
+
iterateArea<T>(position: Position, predicate: (tile: TileData) => boolean, callback: (tile: TileData, x: number, y: number, logicalX: number, logicalY: number) => undefined | T, visited?: boolean[][]): T | undefined;
|
|
261
265
|
/**
|
|
262
266
|
* Iterate over all tiles in a straight line from the given position in the given direction that satisfy the predicate.
|
|
263
267
|
* The iteration stops when the callback returns a value that is not undefined.
|
|
@@ -267,9 +271,10 @@ export default class GridData {
|
|
|
267
271
|
* @param direction The direction to iterate in.
|
|
268
272
|
* @param predicate The predicate to test each tile with. The callback is only called for tiles that satisfy this predicate.
|
|
269
273
|
* @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.
|
|
274
|
+
* @param visited A 2D array to keep track of visited tiles. This array is modified by the function.
|
|
270
275
|
* @returns The value returned by the callback that stopped the iteration, or undefined if the iteration completed.
|
|
271
276
|
*/
|
|
272
|
-
iterateDirection<T>(position: Position, direction: Direction | Orientation, predicate: (tile: TileData) => boolean, callback: (tile: TileData, x: number, y: number) => T | undefined): T | undefined;
|
|
277
|
+
iterateDirection<T>(position: Position, direction: Direction | Orientation, predicate: (tile: TileData) => boolean, callback: (tile: TileData, x: number, y: number, logicalX: number, logicalY: number) => T | undefined, visited?: boolean[][]): T | undefined;
|
|
273
278
|
/**
|
|
274
279
|
* Iterate over all tiles in a straight line from the given position in the given direction that satisfy the predicate.
|
|
275
280
|
* The iteration stops when the callback returns a value that is not undefined.
|
|
@@ -279,9 +284,10 @@ export default class GridData {
|
|
|
279
284
|
* @param direction The direction to iterate in.
|
|
280
285
|
* @param predicate The predicate to test each tile with. The callback is only called for tiles that satisfy this predicate.
|
|
281
286
|
* @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.
|
|
287
|
+
* @param visited A 2D array to keep track of visited tiles. This array is modified by the function.
|
|
282
288
|
* @returns The value returned by the callback that stopped the iteration, or undefined if the iteration completed.
|
|
283
289
|
*/
|
|
284
|
-
iterateDirectionAll<T>(position: Position, direction: Direction | Orientation, predicate: (tile: TileData) => boolean, callback: (tile: TileData, x: number, y: number) => T | undefined): T | undefined;
|
|
290
|
+
iterateDirectionAll<T>(position: Position, direction: Direction | Orientation, predicate: (tile: TileData) => boolean, callback: (tile: TileData, x: number, y: number, logicalX: number, logicalY: number) => T | undefined, visited?: boolean[][]): T | undefined;
|
|
285
291
|
/**
|
|
286
292
|
* Check if every tile in the grid is filled with a color other than gray.
|
|
287
293
|
*
|
package/dist/data/grid.js
CHANGED
|
@@ -88,6 +88,12 @@ export default class GridData {
|
|
|
88
88
|
writable: true,
|
|
89
89
|
value: CachedAccess.of(() => this.findRule(rule => rule.id === MajorRule.Underclued))
|
|
90
90
|
});
|
|
91
|
+
Object.defineProperty(this, "wrapAround", {
|
|
92
|
+
enumerable: true,
|
|
93
|
+
configurable: true,
|
|
94
|
+
writable: true,
|
|
95
|
+
value: CachedAccess.of(() => this.findRule(rule => rule.id === MajorRule.WrapAround))
|
|
96
|
+
});
|
|
91
97
|
this.width = width;
|
|
92
98
|
this.height = height;
|
|
93
99
|
this.tiles = tiles ?? array(width, height, () => TileData.empty());
|
|
@@ -141,7 +147,30 @@ export default class GridData {
|
|
|
141
147
|
fastCopyWith({ width, height, tiles, connections, zones, symbols, rules, }) {
|
|
142
148
|
return new GridData(width ?? this.width, height ?? this.height, tiles ?? this.tiles, connections ?? this.connections, zones ?? this.zones, symbols ?? this.symbols, rules ?? this.rules);
|
|
143
149
|
}
|
|
150
|
+
toArrayCoordinates(x, y) {
|
|
151
|
+
// // This is the preferred way to compute tile coordinates, but for performance reasons we will just access the
|
|
152
|
+
// // wrap-around rule directly.
|
|
153
|
+
// this.rules.forEach(rule => {
|
|
154
|
+
// if (handlesGetTile(rule)) {
|
|
155
|
+
// ({ x, y } = rule.onGetTile(x, y));
|
|
156
|
+
// }
|
|
157
|
+
// });
|
|
158
|
+
// this.symbols.forEach(list =>
|
|
159
|
+
// list.forEach(symbol => {
|
|
160
|
+
// if (handlesGetTile(symbol)) {
|
|
161
|
+
// ({ x, y } = symbol.onGetTile(x, y));
|
|
162
|
+
// }
|
|
163
|
+
// })
|
|
164
|
+
// );
|
|
165
|
+
if (this.wrapAround.value) {
|
|
166
|
+
return this.wrapAround.value.onGetTile(x, y, this);
|
|
167
|
+
}
|
|
168
|
+
else {
|
|
169
|
+
return { x, y };
|
|
170
|
+
}
|
|
171
|
+
}
|
|
144
172
|
isPositionValid(x, y) {
|
|
173
|
+
({ x, y } = this.toArrayCoordinates(x, y));
|
|
145
174
|
return x >= 0 && x < this.width && y >= 0 && y < this.height;
|
|
146
175
|
}
|
|
147
176
|
/**
|
|
@@ -151,7 +180,8 @@ export default class GridData {
|
|
|
151
180
|
* @returns The tile at the given position, or a non-existent tile if the position is invalid.
|
|
152
181
|
*/
|
|
153
182
|
getTile(x, y) {
|
|
154
|
-
|
|
183
|
+
({ x, y } = this.toArrayCoordinates(x, y));
|
|
184
|
+
if (x < 0 || x >= this.width || y < 0 || y >= this.height)
|
|
155
185
|
return TileData.doesNotExist();
|
|
156
186
|
return this.tiles[y][x];
|
|
157
187
|
}
|
|
@@ -166,6 +196,7 @@ export default class GridData {
|
|
|
166
196
|
* @returns The new tile array with updated tiles.
|
|
167
197
|
*/
|
|
168
198
|
setTile(x, y, tile) {
|
|
199
|
+
({ x, y } = this.toArrayCoordinates(x, y));
|
|
169
200
|
if (x < 0 || x >= this.width || y < 0 || y >= this.height) {
|
|
170
201
|
return this.tiles;
|
|
171
202
|
}
|
|
@@ -587,22 +618,23 @@ export default class GridData {
|
|
|
587
618
|
* @param position The position to start the iteration from. This position is included in the iteration.
|
|
588
619
|
* @param predicate The predicate to test each tile with. The callback is only called for tiles that satisfy this predicate.
|
|
589
620
|
* @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.
|
|
621
|
+
* @param visited A 2D array to keep track of visited tiles. This array is modified by the function.
|
|
590
622
|
* @returns The value returned by the callback that stopped the iteration, or undefined if the iteration completed.
|
|
591
623
|
*/
|
|
592
|
-
iterateArea(position, predicate, callback) {
|
|
624
|
+
iterateArea(position, predicate, callback, visited = array(this.width, this.height, () => false)) {
|
|
593
625
|
const tile = this.getTile(position.x, position.y);
|
|
594
626
|
if (!tile.exists || !predicate(tile)) {
|
|
595
627
|
return;
|
|
596
628
|
}
|
|
597
|
-
const visited = array(this.width, this.height, () => false);
|
|
598
629
|
const stack = [position];
|
|
599
630
|
while (stack.length > 0) {
|
|
600
631
|
const { x, y } = stack.pop();
|
|
601
|
-
|
|
632
|
+
const { x: arrX, y: arrY } = this.toArrayCoordinates(x, y);
|
|
633
|
+
if (visited[arrY][arrX]) {
|
|
602
634
|
continue;
|
|
603
635
|
}
|
|
604
|
-
visited[
|
|
605
|
-
const ret = callback(this.getTile(x, y), x, y);
|
|
636
|
+
visited[arrY][arrX] = true;
|
|
637
|
+
const ret = callback(this.getTile(x, y), arrX, arrY, x, y);
|
|
606
638
|
if (ret !== undefined)
|
|
607
639
|
return ret;
|
|
608
640
|
for (const offset of NEIGHBOR_OFFSETS) {
|
|
@@ -624,10 +656,11 @@ export default class GridData {
|
|
|
624
656
|
* @param direction The direction to iterate in.
|
|
625
657
|
* @param predicate The predicate to test each tile with. The callback is only called for tiles that satisfy this predicate.
|
|
626
658
|
* @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.
|
|
659
|
+
* @param visited A 2D array to keep track of visited tiles. This array is modified by the function.
|
|
627
660
|
* @returns The value returned by the callback that stopped the iteration, or undefined if the iteration completed.
|
|
628
661
|
*/
|
|
629
|
-
iterateDirection(position, direction, predicate, callback) {
|
|
630
|
-
return this.iterateDirectionAll(position, direction, tile => tile.exists && predicate(tile), callback);
|
|
662
|
+
iterateDirection(position, direction, predicate, callback, visited = array(this.width, this.height, () => false)) {
|
|
663
|
+
return this.iterateDirectionAll(position, direction, tile => tile.exists && predicate(tile), callback, visited);
|
|
631
664
|
}
|
|
632
665
|
/**
|
|
633
666
|
* Iterate over all tiles in a straight line from the given position in the given direction that satisfy the predicate.
|
|
@@ -638,16 +671,22 @@ export default class GridData {
|
|
|
638
671
|
* @param direction The direction to iterate in.
|
|
639
672
|
* @param predicate The predicate to test each tile with. The callback is only called for tiles that satisfy this predicate.
|
|
640
673
|
* @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.
|
|
674
|
+
* @param visited A 2D array to keep track of visited tiles. This array is modified by the function.
|
|
641
675
|
* @returns The value returned by the callback that stopped the iteration, or undefined if the iteration completed.
|
|
642
676
|
*/
|
|
643
|
-
iterateDirectionAll(position, direction, predicate, callback) {
|
|
677
|
+
iterateDirectionAll(position, direction, predicate, callback, visited = array(this.width, this.height, () => false)) {
|
|
644
678
|
let current = position;
|
|
645
679
|
while (this.isPositionValid(current.x, current.y)) {
|
|
680
|
+
const arrPos = this.toArrayCoordinates(current.x, current.y);
|
|
681
|
+
if (visited[arrPos.y][arrPos.x]) {
|
|
682
|
+
break;
|
|
683
|
+
}
|
|
684
|
+
visited[arrPos.y][arrPos.x] = true;
|
|
646
685
|
const tile = this.getTile(current.x, current.y);
|
|
647
686
|
if (!predicate(tile)) {
|
|
648
687
|
break;
|
|
649
688
|
}
|
|
650
|
-
const ret = callback(tile, current.x, current.y);
|
|
689
|
+
const ret = callback(tile, arrPos.x, arrPos.y, current.x, current.y);
|
|
651
690
|
if (ret !== undefined)
|
|
652
691
|
return ret;
|
|
653
692
|
current = move(current, direction);
|
|
@@ -14,7 +14,8 @@ export interface Edge {
|
|
|
14
14
|
export declare enum MajorRule {
|
|
15
15
|
MusicGrid = "music",
|
|
16
16
|
CompletePattern = "complete_pattern",
|
|
17
|
-
Underclued = "underclued"
|
|
17
|
+
Underclued = "underclued",
|
|
18
|
+
WrapAround = "wrap_around"
|
|
18
19
|
}
|
|
19
20
|
export declare enum State {
|
|
20
21
|
/**
|
|
@@ -63,6 +64,12 @@ export declare enum Comparison {
|
|
|
63
64
|
AtMost = "le"
|
|
64
65
|
}
|
|
65
66
|
export declare const COMPARISONS: readonly Comparison[];
|
|
67
|
+
export declare enum Wrapping {
|
|
68
|
+
None = "none",
|
|
69
|
+
Wrap = "wrap",
|
|
70
|
+
WrapReverse = "wrap-reverse"
|
|
71
|
+
}
|
|
72
|
+
export declare const WRAPPINGS: readonly Wrapping[];
|
|
66
73
|
export declare enum Direction {
|
|
67
74
|
Up = "up",
|
|
68
75
|
Down = "down",
|
package/dist/data/primitives.js
CHANGED
|
@@ -6,6 +6,7 @@ export var MajorRule;
|
|
|
6
6
|
MajorRule["MusicGrid"] = "music";
|
|
7
7
|
MajorRule["CompletePattern"] = "complete_pattern";
|
|
8
8
|
MajorRule["Underclued"] = "underclued";
|
|
9
|
+
MajorRule["WrapAround"] = "wrap_around";
|
|
9
10
|
})(MajorRule || (MajorRule = {}));
|
|
10
11
|
export var State;
|
|
11
12
|
(function (State) {
|
|
@@ -50,6 +51,17 @@ export const COMPARISONS = [
|
|
|
50
51
|
Comparison.AtLeast,
|
|
51
52
|
Comparison.AtMost,
|
|
52
53
|
];
|
|
54
|
+
export var Wrapping;
|
|
55
|
+
(function (Wrapping) {
|
|
56
|
+
Wrapping["None"] = "none";
|
|
57
|
+
Wrapping["Wrap"] = "wrap";
|
|
58
|
+
Wrapping["WrapReverse"] = "wrap-reverse";
|
|
59
|
+
})(Wrapping || (Wrapping = {}));
|
|
60
|
+
export const WRAPPINGS = [
|
|
61
|
+
Wrapping.None,
|
|
62
|
+
Wrapping.Wrap,
|
|
63
|
+
Wrapping.WrapReverse,
|
|
64
|
+
];
|
|
53
65
|
export var Direction;
|
|
54
66
|
(function (Direction) {
|
|
55
67
|
Direction["Up"] = "up";
|
|
@@ -71,8 +71,8 @@ class BanPatternRule extends Rule {
|
|
|
71
71
|
}
|
|
72
72
|
validateGrid(grid) {
|
|
73
73
|
for (const pattern of this.cache) {
|
|
74
|
-
for (let y = 0; y <= grid.height -
|
|
75
|
-
for (let x = 0; x <= grid.width -
|
|
74
|
+
for (let y = 0; y <= grid.height - 1; y++) {
|
|
75
|
+
for (let x = 0; x <= grid.width - 1; x++) {
|
|
76
76
|
let match = true;
|
|
77
77
|
for (const tile of pattern.elements) {
|
|
78
78
|
const t = grid.getTile(x + tile.x, y + tile.y);
|
|
@@ -84,10 +84,7 @@ class BanPatternRule extends Rule {
|
|
|
84
84
|
if (match) {
|
|
85
85
|
return {
|
|
86
86
|
state: State.Error,
|
|
87
|
-
positions: pattern.elements.map(tile => (
|
|
88
|
-
x: x + tile.x,
|
|
89
|
-
y: y + tile.y,
|
|
90
|
-
})),
|
|
87
|
+
positions: pattern.elements.map(tile => grid.toArrayCoordinates(x + tile.x, y + tile.y)),
|
|
91
88
|
};
|
|
92
89
|
}
|
|
93
90
|
}
|
|
@@ -58,7 +58,8 @@ class CellCountPerZoneRule extends Rule {
|
|
|
58
58
|
};
|
|
59
59
|
const stack = [seed];
|
|
60
60
|
while (stack.length > 0) {
|
|
61
|
-
|
|
61
|
+
let { x, y } = stack.pop();
|
|
62
|
+
({ x, y } = grid.toArrayCoordinates(x, y));
|
|
62
63
|
if (visited[y][x])
|
|
63
64
|
continue;
|
|
64
65
|
visited[y][x] = true;
|
|
@@ -71,12 +72,13 @@ class CellCountPerZoneRule extends Rule {
|
|
|
71
72
|
complete = false;
|
|
72
73
|
}
|
|
73
74
|
for (const offset of NEIGHBOR_OFFSETS) {
|
|
74
|
-
const next =
|
|
75
|
-
if (!grid.zones.edges.some(e =>
|
|
76
|
-
|
|
77
|
-
e.x2
|
|
78
|
-
|
|
79
|
-
|
|
75
|
+
const next = grid.toArrayCoordinates(x + offset.x, y + offset.y);
|
|
76
|
+
if (!grid.zones.edges.some(e => {
|
|
77
|
+
const { x: x1, y: y1 } = grid.toArrayCoordinates(e.x1, e.y1);
|
|
78
|
+
const { x: x2, y: y2 } = grid.toArrayCoordinates(e.x2, e.y2);
|
|
79
|
+
return ((x1 === x && y1 === y && x2 === next.x && y2 === next.y) ||
|
|
80
|
+
(x2 === x && y2 === y && x1 === next.x && y1 === next.y));
|
|
81
|
+
})) {
|
|
80
82
|
const nextTile = grid.getTile(next.x, next.y);
|
|
81
83
|
if (nextTile.exists) {
|
|
82
84
|
stack.push(next);
|
|
@@ -25,7 +25,7 @@ export default class MusicGridRule extends Rule implements GridChangeHandler, Se
|
|
|
25
25
|
get configs(): readonly AnyConfig[] | null;
|
|
26
26
|
createExampleGrid(): GridData;
|
|
27
27
|
get searchVariants(): SearchVariant[];
|
|
28
|
-
validateGrid(
|
|
28
|
+
validateGrid(grid: GridData): RuleState;
|
|
29
29
|
onSetGrid(_oldGrid: GridData, newGrid: GridData, _solution: GridData | null): GridData;
|
|
30
30
|
onGridChange(newGrid: GridData): this;
|
|
31
31
|
onGridResize(_grid: GridData, mode: 'insert' | 'remove', direction: 'row' | 'column', index: number): this | null;
|
|
@@ -61,8 +61,13 @@ class MusicGridRule extends Rule {
|
|
|
61
61
|
get searchVariants() {
|
|
62
62
|
return MusicGridRule.SEARCH_VARIANTS;
|
|
63
63
|
}
|
|
64
|
-
validateGrid(
|
|
65
|
-
|
|
64
|
+
validateGrid(grid) {
|
|
65
|
+
if (grid.getTileCount(true, false, Color.Gray) > 0) {
|
|
66
|
+
return { state: State.Incomplete };
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
return { state: State.Satisfied };
|
|
70
|
+
}
|
|
66
71
|
}
|
|
67
72
|
onSetGrid(_oldGrid, newGrid, _solution) {
|
|
68
73
|
if (newGrid.getTileCount(true, undefined, Color.Gray) === 0)
|
|
@@ -30,9 +30,9 @@ export default class RegionShapeRule extends Rule {
|
|
|
30
30
|
if (!seed)
|
|
31
31
|
break;
|
|
32
32
|
const positions = [];
|
|
33
|
-
grid.iterateArea(seed, tile => tile.color === this.color, (_, x, y) => {
|
|
33
|
+
grid.iterateArea(seed, tile => tile.color === this.color, (_, x, y, logX, logY) => {
|
|
34
34
|
visited[y][x] = true;
|
|
35
|
-
positions.push({ x, y });
|
|
35
|
+
positions.push({ x: logX, y: logY });
|
|
36
36
|
});
|
|
37
37
|
const incomplete = grid.iterateArea(seed, tile => tile.color === this.color || tile.color === Color.Gray, tile => {
|
|
38
38
|
if (tile.color === Color.Gray)
|
|
@@ -46,7 +46,11 @@ export default class RegionShapeRule extends Rule {
|
|
|
46
46
|
existing.count++;
|
|
47
47
|
}
|
|
48
48
|
else {
|
|
49
|
-
regions.push({
|
|
49
|
+
regions.push({
|
|
50
|
+
positions: positions.map(pos => grid.toArrayCoordinates(pos.x, pos.y)),
|
|
51
|
+
shape,
|
|
52
|
+
count: 1,
|
|
53
|
+
});
|
|
50
54
|
}
|
|
51
55
|
}
|
|
52
56
|
return { regions, complete };
|
|
@@ -15,3 +15,4 @@ export { instance as SameShapeRule } from './sameShapeRule.js';
|
|
|
15
15
|
export { instance as SymbolsPerRegionRule } from './symbolsPerRegionRule.js';
|
|
16
16
|
export { instance as UndercluedRule } from './undercluedRule.js';
|
|
17
17
|
export { instance as UniqueShapeRule } from './uniqueShapeRule.js';
|
|
18
|
+
export { instance as WrapAroundRule } from './wrapAroundRule.js';
|
|
@@ -19,3 +19,4 @@ export { instance as SameShapeRule } from './sameShapeRule.js';
|
|
|
19
19
|
export { instance as SymbolsPerRegionRule } from './symbolsPerRegionRule.js';
|
|
20
20
|
export { instance as UndercluedRule } from './undercluedRule.js';
|
|
21
21
|
export { instance as UniqueShapeRule } from './uniqueShapeRule.js';
|
|
22
|
+
export { instance as WrapAroundRule } from './wrapAroundRule.js';
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { AnyConfig } from '../config.js';
|
|
2
|
+
import { GetTileHandler } from '../events/onGetTile.js';
|
|
3
|
+
import GridData from '../grid.js';
|
|
4
|
+
import { Position, RuleState, Wrapping } from '../primitives.js';
|
|
5
|
+
import Rule, { SearchVariant } from './rule.js';
|
|
6
|
+
export default class WrapAroundRule extends Rule implements GetTileHandler {
|
|
7
|
+
readonly horizontal: Wrapping;
|
|
8
|
+
readonly vertical: Wrapping;
|
|
9
|
+
private static readonly EXAMPLE_GRID_NONE;
|
|
10
|
+
private static readonly EXAMPLE_GRID_HORIZONTAL;
|
|
11
|
+
private static readonly EXAMPLE_GRID_HORIZONTAL_REVERSE;
|
|
12
|
+
private static readonly EXAMPLE_GRID_VERTICAL;
|
|
13
|
+
private static readonly EXAMPLE_GRID_VERTICAL_REVERSE;
|
|
14
|
+
private static readonly SEARCH_VARIANTS;
|
|
15
|
+
private static readonly CONFIGS;
|
|
16
|
+
/**
|
|
17
|
+
* **The left and right edges are connected (in reverse)**
|
|
18
|
+
*
|
|
19
|
+
* @param horizontal - The horizontal wrapping.
|
|
20
|
+
* @param vertical - The vertical wrapping.
|
|
21
|
+
*/
|
|
22
|
+
constructor(horizontal: Wrapping, vertical: Wrapping);
|
|
23
|
+
onGetTile(x: number, y: number, grid: GridData): Position;
|
|
24
|
+
get id(): string;
|
|
25
|
+
get explanation(): string;
|
|
26
|
+
createExampleGrid(): GridData;
|
|
27
|
+
get configs(): readonly AnyConfig[] | null;
|
|
28
|
+
get searchVariants(): SearchVariant[];
|
|
29
|
+
validateGrid(grid: GridData): RuleState;
|
|
30
|
+
copyWith({ horizontal, vertical, }: {
|
|
31
|
+
horizontal?: Wrapping;
|
|
32
|
+
vertical?: Wrapping;
|
|
33
|
+
}): this;
|
|
34
|
+
get isSingleton(): boolean;
|
|
35
|
+
}
|
|
36
|
+
export declare const instance: WrapAroundRule;
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
import { ConfigType } from '../config.js';
|
|
2
|
+
import { array } from '../dataHelper.js';
|
|
3
|
+
import GridData from '../grid.js';
|
|
4
|
+
import { Color, MajorRule, State, Wrapping, } from '../primitives.js';
|
|
5
|
+
import LetterSymbol from '../symbols/letterSymbol.js';
|
|
6
|
+
import Rule from './rule.js';
|
|
7
|
+
class WrapAroundRule extends Rule {
|
|
8
|
+
/**
|
|
9
|
+
* **The left and right edges are connected (in reverse)**
|
|
10
|
+
*
|
|
11
|
+
* @param horizontal - The horizontal wrapping.
|
|
12
|
+
* @param vertical - The vertical wrapping.
|
|
13
|
+
*/
|
|
14
|
+
constructor(horizontal, vertical) {
|
|
15
|
+
super();
|
|
16
|
+
Object.defineProperty(this, "horizontal", {
|
|
17
|
+
enumerable: true,
|
|
18
|
+
configurable: true,
|
|
19
|
+
writable: true,
|
|
20
|
+
value: horizontal
|
|
21
|
+
});
|
|
22
|
+
Object.defineProperty(this, "vertical", {
|
|
23
|
+
enumerable: true,
|
|
24
|
+
configurable: true,
|
|
25
|
+
writable: true,
|
|
26
|
+
value: vertical
|
|
27
|
+
});
|
|
28
|
+
this.horizontal = horizontal;
|
|
29
|
+
this.vertical = vertical;
|
|
30
|
+
}
|
|
31
|
+
onGetTile(x, y, grid) {
|
|
32
|
+
if (this.horizontal !== Wrapping.None) {
|
|
33
|
+
const idx = Math.abs(Math.floor(x / grid.width));
|
|
34
|
+
x = ((x % grid.width) + grid.width) % grid.width;
|
|
35
|
+
if (this.horizontal === Wrapping.WrapReverse && idx % 2 === 1) {
|
|
36
|
+
y = grid.height - 1 - y;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
if (this.vertical !== Wrapping.None) {
|
|
40
|
+
const idx = Math.abs(Math.floor(y / grid.height));
|
|
41
|
+
y = ((y % grid.height) + grid.height) % grid.height;
|
|
42
|
+
if (this.vertical === Wrapping.WrapReverse && idx % 2 === 1) {
|
|
43
|
+
x = grid.width - 1 - x;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return { x, y };
|
|
47
|
+
}
|
|
48
|
+
get id() {
|
|
49
|
+
return MajorRule.WrapAround;
|
|
50
|
+
}
|
|
51
|
+
get explanation() {
|
|
52
|
+
if (this.horizontal === Wrapping.None && this.vertical === Wrapping.None) {
|
|
53
|
+
return `No edges are connected.`;
|
|
54
|
+
}
|
|
55
|
+
else if (this.horizontal === Wrapping.None) {
|
|
56
|
+
return `The top and bottom edges are connected${this.vertical === Wrapping.WrapReverse ? ' in reverse' : ''}.`;
|
|
57
|
+
}
|
|
58
|
+
else if (this.vertical === Wrapping.None) {
|
|
59
|
+
return `The left and right edges are connected${this.horizontal === Wrapping.WrapReverse ? ' in reverse' : ''}.`;
|
|
60
|
+
}
|
|
61
|
+
else if (this.horizontal === Wrapping.Wrap &&
|
|
62
|
+
this.vertical === Wrapping.Wrap) {
|
|
63
|
+
return `All four edges are connected.`;
|
|
64
|
+
}
|
|
65
|
+
else if (this.horizontal === Wrapping.Wrap) {
|
|
66
|
+
return `All four edges are connected, with the top and bottom edges in reverse.`;
|
|
67
|
+
}
|
|
68
|
+
else if (this.vertical === Wrapping.Wrap) {
|
|
69
|
+
return `All four edges are connected, with the left and right edges in reverse.`;
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
return `All four edges are connected in reverse.`;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
createExampleGrid() {
|
|
76
|
+
const horizontal = this.horizontal === Wrapping.Wrap
|
|
77
|
+
? WrapAroundRule.EXAMPLE_GRID_HORIZONTAL
|
|
78
|
+
: this.horizontal === Wrapping.WrapReverse
|
|
79
|
+
? WrapAroundRule.EXAMPLE_GRID_HORIZONTAL_REVERSE
|
|
80
|
+
: WrapAroundRule.EXAMPLE_GRID_NONE;
|
|
81
|
+
const vertical = this.vertical === Wrapping.Wrap
|
|
82
|
+
? WrapAroundRule.EXAMPLE_GRID_VERTICAL
|
|
83
|
+
: this.vertical === Wrapping.WrapReverse
|
|
84
|
+
? WrapAroundRule.EXAMPLE_GRID_VERTICAL_REVERSE
|
|
85
|
+
: WrapAroundRule.EXAMPLE_GRID_NONE;
|
|
86
|
+
if (horizontal === WrapAroundRule.EXAMPLE_GRID_NONE) {
|
|
87
|
+
return vertical;
|
|
88
|
+
}
|
|
89
|
+
else if (vertical === WrapAroundRule.EXAMPLE_GRID_NONE) {
|
|
90
|
+
return horizontal;
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
const tiles = array(5, 5, (x, y) => {
|
|
94
|
+
const hTile = horizontal.getTile(x, y);
|
|
95
|
+
const vTile = vertical.getTile(x, y);
|
|
96
|
+
return hTile.withColor(hTile.color === Color.Dark || vTile.color === Color.Dark
|
|
97
|
+
? Color.Dark
|
|
98
|
+
: Color.Light);
|
|
99
|
+
});
|
|
100
|
+
const symbols = [];
|
|
101
|
+
horizontal.symbols.forEach(list => symbols.push(...list));
|
|
102
|
+
vertical.symbols.forEach(list => symbols.push(...list));
|
|
103
|
+
return horizontal.withTiles(tiles).withSymbols(symbols);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
get configs() {
|
|
107
|
+
return WrapAroundRule.CONFIGS;
|
|
108
|
+
}
|
|
109
|
+
get searchVariants() {
|
|
110
|
+
return WrapAroundRule.SEARCH_VARIANTS;
|
|
111
|
+
}
|
|
112
|
+
validateGrid(grid) {
|
|
113
|
+
if (grid.getTileCount(true, false, Color.Gray) > 0) {
|
|
114
|
+
return { state: State.Incomplete };
|
|
115
|
+
}
|
|
116
|
+
else {
|
|
117
|
+
return { state: State.Satisfied };
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
copyWith({ horizontal, vertical, }) {
|
|
121
|
+
return new WrapAroundRule(horizontal ?? this.horizontal, vertical ?? this.vertical);
|
|
122
|
+
}
|
|
123
|
+
get isSingleton() {
|
|
124
|
+
return true;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
Object.defineProperty(WrapAroundRule, "EXAMPLE_GRID_NONE", {
|
|
128
|
+
enumerable: true,
|
|
129
|
+
configurable: true,
|
|
130
|
+
writable: true,
|
|
131
|
+
value: Object.freeze(GridData.create(['wwwww', 'wwwww', 'wwwww', 'wwwww', 'wwwww']))
|
|
132
|
+
});
|
|
133
|
+
Object.defineProperty(WrapAroundRule, "EXAMPLE_GRID_HORIZONTAL", {
|
|
134
|
+
enumerable: true,
|
|
135
|
+
configurable: true,
|
|
136
|
+
writable: true,
|
|
137
|
+
value: Object.freeze(GridData.create(['wwwww', 'bwwwb', 'wwwww', 'bwwwb', 'wwwww'])
|
|
138
|
+
.addSymbol(new LetterSymbol(0, 1, 'A'))
|
|
139
|
+
.addSymbol(new LetterSymbol(4, 1, 'A'))
|
|
140
|
+
.addSymbol(new LetterSymbol(0, 3, 'B'))
|
|
141
|
+
.addSymbol(new LetterSymbol(4, 3, 'B')))
|
|
142
|
+
});
|
|
143
|
+
Object.defineProperty(WrapAroundRule, "EXAMPLE_GRID_HORIZONTAL_REVERSE", {
|
|
144
|
+
enumerable: true,
|
|
145
|
+
configurable: true,
|
|
146
|
+
writable: true,
|
|
147
|
+
value: Object.freeze(GridData.create(['wwwww', 'bwwwb', 'wwwww', 'bwwwb', 'wwwww'])
|
|
148
|
+
.addSymbol(new LetterSymbol(0, 1, 'A'))
|
|
149
|
+
.addSymbol(new LetterSymbol(4, 1, 'B'))
|
|
150
|
+
.addSymbol(new LetterSymbol(0, 3, 'B'))
|
|
151
|
+
.addSymbol(new LetterSymbol(4, 3, 'A')))
|
|
152
|
+
});
|
|
153
|
+
Object.defineProperty(WrapAroundRule, "EXAMPLE_GRID_VERTICAL", {
|
|
154
|
+
enumerable: true,
|
|
155
|
+
configurable: true,
|
|
156
|
+
writable: true,
|
|
157
|
+
value: Object.freeze(GridData.create(['wbwbw', 'wwwww', 'wwwww', 'wwwww', 'wbwbw'])
|
|
158
|
+
.addSymbol(new LetterSymbol(1, 0, 'C'))
|
|
159
|
+
.addSymbol(new LetterSymbol(3, 0, 'D'))
|
|
160
|
+
.addSymbol(new LetterSymbol(1, 4, 'C'))
|
|
161
|
+
.addSymbol(new LetterSymbol(3, 4, 'D')))
|
|
162
|
+
});
|
|
163
|
+
Object.defineProperty(WrapAroundRule, "EXAMPLE_GRID_VERTICAL_REVERSE", {
|
|
164
|
+
enumerable: true,
|
|
165
|
+
configurable: true,
|
|
166
|
+
writable: true,
|
|
167
|
+
value: Object.freeze(GridData.create(['wbwbw', 'wwwww', 'wwwww', 'wwwww', 'wbwbw'])
|
|
168
|
+
.addSymbol(new LetterSymbol(1, 0, 'C'))
|
|
169
|
+
.addSymbol(new LetterSymbol(3, 0, 'D'))
|
|
170
|
+
.addSymbol(new LetterSymbol(1, 4, 'D'))
|
|
171
|
+
.addSymbol(new LetterSymbol(3, 4, 'C')))
|
|
172
|
+
});
|
|
173
|
+
Object.defineProperty(WrapAroundRule, "SEARCH_VARIANTS", {
|
|
174
|
+
enumerable: true,
|
|
175
|
+
configurable: true,
|
|
176
|
+
writable: true,
|
|
177
|
+
value: [
|
|
178
|
+
new WrapAroundRule(Wrapping.Wrap, Wrapping.None).searchVariant(),
|
|
179
|
+
new WrapAroundRule(Wrapping.None, Wrapping.Wrap).searchVariant(),
|
|
180
|
+
new WrapAroundRule(Wrapping.Wrap, Wrapping.Wrap).searchVariant(),
|
|
181
|
+
]
|
|
182
|
+
});
|
|
183
|
+
Object.defineProperty(WrapAroundRule, "CONFIGS", {
|
|
184
|
+
enumerable: true,
|
|
185
|
+
configurable: true,
|
|
186
|
+
writable: true,
|
|
187
|
+
value: Object.freeze([
|
|
188
|
+
{
|
|
189
|
+
type: ConfigType.Wrapping,
|
|
190
|
+
default: Wrapping.Wrap,
|
|
191
|
+
field: 'horizontal',
|
|
192
|
+
description: 'Horizontal wrap',
|
|
193
|
+
configurable: true,
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
type: ConfigType.Wrapping,
|
|
197
|
+
default: Wrapping.Wrap,
|
|
198
|
+
field: 'vertical',
|
|
199
|
+
description: 'Vertical wrap',
|
|
200
|
+
configurable: true,
|
|
201
|
+
},
|
|
202
|
+
])
|
|
203
|
+
});
|
|
204
|
+
export default WrapAroundRule;
|
|
205
|
+
export const instance = new WrapAroundRule(Wrapping.Wrap, Wrapping.Wrap);
|
|
@@ -103,6 +103,7 @@ export default class SerializerV0 extends SerializerBase {
|
|
|
103
103
|
case ConfigType.Number:
|
|
104
104
|
case ConfigType.Color:
|
|
105
105
|
case ConfigType.Comparison:
|
|
106
|
+
case ConfigType.Wrapping:
|
|
106
107
|
case ConfigType.Direction:
|
|
107
108
|
case ConfigType.Orientation:
|
|
108
109
|
return (config.field +
|
|
@@ -190,6 +191,8 @@ export default class SerializerV0 extends SerializerBase {
|
|
|
190
191
|
return [config.field, value];
|
|
191
192
|
case ConfigType.Comparison:
|
|
192
193
|
return [config.field, value];
|
|
194
|
+
case ConfigType.Wrapping:
|
|
195
|
+
return [config.field, value];
|
|
193
196
|
case ConfigType.Direction:
|
|
194
197
|
return [config.field, value];
|
|
195
198
|
case ConfigType.DirectionToggle: {
|
|
@@ -44,6 +44,10 @@ function backtrack(grid, rawTiles, submitSolution) {
|
|
|
44
44
|
return false;
|
|
45
45
|
}
|
|
46
46
|
function solveNormal(input, submitSolution) {
|
|
47
|
+
const isValid = validateGrid(input, null);
|
|
48
|
+
if (isValid.final === State.Error) {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
47
51
|
// Call backtrack
|
|
48
52
|
backtrack(input, gridToRawTiles(input), rawTiles => submitSolution(rawTiles ? rawTilesToGrid(rawTiles, input) : null));
|
|
49
53
|
}
|
|
@@ -65,11 +65,8 @@ class DirectionLinkerSymbol extends Symbol {
|
|
|
65
65
|
createExampleGrid() {
|
|
66
66
|
return DirectionLinkerSymbol.EXAMPLE_GRID;
|
|
67
67
|
}
|
|
68
|
-
deltaCoordinate(c, direction) {
|
|
69
|
-
return
|
|
70
|
-
x: c.x + DirectionLinkerSymbol.directionDeltas[direction].dx,
|
|
71
|
-
y: c.y + DirectionLinkerSymbol.directionDeltas[direction].dy,
|
|
72
|
-
};
|
|
68
|
+
deltaCoordinate(c, direction, grid) {
|
|
69
|
+
return grid.toArrayCoordinates(c.x + DirectionLinkerSymbol.directionDeltas[direction].dx, c.y + DirectionLinkerSymbol.directionDeltas[direction].dy);
|
|
73
70
|
}
|
|
74
71
|
validateSymbol(grid) {
|
|
75
72
|
// A turtle is an object which have 2 coordinates
|
|
@@ -115,8 +112,8 @@ class DirectionLinkerSymbol extends Symbol {
|
|
|
115
112
|
const directions = Object.keys(this.linkedDirections);
|
|
116
113
|
for (const direction of directions) {
|
|
117
114
|
const newTurtle = {
|
|
118
|
-
pos1: this.deltaCoordinate(pos1, direction),
|
|
119
|
-
pos2: this.deltaCoordinate(pos2, this.linkedDirections[direction]),
|
|
115
|
+
pos1: this.deltaCoordinate(pos1, direction, grid),
|
|
116
|
+
pos2: this.deltaCoordinate(pos2, this.linkedDirections[direction], grid),
|
|
120
117
|
color1: baseColor1,
|
|
121
118
|
color2: baseColor2,
|
|
122
119
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ConfigType } from '../config.js';
|
|
2
2
|
import GridData from '../grid.js';
|
|
3
|
-
import { move } from '../dataHelper.js';
|
|
3
|
+
import { array, move } from '../dataHelper.js';
|
|
4
4
|
import { Color, DIRECTIONS } from '../primitives.js';
|
|
5
5
|
import NumberSymbol from './numberSymbol.js';
|
|
6
6
|
class ViewpointSymbol extends NumberSymbol {
|
|
@@ -31,6 +31,7 @@ class ViewpointSymbol extends NumberSymbol {
|
|
|
31
31
|
countForColor(grid, color, pos) {
|
|
32
32
|
let minSize = 1;
|
|
33
33
|
let maxSize = 1;
|
|
34
|
+
const visited = array(grid.width, grid.height, (x, y) => x === pos.x && y === pos.y);
|
|
34
35
|
for (const direction of DIRECTIONS) {
|
|
35
36
|
let continuous = true;
|
|
36
37
|
grid.iterateDirection(move(pos, direction), direction, tile => tile.color === color || tile.color === Color.Gray, tile => {
|
|
@@ -42,7 +43,7 @@ class ViewpointSymbol extends NumberSymbol {
|
|
|
42
43
|
if (continuous)
|
|
43
44
|
minSize++;
|
|
44
45
|
}
|
|
45
|
-
});
|
|
46
|
+
}, visited);
|
|
46
47
|
}
|
|
47
48
|
return { completed: minSize, possible: maxSize };
|
|
48
49
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import Configurable from './data/configurable.js';
|
|
|
3
3
|
import { CachedAccess, allEqual, array, directionToRotation, escape, isSameEdge, maxBy, minBy, move, orientationToRotation, resize, unescape } from './data/dataHelper.js';
|
|
4
4
|
import { isEventHandler } from './data/events/eventHelper.js';
|
|
5
5
|
import { handlesFinalValidation } from './data/events/onFinalValidation.js';
|
|
6
|
+
import { handlesGetTile } from './data/events/onGetTile.js';
|
|
6
7
|
import { handlesGridChange } from './data/events/onGridChange.js';
|
|
7
8
|
import { handlesGridResize } from './data/events/onGridResize.js';
|
|
8
9
|
import { handlesSetGrid, invokeSetGrid } from './data/events/onSetGrid.js';
|
|
@@ -12,7 +13,7 @@ import GridData, { NEIGHBOR_OFFSETS } from './data/grid.js';
|
|
|
12
13
|
import GridConnections from './data/gridConnections.js';
|
|
13
14
|
import GridZones from './data/gridZones.js';
|
|
14
15
|
import Instruction from './data/instruction.js';
|
|
15
|
-
import { COMPARISONS, Color, Comparison, DIRECTIONS, Direction, MajorRule, Mode, ORIENTATIONS, Orientation, State, directionToggle, orientationToggle } from './data/primitives.js';
|
|
16
|
+
import { COMPARISONS, Color, Comparison, DIRECTIONS, Direction, MajorRule, Mode, ORIENTATIONS, Orientation, State, WRAPPINGS, Wrapping, directionToggle, orientationToggle } from './data/primitives.js';
|
|
16
17
|
import { MetadataSchema, PuzzleSchema } from './data/puzzle.js';
|
|
17
18
|
import BanPatternRule from './data/rules/banPatternRule.js';
|
|
18
19
|
import CellCountPerZoneRule from './data/rules/cellCountPerZoneRule.js';
|
|
@@ -35,6 +36,7 @@ import SameShapeRule from './data/rules/sameShapeRule.js';
|
|
|
35
36
|
import SymbolsPerRegionRule from './data/rules/symbolsPerRegionRule.js';
|
|
36
37
|
import UndercluedRule from './data/rules/undercluedRule.js';
|
|
37
38
|
import UniqueShapeRule from './data/rules/uniqueShapeRule.js';
|
|
39
|
+
import WrapAroundRule from './data/rules/wrapAroundRule.js';
|
|
38
40
|
import { Serializer } from './data/serializer/allSerializers.js';
|
|
39
41
|
import { Compressor } from './data/serializer/compressor/allCompressors.js';
|
|
40
42
|
import CompressorBase from './data/serializer/compressor/compressorBase.js';
|
|
@@ -100,4 +102,4 @@ import ViewpointSymbol from './data/symbols/viewpointSymbol.js';
|
|
|
100
102
|
import TileData from './data/tile.js';
|
|
101
103
|
import TileConnections from './data/tileConnections.js';
|
|
102
104
|
import validateGrid, { aggregateState, applyFinalOverrides } from './data/validate.js';
|
|
103
|
-
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, EventIteratingSolver, Solver, UniversalSolver, 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, handlesGetTile, handlesGridChange, handlesGridResize, handlesSetGrid, invokeSetGrid, handlesSymbolDisplay, handlesSymbolValidation, GridData, NEIGHBOR_OFFSETS, GridConnections, GridZones, Instruction, COMPARISONS, Color, Comparison, DIRECTIONS, Direction, MajorRule, Mode, ORIENTATIONS, Orientation, State, WRAPPINGS, Wrapping, 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, WrapAroundRule, 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, EventIteratingSolver, Solver, UniversalSolver, 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
|
@@ -6,6 +6,7 @@ import Configurable from './data/configurable.js';
|
|
|
6
6
|
import { CachedAccess, allEqual, array, directionToRotation, escape, isSameEdge, maxBy, minBy, move, orientationToRotation, resize, unescape } from './data/dataHelper.js';
|
|
7
7
|
import { isEventHandler } from './data/events/eventHelper.js';
|
|
8
8
|
import { handlesFinalValidation } from './data/events/onFinalValidation.js';
|
|
9
|
+
import { handlesGetTile } from './data/events/onGetTile.js';
|
|
9
10
|
import { handlesGridChange } from './data/events/onGridChange.js';
|
|
10
11
|
import { handlesGridResize } from './data/events/onGridResize.js';
|
|
11
12
|
import { handlesSetGrid, invokeSetGrid } from './data/events/onSetGrid.js';
|
|
@@ -15,7 +16,7 @@ import GridData, { NEIGHBOR_OFFSETS } from './data/grid.js';
|
|
|
15
16
|
import GridConnections from './data/gridConnections.js';
|
|
16
17
|
import GridZones from './data/gridZones.js';
|
|
17
18
|
import Instruction from './data/instruction.js';
|
|
18
|
-
import { COMPARISONS, Color, Comparison, DIRECTIONS, Direction, MajorRule, Mode, ORIENTATIONS, Orientation, State, directionToggle, orientationToggle } from './data/primitives.js';
|
|
19
|
+
import { COMPARISONS, Color, Comparison, DIRECTIONS, Direction, MajorRule, Mode, ORIENTATIONS, Orientation, State, WRAPPINGS, Wrapping, directionToggle, orientationToggle } from './data/primitives.js';
|
|
19
20
|
import { MetadataSchema, PuzzleSchema } from './data/puzzle.js';
|
|
20
21
|
import BanPatternRule from './data/rules/banPatternRule.js';
|
|
21
22
|
import CellCountPerZoneRule from './data/rules/cellCountPerZoneRule.js';
|
|
@@ -38,6 +39,7 @@ import SameShapeRule from './data/rules/sameShapeRule.js';
|
|
|
38
39
|
import SymbolsPerRegionRule from './data/rules/symbolsPerRegionRule.js';
|
|
39
40
|
import UndercluedRule from './data/rules/undercluedRule.js';
|
|
40
41
|
import UniqueShapeRule from './data/rules/uniqueShapeRule.js';
|
|
42
|
+
import WrapAroundRule from './data/rules/wrapAroundRule.js';
|
|
41
43
|
import { Serializer } from './data/serializer/allSerializers.js';
|
|
42
44
|
import { Compressor } from './data/serializer/compressor/allCompressors.js';
|
|
43
45
|
import CompressorBase from './data/serializer/compressor/compressorBase.js';
|
|
@@ -103,4 +105,4 @@ import ViewpointSymbol from './data/symbols/viewpointSymbol.js';
|
|
|
103
105
|
import TileData from './data/tile.js';
|
|
104
106
|
import TileConnections from './data/tileConnections.js';
|
|
105
107
|
import validateGrid, { aggregateState, applyFinalOverrides } from './data/validate.js';
|
|
106
|
-
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, EventIteratingSolver, Solver, UniversalSolver, 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, };
|
|
108
|
+
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, Direction, MajorRule, Mode, ORIENTATIONS, Orientation, State, WRAPPINGS, Wrapping, 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, WrapAroundRule, 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, EventIteratingSolver, Solver, UniversalSolver, 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, };
|