@logic-pad/core 0.13.4 → 0.15.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.
Files changed (77) hide show
  1. package/assets/logic-core.global.d.ts +60 -2
  2. package/dist/data/config.d.ts +7 -1
  3. package/dist/data/config.js +7 -0
  4. package/dist/data/configurable.d.ts +2 -0
  5. package/dist/data/instruction.d.ts +1 -0
  6. package/dist/data/instruction.js +3 -0
  7. package/dist/data/puzzle.js +3 -1
  8. package/dist/data/rules/banPatternRule.d.ts +1 -0
  9. package/dist/data/rules/banPatternRule.js +11 -1
  10. package/dist/data/rules/cellCountPerZoneRule.d.ts +2 -0
  11. package/dist/data/rules/cellCountPerZoneRule.js +9 -0
  12. package/dist/data/rules/cellCountRule.d.ts +1 -0
  13. package/dist/data/rules/cellCountRule.js +6 -0
  14. package/dist/data/rules/completePatternRule.d.ts +2 -0
  15. package/dist/data/rules/completePatternRule.js +9 -0
  16. package/dist/data/rules/connectAllRule.d.ts +1 -0
  17. package/dist/data/rules/connectAllRule.js +6 -0
  18. package/dist/data/rules/containsShapeRule.d.ts +1 -0
  19. package/dist/data/rules/containsShapeRule.js +11 -1
  20. package/dist/data/rules/customRule.d.ts +2 -0
  21. package/dist/data/rules/customRule.js +11 -0
  22. package/dist/data/rules/foresightRule.d.ts +2 -0
  23. package/dist/data/rules/foresightRule.js +13 -0
  24. package/dist/data/rules/lyingSymbolRule.d.ts +1 -0
  25. package/dist/data/rules/lyingSymbolRule.js +19 -0
  26. package/dist/data/rules/musicControlLine.d.ts +4 -0
  27. package/dist/data/rules/musicControlLine.js +29 -0
  28. package/dist/data/rules/musicGridRule.d.ts +2 -0
  29. package/dist/data/rules/musicGridRule.js +11 -0
  30. package/dist/data/rules/mysteryRule.d.ts +2 -0
  31. package/dist/data/rules/mysteryRule.js +11 -0
  32. package/dist/data/rules/offByXRule.d.ts +1 -0
  33. package/dist/data/rules/offByXRule.js +6 -0
  34. package/dist/data/rules/perfectionRule.d.ts +2 -0
  35. package/dist/data/rules/perfectionRule.js +9 -0
  36. package/dist/data/rules/regionAreaRule.d.ts +1 -0
  37. package/dist/data/rules/regionAreaRule.js +6 -0
  38. package/dist/data/rules/sameShapeRule.d.ts +1 -0
  39. package/dist/data/rules/sameShapeRule.js +6 -0
  40. package/dist/data/rules/symbolsPerRegionRule.d.ts +1 -0
  41. package/dist/data/rules/symbolsPerRegionRule.js +6 -0
  42. package/dist/data/rules/undercluedRule.d.ts +2 -0
  43. package/dist/data/rules/undercluedRule.js +9 -0
  44. package/dist/data/rules/uniqueShapeRule.d.ts +1 -0
  45. package/dist/data/rules/uniqueShapeRule.js +6 -0
  46. package/dist/data/rules/wrapAroundRule.d.ts +2 -0
  47. package/dist/data/rules/wrapAroundRule.js +9 -0
  48. package/dist/data/serializer/serializer_checksum.js +11 -1
  49. package/dist/data/serializer/serializer_v0.js +2 -0
  50. package/dist/data/shapes.js +11 -1
  51. package/dist/data/symbols/areaNumberSymbol.d.ts +1 -0
  52. package/dist/data/symbols/areaNumberSymbol.js +6 -0
  53. package/dist/data/symbols/customIconSymbol.d.ts +2 -0
  54. package/dist/data/symbols/customIconSymbol.js +13 -0
  55. package/dist/data/symbols/customTextSymbol.d.ts +2 -0
  56. package/dist/data/symbols/customTextSymbol.js +13 -0
  57. package/dist/data/symbols/dartSymbol.d.ts +1 -0
  58. package/dist/data/symbols/dartSymbol.js +6 -0
  59. package/dist/data/symbols/directionLinkerSymbol.d.ts +1 -5
  60. package/dist/data/symbols/directionLinkerSymbol.js +0 -3
  61. package/dist/data/symbols/focusSymbol.d.ts +1 -0
  62. package/dist/data/symbols/focusSymbol.js +6 -0
  63. package/dist/data/symbols/galaxySymbol.d.ts +1 -0
  64. package/dist/data/symbols/galaxySymbol.js +6 -0
  65. package/dist/data/symbols/hiddenSymbol.d.ts +2 -0
  66. package/dist/data/symbols/hiddenSymbol.js +10 -0
  67. package/dist/data/symbols/letterSymbol.d.ts +1 -0
  68. package/dist/data/symbols/letterSymbol.js +7 -0
  69. package/dist/data/symbols/lotusSymbol.d.ts +1 -0
  70. package/dist/data/symbols/lotusSymbol.js +6 -0
  71. package/dist/data/symbols/minesweeperSymbol.d.ts +1 -0
  72. package/dist/data/symbols/minesweeperSymbol.js +6 -0
  73. package/dist/data/symbols/myopiaSymbol.d.ts +1 -0
  74. package/dist/data/symbols/myopiaSymbol.js +5 -0
  75. package/dist/data/symbols/viewpointSymbol.d.ts +1 -0
  76. package/dist/data/symbols/viewpointSymbol.js +6 -0
  77. package/package.json +2 -2
@@ -344,6 +344,8 @@ declare global {
344
344
  get value(): T;
345
345
  }
346
346
  export declare abstract class Configurable {
347
+ abstract get title(): string;
348
+ abstract get configExplanation(): string;
347
349
  get configs(): readonly AnyConfig[] | null;
348
350
  abstract copyWith(props: Record<string, unknown>): this;
349
351
  /**
@@ -357,6 +359,7 @@ declare global {
357
359
  export declare abstract class Instruction extends Configurable {
358
360
  abstract get id(): string;
359
361
  abstract get explanation(): string;
362
+ get configExplanation(): string;
360
363
  abstract createExampleGrid(): GridData;
361
364
  /**
362
365
  * Indicates that validation by logic is not available and the solution must be used for validation
@@ -492,6 +495,9 @@ declare global {
492
495
  * Ranges from 0 to 1
493
496
  */
494
497
  readonly velocity: number | null;
498
+ readonly title = 'Music Grid - Row';
499
+ readonly configExplanation =
500
+ 'Configure the playback settings from this tile onwards.';
495
501
  private static readonly CONFIGS;
496
502
  constructor(
497
503
  /**
@@ -520,6 +526,9 @@ declare global {
520
526
  readonly pedal: boolean | null;
521
527
  readonly checkpoint: boolean;
522
528
  readonly rows: readonly Row[];
529
+ readonly title = 'Music Grid - Control Line';
530
+ readonly configExplanation =
531
+ 'Configure the playback settings from this point onwards.';
523
532
  private static readonly CONFIGS;
524
533
  /**
525
534
  * Configure playback settings, taking effect at the given column (inclusive)
@@ -565,6 +574,8 @@ declare global {
565
574
  readonly controlLines: readonly ControlLine[];
566
575
  readonly track: GridData | null;
567
576
  readonly normalizeVelocity: boolean;
577
+ readonly title = 'Music Grid';
578
+ get configExplanation(): string;
568
579
  private static readonly EXAMPLE_GRID;
569
580
  private static readonly CONFIGS;
570
581
  private static readonly SEARCH_VARIANTS;
@@ -621,6 +632,8 @@ declare global {
621
632
  ): ControlLine[];
622
633
  }
623
634
  export declare class CompletePatternRule extends Rule {
635
+ readonly title = 'Complete The Pattern';
636
+ get configExplanation(): string;
624
637
  private static readonly EXAMPLE_GRID;
625
638
  private static readonly SEARCH_VARIANTS;
626
639
  /**
@@ -639,6 +652,8 @@ declare global {
639
652
  get isSingleton(): boolean;
640
653
  }
641
654
  export declare class UndercluedRule extends Rule {
655
+ readonly title = 'Underclued';
656
+ get configExplanation(): string;
642
657
  private static readonly EXAMPLE_GRID;
643
658
  private static readonly SEARCH_VARIANTS;
644
659
  /**
@@ -665,6 +680,8 @@ declare global {
665
680
  export declare class WrapAroundRule extends Rule implements GetTileHandler {
666
681
  readonly horizontal: Wrapping;
667
682
  readonly vertical: Wrapping;
683
+ readonly title = 'Wrap Around';
684
+ get configExplanation(): string;
668
685
  private static readonly EXAMPLE_GRID_NONE;
669
686
  private static readonly EXAMPLE_GRID_HORIZONTAL;
670
687
  private static readonly EXAMPLE_GRID_VERTICAL;
@@ -1214,6 +1231,7 @@ declare global {
1214
1231
  Orientation = 'orientation',
1215
1232
  OrientationToggle = 'orientationToggle',
1216
1233
  Tile = 'tile',
1234
+ Shape = 'shape',
1217
1235
  Grid = 'grid',
1218
1236
  NullableGrid = 'nullableGrid',
1219
1237
  Icon = 'icon',
@@ -1225,6 +1243,7 @@ declare global {
1225
1243
  readonly type: ConfigType;
1226
1244
  readonly field: string;
1227
1245
  readonly description: string;
1246
+ readonly explanation?: string;
1228
1247
  readonly default: T;
1229
1248
  readonly configurable: boolean;
1230
1249
  }
@@ -1277,6 +1296,10 @@ declare global {
1277
1296
  readonly type: ConfigType.Tile;
1278
1297
  readonly resizable: boolean;
1279
1298
  }
1299
+ export interface ShapeConfig extends Config<GridData> {
1300
+ readonly type: ConfigType.Shape;
1301
+ readonly resizable: boolean;
1302
+ }
1280
1303
  export interface GridConfig extends Config<GridData> {
1281
1304
  readonly type: ConfigType.Grid;
1282
1305
  }
@@ -1310,6 +1333,7 @@ declare global {
1310
1333
  | OrientationConfig
1311
1334
  | OrientationToggleConfig
1312
1335
  | TileConfig
1336
+ | ShapeConfig
1313
1337
  | GridConfig
1314
1338
  | NullableGridConfig
1315
1339
  | IconConfig
@@ -1495,6 +1519,7 @@ declare global {
1495
1519
  tileMapper?: (tile: TileData) => TileData
1496
1520
  ): GridData;
1497
1521
  export declare class BanPatternRule extends Rule {
1522
+ readonly title = 'Ban Pattern';
1498
1523
  private static readonly EXAMPLE_GRID;
1499
1524
  private static readonly CONFIGS;
1500
1525
  private static readonly SEARCH_VARIANTS;
@@ -1517,6 +1542,8 @@ declare global {
1517
1542
  }
1518
1543
  export declare class CellCountPerZoneRule extends Rule {
1519
1544
  readonly color: Color;
1545
+ readonly title = 'Equal Count Per Zone';
1546
+ get configExplanation(): string;
1520
1547
  private static readonly CONFIGS;
1521
1548
  private static readonly EXAMPLE_GRID_LIGHT;
1522
1549
  private static readonly EXAMPLE_GRID_DARK;
@@ -1540,6 +1567,7 @@ declare global {
1540
1567
  export declare class CellCountRule extends Rule {
1541
1568
  readonly color: Color;
1542
1569
  readonly count: number;
1570
+ readonly title = 'Total Count';
1543
1571
  private static readonly CONFIGS;
1544
1572
  private static readonly EXAMPLE_GRID_LIGHT;
1545
1573
  private static readonly EXAMPLE_GRID_DARK;
@@ -1563,6 +1591,7 @@ declare global {
1563
1591
  }
1564
1592
  export declare class ConnectAllRule extends Rule {
1565
1593
  readonly color: Color;
1594
+ readonly title = 'Connect All';
1566
1595
  private static readonly CONFIGS;
1567
1596
  private static readonly EXAMPLE_GRID_LIGHT;
1568
1597
  private static readonly EXAMPLE_GRID_DARK;
@@ -1600,6 +1629,7 @@ declare global {
1600
1629
  withColor(color: Color): this;
1601
1630
  }
1602
1631
  export declare class ContainsShapeRule extends RegionShapeRule {
1632
+ readonly title = 'Areas Contain Pattern';
1603
1633
  private static readonly EXAMPLE_GRID_LIGHT;
1604
1634
  private static readonly EXAMPLE_GRID_DARK;
1605
1635
  private static readonly CONFIGS;
@@ -1625,6 +1655,8 @@ declare global {
1625
1655
  export declare class CustomRule extends Rule {
1626
1656
  readonly description: string;
1627
1657
  readonly grid: GridData;
1658
+ readonly title = 'Custom Rule';
1659
+ get configExplanation(): string;
1628
1660
  private static readonly EXAMPLE_GRID;
1629
1661
  static readonly configs: readonly AnyConfig[];
1630
1662
  private static readonly SEARCH_VARIANTS;
@@ -1657,6 +1689,8 @@ declare global {
1657
1689
  readonly regenInterval: number;
1658
1690
  readonly startFull: boolean;
1659
1691
  readonly solvePath: Position$1[];
1692
+ readonly title = 'Foresight';
1693
+ get configExplanation(): string;
1660
1694
  private static readonly EXAMPLE_GRID;
1661
1695
  private static readonly CONFIGS;
1662
1696
  private static readonly SEARCH_VARIANTS;
@@ -1697,6 +1731,7 @@ declare global {
1697
1731
  implements FinalValidationHandler
1698
1732
  {
1699
1733
  readonly count: number;
1734
+ readonly title = 'Lying Symbols';
1700
1735
  private static readonly EXAMPLE_GRID;
1701
1736
  private static readonly CONFIGS;
1702
1737
  private static readonly SEARCH_VARIANTS;
@@ -1727,6 +1762,8 @@ declare global {
1727
1762
  {
1728
1763
  readonly solution: GridData;
1729
1764
  readonly visible: boolean;
1765
+ readonly title = 'Alternate Solution';
1766
+ get configExplanation(): string;
1730
1767
  private static readonly EXAMPLE_GRID;
1731
1768
  private static readonly CONFIGS;
1732
1769
  private static readonly SEARCH_VARIANTS;
@@ -1770,6 +1807,7 @@ declare global {
1770
1807
  implements SymbolValidationHandler
1771
1808
  {
1772
1809
  readonly number: number;
1810
+ readonly title = 'Off By X';
1773
1811
  private static readonly CONFIGS;
1774
1812
  private static readonly EXAMPLE_GRID;
1775
1813
  private static readonly SEARCH_VARIANTS;
@@ -1799,6 +1837,8 @@ declare global {
1799
1837
  implements SetGridHandler, FinalValidationHandler
1800
1838
  {
1801
1839
  readonly editor: boolean;
1840
+ readonly title = 'Perfection';
1841
+ get configExplanation(): string;
1802
1842
  private static readonly EXAMPLE_GRID;
1803
1843
  private static readonly SEARCH_VARIANTS;
1804
1844
  /**
@@ -1842,6 +1882,7 @@ declare global {
1842
1882
  export declare class RegionAreaRule extends Rule {
1843
1883
  readonly color: Color;
1844
1884
  readonly size: number;
1885
+ readonly title = 'Region Area Size';
1845
1886
  private static readonly CONFIGS;
1846
1887
  private static readonly EXAMPLE_GRID_DARK;
1847
1888
  private static readonly EXAMPLE_GRID_LIGHT;
@@ -1865,6 +1906,7 @@ declare global {
1865
1906
  withSize(size: number): this;
1866
1907
  }
1867
1908
  export declare class SameShapeRule extends RegionShapeRule {
1909
+ readonly title = 'Same Shape Areas';
1868
1910
  private static readonly CONFIGS;
1869
1911
  private static readonly EXAMPLE_GRID_LIGHT;
1870
1912
  private static readonly EXAMPLE_GRID_DARK;
@@ -1887,6 +1929,7 @@ declare global {
1887
1929
  readonly color: Color;
1888
1930
  readonly count: number;
1889
1931
  readonly comparison: Comparison;
1932
+ readonly title = 'Symbols Per Area';
1890
1933
  private static readonly SYMBOL_POSITIONS;
1891
1934
  private static readonly CONFIGS;
1892
1935
  private static readonly EXAMPLE_GRIDS;
@@ -1920,6 +1963,7 @@ declare global {
1920
1963
  private static countAllSymbolsOfPosition;
1921
1964
  }
1922
1965
  export declare class UniqueShapeRule extends RegionShapeRule {
1966
+ readonly title = 'Unique Shape Areas';
1923
1967
  private static readonly CONFIGS;
1924
1968
  private static readonly EXAMPLE_GRID_LIGHT;
1925
1969
  private static readonly EXAMPLE_GRID_DARK;
@@ -2341,6 +2385,7 @@ declare global {
2341
2385
  withNumber(number: number): this;
2342
2386
  }
2343
2387
  export declare class AreaNumberSymbol extends NumberSymbol {
2388
+ readonly title = 'Area Number';
2344
2389
  private static readonly CONFIGS;
2345
2390
  private static readonly EXAMPLE_GRID;
2346
2391
  /**
@@ -2381,6 +2426,7 @@ declare global {
2381
2426
  }
2382
2427
  export declare class DartSymbol extends NumberSymbol {
2383
2428
  readonly orientation: Orientation;
2429
+ readonly title = 'Dart';
2384
2430
  private static readonly CONFIGS;
2385
2431
  private static readonly EXAMPLE_GRID;
2386
2432
  /**
@@ -2421,7 +2467,7 @@ declare global {
2421
2467
  private buildCheckAndRating;
2422
2468
  }
2423
2469
  export type DirectionLinkerMap = Record<Direction, Direction>;
2424
- export declare class DirectionLinkerSymbol extends Symbol$1 {
2470
+ export declare abstract class DirectionLinkerSymbol extends Symbol$1 {
2425
2471
  readonly x: number;
2426
2472
  readonly y: number;
2427
2473
  private static readonly CONFIGS;
@@ -2442,7 +2488,6 @@ declare global {
2442
2488
  createExampleGrid(): GridData;
2443
2489
  private deltaCoordinate;
2444
2490
  validateSymbol(grid: GridData): State;
2445
- copyWith({ x, y }: { x?: number; y?: number }): this;
2446
2491
  private getInitialCheckedCouples;
2447
2492
  }
2448
2493
  export declare abstract class DirectionLinkerBTModule extends BTModule {
@@ -2458,6 +2503,7 @@ declare global {
2458
2503
  ): Position$1 | null;
2459
2504
  }
2460
2505
  export declare class FocusSymbol extends NumberSymbol {
2506
+ readonly title = 'Focus Number';
2461
2507
  private static readonly CONFIGS;
2462
2508
  private static readonly EXAMPLE_GRID;
2463
2509
  /**
@@ -2497,6 +2543,7 @@ declare global {
2497
2543
  export declare class GalaxySymbol extends DirectionLinkerSymbol {
2498
2544
  readonly x: number;
2499
2545
  readonly y: number;
2546
+ readonly title = 'Galaxy';
2500
2547
  private static readonly linkedDirections;
2501
2548
  /**
2502
2549
  * **Galaxies are centers of rotational symmetry**
@@ -2525,6 +2572,7 @@ declare global {
2525
2572
  readonly x: number;
2526
2573
  readonly y: number;
2527
2574
  readonly letter: string;
2575
+ readonly title = 'Letter';
2528
2576
  private static readonly CONFIGS;
2529
2577
  private static readonly EXAMPLE_GRID;
2530
2578
  /**
@@ -2562,6 +2610,7 @@ declare global {
2562
2610
  readonly x: number;
2563
2611
  readonly y: number;
2564
2612
  readonly orientation: Orientation;
2613
+ readonly title = 'Lotus';
2565
2614
  private static readonly linkedDirectionsFromOrientation;
2566
2615
  /**
2567
2616
  * **Areas containing this symbol must be symmetrical**
@@ -2598,6 +2647,7 @@ declare global {
2598
2647
  checkGlobal(grid: BTGridData): false | CheckResult;
2599
2648
  }
2600
2649
  export declare class MinesweeperSymbol extends NumberSymbol {
2650
+ readonly title = 'Minesweeper Number';
2601
2651
  private static readonly CONFIGS;
2602
2652
  private static readonly EXAMPLE_GRID;
2603
2653
  /**
@@ -2646,6 +2696,7 @@ declare global {
2646
2696
  export declare class MyopiaSymbol extends MultiEntrySymbol {
2647
2697
  readonly diagonals: boolean;
2648
2698
  readonly directions: OrientationToggle;
2699
+ get title(): 'Framed Myopia Arrow' | 'Myopia Arrow';
2649
2700
  private static readonly CONFIGS;
2650
2701
  private static readonly EXAMPLE_GRID;
2651
2702
  private static readonly EXAMPLE_DIAGONAL_GRID;
@@ -2688,6 +2739,7 @@ declare global {
2688
2739
  checkGlobal(grid: BTGridData): CheckResult | false;
2689
2740
  }
2690
2741
  export declare class ViewpointSymbol extends NumberSymbol {
2742
+ readonly title = 'Viewpoint Number';
2691
2743
  private static readonly CONFIGS;
2692
2744
  private static readonly EXAMPLE_GRID;
2693
2745
  /**
@@ -2859,6 +2911,8 @@ declare global {
2859
2911
  export declare class CustomIconSymbol extends CustomSymbol {
2860
2912
  readonly icon: string;
2861
2913
  readonly rotation: number;
2914
+ readonly title = 'Custom Icon Symbol';
2915
+ get configExplanation(): string;
2862
2916
  private static readonly EXAMPLE_GRID;
2863
2917
  private static readonly CONFIGS;
2864
2918
  /**
@@ -2902,6 +2956,8 @@ declare global {
2902
2956
  export declare class CustomTextSymbol extends CustomSymbol {
2903
2957
  readonly text: string;
2904
2958
  readonly rotation: number;
2959
+ readonly title = 'Custom Text Symbol';
2960
+ get configExplanation(): string;
2905
2961
  private static readonly EXAMPLE_GRID;
2906
2962
  private static readonly CONFIGS;
2907
2963
  /**
@@ -2949,6 +3005,8 @@ declare global {
2949
3005
  readonly x: number;
2950
3006
  readonly y: number;
2951
3007
  readonly revealLocation: boolean;
3008
+ readonly title = 'Hidden Symbol Marker';
3009
+ get configExplanation(): string;
2952
3010
  private static readonly CONFIGS;
2953
3011
  private static readonly EXAMPLE_GRID;
2954
3012
  /**
@@ -15,6 +15,7 @@ export declare enum ConfigType {
15
15
  Orientation = "orientation",
16
16
  OrientationToggle = "orientationToggle",
17
17
  Tile = "tile",
18
+ Shape = "shape",
18
19
  Grid = "grid",
19
20
  NullableGrid = "nullableGrid",
20
21
  Icon = "icon",
@@ -26,6 +27,7 @@ export interface Config<T> {
26
27
  readonly type: ConfigType;
27
28
  readonly field: string;
28
29
  readonly description: string;
30
+ readonly explanation?: string;
29
31
  readonly default: T;
30
32
  readonly configurable: boolean;
31
33
  }
@@ -78,6 +80,10 @@ export interface TileConfig extends Config<GridData> {
78
80
  readonly type: ConfigType.Tile;
79
81
  readonly resizable: boolean;
80
82
  }
83
+ export interface ShapeConfig extends Config<GridData> {
84
+ readonly type: ConfigType.Shape;
85
+ readonly resizable: boolean;
86
+ }
81
87
  export interface GridConfig extends Config<GridData> {
82
88
  readonly type: ConfigType.Grid;
83
89
  }
@@ -97,7 +103,7 @@ export interface NullableNoteConfig extends Config<string | null> {
97
103
  export interface SolvePathConfig extends Config<Position[]> {
98
104
  readonly type: ConfigType.SolvePath;
99
105
  }
100
- export type AnyConfig = BooleanConfig | NullableBooleanConfig | NumberConfig | NullableNumberConfig | StringConfig | ColorConfig | ComparisonConfig | WrappingConfig | DirectionConfig | DirectionToggleConfig | OrientationConfig | OrientationToggleConfig | TileConfig | GridConfig | NullableGridConfig | IconConfig | ControlLinesConfig | NullableNoteConfig | SolvePathConfig;
106
+ export type AnyConfig = BooleanConfig | NullableBooleanConfig | NumberConfig | NullableNumberConfig | StringConfig | ColorConfig | ComparisonConfig | WrappingConfig | DirectionConfig | DirectionToggleConfig | OrientationConfig | OrientationToggleConfig | TileConfig | ShapeConfig | GridConfig | NullableGridConfig | IconConfig | ControlLinesConfig | NullableNoteConfig | SolvePathConfig;
101
107
  /**
102
108
  * Compare two config values for equality, using an appropriate method for the config type.
103
109
  *
@@ -1,4 +1,5 @@
1
1
  import { DIRECTIONS, ORIENTATIONS, } from './primitives.js';
2
+ import { normalizeShape, shapeEquals, tilesToShape } from './shapes.js';
2
3
  export var ConfigType;
3
4
  (function (ConfigType) {
4
5
  ConfigType["Boolean"] = "boolean";
@@ -14,6 +15,7 @@ export var ConfigType;
14
15
  ConfigType["Orientation"] = "orientation";
15
16
  ConfigType["OrientationToggle"] = "orientationToggle";
16
17
  ConfigType["Tile"] = "tile";
18
+ ConfigType["Shape"] = "shape";
17
19
  ConfigType["Grid"] = "grid";
18
20
  ConfigType["NullableGrid"] = "nullableGrid";
19
21
  ConfigType["Icon"] = "icon";
@@ -40,6 +42,11 @@ export function configEquals(type, a, b) {
40
42
  if (type === ConfigType.Tile || type === ConfigType.Grid) {
41
43
  return a.equals(b);
42
44
  }
45
+ if (type === ConfigType.Shape) {
46
+ const aShape = normalizeShape(tilesToShape(a.tiles));
47
+ const bShape = normalizeShape(tilesToShape(b.tiles));
48
+ return shapeEquals(aShape, bShape);
49
+ }
43
50
  if (type === ConfigType.NullableGrid) {
44
51
  if (a === null && b === null)
45
52
  return true;
@@ -1,5 +1,7 @@
1
1
  import { AnyConfig } from './config.js';
2
2
  export default abstract class Configurable {
3
+ abstract get title(): string;
4
+ abstract get configExplanation(): string;
3
5
  get configs(): readonly AnyConfig[] | null;
4
6
  abstract copyWith(props: Record<string, unknown>): this;
5
7
  /**
@@ -4,6 +4,7 @@ import { Mode } from './primitives.js';
4
4
  export default abstract class Instruction extends Configurable {
5
5
  abstract get id(): string;
6
6
  abstract get explanation(): string;
7
+ get configExplanation(): string;
7
8
  abstract createExampleGrid(): GridData;
8
9
  /**
9
10
  * Indicates that validation by logic is not available and the solution must be used for validation
@@ -1,5 +1,8 @@
1
1
  import Configurable from './configurable.js';
2
2
  export default class Instruction extends Configurable {
3
+ get configExplanation() {
4
+ return this.explanation;
5
+ }
3
6
  /**
4
7
  * Indicates that validation by logic is not available and the solution must be used for validation
5
8
  */
@@ -77,7 +77,9 @@ export function validatePuzzleChecklist(metadata, gridWithSolution, state) {
77
77
  });
78
78
  checklist.items.push({
79
79
  id: 'solutionIsNotEmpty',
80
- success: gridWithSolution.tiles.some(row => row.some(tile => !tile.fixed && tile.color !== Color.Gray)),
80
+ success: gridWithSolution.musicGrid.value
81
+ ? gridWithSolution.tiles.some(row => row.some(tile => !tile.fixed && tile.color === Color.Dark))
82
+ : gridWithSolution.tiles.some(row => row.some(tile => !tile.fixed && tile.color !== Color.Gray)),
81
83
  mandatory: true,
82
84
  });
83
85
  }
@@ -4,6 +4,7 @@ import { RuleState } from '../primitives.js';
4
4
  import { Shape } from '../shapes.js';
5
5
  import Rule, { SearchVariant } from './rule.js';
6
6
  export default class BanPatternRule extends Rule {
7
+ readonly title = "Ban Pattern";
7
8
  private static readonly EXAMPLE_GRID;
8
9
  private static readonly CONFIGS;
9
10
  private static readonly SEARCH_VARIANTS;
@@ -12,6 +12,12 @@ class BanPatternRule extends Rule {
12
12
  */
13
13
  constructor(pattern) {
14
14
  super();
15
+ Object.defineProperty(this, "title", {
16
+ enumerable: true,
17
+ configurable: true,
18
+ writable: true,
19
+ value: 'Ban Pattern'
20
+ });
15
21
  Object.defineProperty(this, "pattern", {
16
22
  enumerable: true,
17
23
  configurable: true,
@@ -51,6 +57,9 @@ class BanPatternRule extends Rule {
51
57
  });
52
58
  const width = maxX - minX + 1;
53
59
  const height = maxY - minY + 1;
60
+ if (!Number.isFinite(width) || !Number.isFinite(height)) {
61
+ return GridData.create(0, 0);
62
+ }
54
63
  const tiles = array(width, height, (x, y) => {
55
64
  const tile = this.pattern.getTile(x + minX, y + minY);
56
65
  if (!tile.exists || tile.color !== Color.Gray)
@@ -125,11 +134,12 @@ Object.defineProperty(BanPatternRule, "CONFIGS", {
125
134
  writable: true,
126
135
  value: Object.freeze([
127
136
  {
128
- type: ConfigType.Tile,
137
+ type: ConfigType.Shape,
129
138
  default: BanPatternRule.EXAMPLE_GRID,
130
139
  resizable: true,
131
140
  field: 'pattern',
132
141
  description: 'Pattern',
142
+ explanation: 'The pattern to be banned. Can be a mix of dark and light tiles.',
133
143
  configurable: true,
134
144
  },
135
145
  ])
@@ -4,6 +4,8 @@ import { Color, RuleState } from '../primitives.js';
4
4
  import Rule, { SearchVariant } from './rule.js';
5
5
  export default class CellCountPerZoneRule extends Rule {
6
6
  readonly color: Color;
7
+ readonly title = "Equal Count Per Zone";
8
+ get configExplanation(): string;
7
9
  private static readonly CONFIGS;
8
10
  private static readonly EXAMPLE_GRID_LIGHT;
9
11
  private static readonly EXAMPLE_GRID_DARK;
@@ -5,6 +5,9 @@ import GridZones from '../gridZones.js';
5
5
  import { Color, State } from '../primitives.js';
6
6
  import Rule from './rule.js';
7
7
  class CellCountPerZoneRule extends Rule {
8
+ get configExplanation() {
9
+ return 'Use the zone tool to define areas on the grid.';
10
+ }
8
11
  /**
9
12
  * **Zones of the same size have the same number of &lt;color&gt; cells.**
10
13
  *
@@ -18,6 +21,12 @@ class CellCountPerZoneRule extends Rule {
18
21
  writable: true,
19
22
  value: color
20
23
  });
24
+ Object.defineProperty(this, "title", {
25
+ enumerable: true,
26
+ configurable: true,
27
+ writable: true,
28
+ value: 'Equal Count Per Zone'
29
+ });
21
30
  this.color = color;
22
31
  }
23
32
  get id() {
@@ -5,6 +5,7 @@ import Rule, { SearchVariant } from './rule.js';
5
5
  export default class CellCountRule extends Rule {
6
6
  readonly color: Color;
7
7
  readonly count: number;
8
+ readonly title = "Total Count";
8
9
  private static readonly CONFIGS;
9
10
  private static readonly EXAMPLE_GRID_LIGHT;
10
11
  private static readonly EXAMPLE_GRID_DARK;
@@ -24,6 +24,12 @@ class CellCountRule extends Rule {
24
24
  writable: true,
25
25
  value: count
26
26
  });
27
+ Object.defineProperty(this, "title", {
28
+ enumerable: true,
29
+ configurable: true,
30
+ writable: true,
31
+ value: 'Total Count'
32
+ });
27
33
  this.color = color;
28
34
  this.count = count;
29
35
  }
@@ -2,6 +2,8 @@ import GridData from '../grid.js';
2
2
  import { RuleState } from '../primitives.js';
3
3
  import Rule, { SearchVariant } from './rule.js';
4
4
  export default class CompletePatternRule extends Rule {
5
+ readonly title = "Complete The Pattern";
6
+ get configExplanation(): string;
5
7
  private static readonly EXAMPLE_GRID;
6
8
  private static readonly SEARCH_VARIANTS;
7
9
  /**
@@ -2,6 +2,9 @@ import GridData from '../grid.js';
2
2
  import { MajorRule, State } from '../primitives.js';
3
3
  import Rule from './rule.js';
4
4
  class CompletePatternRule extends Rule {
5
+ get configExplanation() {
6
+ return 'Complete the grid by pattern recognition. Your provided solution may override auto-validation.';
7
+ }
5
8
  /**
6
9
  * **Complete the pattern**
7
10
  *
@@ -9,6 +12,12 @@ class CompletePatternRule extends Rule {
9
12
  */
10
13
  constructor() {
11
14
  super();
15
+ Object.defineProperty(this, "title", {
16
+ enumerable: true,
17
+ configurable: true,
18
+ writable: true,
19
+ value: 'Complete The Pattern'
20
+ });
12
21
  }
13
22
  get id() {
14
23
  return MajorRule.CompletePattern;
@@ -4,6 +4,7 @@ import { Color, RuleState } from '../primitives.js';
4
4
  import Rule, { SearchVariant } from './rule.js';
5
5
  export default class ConnectAllRule extends Rule {
6
6
  readonly color: Color;
7
+ readonly title = "Connect All";
7
8
  private static readonly CONFIGS;
8
9
  private static readonly EXAMPLE_GRID_LIGHT;
9
10
  private static readonly EXAMPLE_GRID_DARK;
@@ -17,6 +17,12 @@ class ConnectAllRule extends Rule {
17
17
  writable: true,
18
18
  value: color
19
19
  });
20
+ Object.defineProperty(this, "title", {
21
+ enumerable: true,
22
+ configurable: true,
23
+ writable: true,
24
+ value: 'Connect All'
25
+ });
20
26
  this.color = color;
21
27
  }
22
28
  get id() {
@@ -5,6 +5,7 @@ import { Shape } from '../shapes.js';
5
5
  import RegionShapeRule from './regionShapeRule.js';
6
6
  import { SearchVariant } from './rule.js';
7
7
  export default class ContainsShapeRule extends RegionShapeRule {
8
+ readonly title = "Areas Contain Pattern";
8
9
  private static readonly EXAMPLE_GRID_LIGHT;
9
10
  private static readonly EXAMPLE_GRID_DARK;
10
11
  private static readonly CONFIGS;
@@ -13,6 +13,12 @@ class ContainsShapeRule extends RegionShapeRule {
13
13
  */
14
14
  constructor(color, pattern) {
15
15
  super(color);
16
+ Object.defineProperty(this, "title", {
17
+ enumerable: true,
18
+ configurable: true,
19
+ writable: true,
20
+ value: 'Areas Contain Pattern'
21
+ });
16
22
  Object.defineProperty(this, "pattern", {
17
23
  enumerable: true,
18
24
  configurable: true,
@@ -52,6 +58,9 @@ class ContainsShapeRule extends RegionShapeRule {
52
58
  });
53
59
  const width = maxX - minX + 1;
54
60
  const height = maxY - minY + 1;
61
+ if (!Number.isFinite(width) || !Number.isFinite(height)) {
62
+ return GridData.create(0, 0);
63
+ }
55
64
  const tiles = array(width, height, (x, y) => {
56
65
  const tile = this.pattern.getTile(x + minX, y + minY);
57
66
  if (!tile.exists || tile.color !== Color.Gray)
@@ -129,11 +138,12 @@ Object.defineProperty(ContainsShapeRule, "CONFIGS", {
129
138
  configurable: true,
130
139
  },
131
140
  {
132
- type: ConfigType.Tile,
141
+ type: ConfigType.Shape,
133
142
  default: ContainsShapeRule.EXAMPLE_GRID_LIGHT,
134
143
  resizable: true,
135
144
  field: 'pattern',
136
145
  description: 'Pattern',
146
+ explanation: 'The pattern to be contained. Must only include tiles of the selected color.',
137
147
  configurable: true,
138
148
  },
139
149
  ])
@@ -5,6 +5,8 @@ import Rule, { SearchVariant } from './rule.js';
5
5
  export default class CustomRule extends Rule {
6
6
  readonly description: string;
7
7
  readonly grid: GridData;
8
+ readonly title = "Custom Rule";
9
+ get configExplanation(): string;
8
10
  private static readonly EXAMPLE_GRID;
9
11
  static readonly configs: readonly AnyConfig[];
10
12
  private static readonly SEARCH_VARIANTS;