@logic-pad/core 0.26.2 → 0.26.3
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 +3264 -3264
- package/dist/benchmark/helper.d.ts +21 -0
- package/dist/benchmark/helper.js +34 -0
- package/dist/benchmark/prepareBench.d.ts +1 -0
- package/dist/benchmark/prepareBench.js +140 -0
- package/dist/benchmark/runBench.d.ts +1 -0
- package/dist/benchmark/runBench.js +206 -0
- package/dist/src/data/config.d.ts +119 -0
- package/dist/src/data/config.js +72 -0
- package/dist/src/data/configurable.d.ts +14 -0
- package/dist/src/data/configurable.js +26 -0
- package/dist/src/data/dataHelper.d.ts +92 -0
- package/dist/src/data/dataHelper.js +217 -0
- package/dist/src/data/events/eventHelper.d.ts +1 -0
- package/dist/src/data/events/eventHelper.js +6 -0
- package/dist/src/data/events/onFinalValidation.d.ts +14 -0
- package/dist/src/data/events/onFinalValidation.js +4 -0
- package/dist/src/data/events/onGetTile.d.ts +7 -0
- package/dist/src/data/events/onGetTile.js +4 -0
- package/dist/src/data/events/onGridChange.d.ts +6 -0
- package/dist/src/data/events/onGridChange.js +4 -0
- package/dist/src/data/events/onGridResize.d.ts +9 -0
- package/dist/src/data/events/onGridResize.js +4 -0
- package/dist/src/data/events/onSetGrid.d.ts +7 -0
- package/dist/src/data/events/onSetGrid.js +19 -0
- package/dist/src/data/events/onSymbolDisplay.d.ts +16 -0
- package/dist/src/data/events/onSymbolDisplay.js +4 -0
- package/dist/src/data/events/onSymbolMerge.d.ts +10 -0
- package/dist/src/data/events/onSymbolMerge.js +4 -0
- package/dist/src/data/events/onSymbolValidation.d.ts +18 -0
- package/dist/src/data/events/onSymbolValidation.js +4 -0
- package/dist/src/data/grid.d.ts +410 -0
- package/dist/src/data/grid.js +1106 -0
- package/dist/src/data/gridConnections.d.ts +25 -0
- package/dist/src/data/gridConnections.js +309 -0
- package/dist/src/data/gridZones.d.ts +26 -0
- package/dist/src/data/gridZones.js +117 -0
- package/dist/src/data/instruction.d.ts +26 -0
- package/dist/src/data/instruction.js +29 -0
- package/dist/src/data/primitives.d.ts +138 -0
- package/dist/src/data/primitives.js +177 -0
- package/dist/src/data/puzzle.d.ts +73 -0
- package/dist/src/data/puzzle.js +105 -0
- package/dist/src/data/rules/banPatternRule.d.ts +30 -0
- package/dist/src/data/rules/banPatternRule.js +125 -0
- package/dist/src/data/rules/cellCountPerZoneRule.d.ts +23 -0
- package/dist/src/data/rules/cellCountPerZoneRule.js +39 -0
- package/dist/src/data/rules/cellCountRule.d.ts +33 -0
- package/dist/src/data/rules/cellCountRule.js +138 -0
- package/dist/src/data/rules/completePatternRule.d.ts +24 -0
- package/dist/src/data/rules/completePatternRule.js +46 -0
- package/dist/src/data/rules/connectAllRule.d.ts +29 -0
- package/dist/src/data/rules/connectAllRule.js +88 -0
- package/dist/src/data/rules/connectZonesRule.d.ts +29 -0
- package/dist/src/data/rules/connectZonesRule.js +111 -0
- package/dist/src/data/rules/containsShapeRule.d.ts +34 -0
- package/dist/src/data/rules/containsShapeRule.js +125 -0
- package/dist/src/data/rules/customRule.d.ts +34 -0
- package/dist/src/data/rules/customRule.js +74 -0
- package/dist/src/data/rules/differentCountPerZoneRule.d.ts +30 -0
- package/dist/src/data/rules/differentCountPerZoneRule.js +96 -0
- package/dist/src/data/rules/exactCountPerZoneRule.d.ts +33 -0
- package/dist/src/data/rules/exactCountPerZoneRule.js +99 -0
- package/dist/src/data/rules/foresightRule.d.ts +36 -0
- package/dist/src/data/rules/foresightRule.js +107 -0
- package/dist/src/data/rules/index.d.ts +3 -0
- package/dist/src/data/rules/index.js +10 -0
- package/dist/src/data/rules/lyingSymbolRule.d.ts +31 -0
- package/dist/src/data/rules/lyingSymbolRule.js +207 -0
- package/dist/src/data/rules/musicControlLine.d.ts +82 -0
- package/dist/src/data/rules/musicControlLine.js +167 -0
- package/dist/src/data/rules/musicGridRule.d.ts +51 -0
- package/dist/src/data/rules/musicGridRule.js +212 -0
- package/dist/src/data/rules/mysteryRule.d.ts +39 -0
- package/dist/src/data/rules/mysteryRule.js +146 -0
- package/dist/src/data/rules/noLoopsRule.d.ts +29 -0
- package/dist/src/data/rules/noLoopsRule.js +218 -0
- package/dist/src/data/rules/offByXRule.d.ts +32 -0
- package/dist/src/data/rules/offByXRule.js +124 -0
- package/dist/src/data/rules/perfectionRule.d.ts +45 -0
- package/dist/src/data/rules/perfectionRule.js +158 -0
- package/dist/src/data/rules/regionAreaRule.d.ts +34 -0
- package/dist/src/data/rules/regionAreaRule.js +149 -0
- package/dist/src/data/rules/regionShapeRule.d.ts +22 -0
- package/dist/src/data/rules/regionShapeRule.js +58 -0
- package/dist/src/data/rules/rule.d.ts +18 -0
- package/dist/src/data/rules/rule.js +19 -0
- package/dist/src/data/rules/rules.gen.d.ts +23 -0
- package/dist/src/data/rules/rules.gen.js +27 -0
- package/dist/src/data/rules/sameCountPerZoneRule.d.ts +30 -0
- package/dist/src/data/rules/sameCountPerZoneRule.js +95 -0
- package/dist/src/data/rules/sameShapeRule.d.ts +28 -0
- package/dist/src/data/rules/sameShapeRule.js +68 -0
- package/dist/src/data/rules/symbolsPerRegionRule.d.ts +38 -0
- package/dist/src/data/rules/symbolsPerRegionRule.js +181 -0
- package/dist/src/data/rules/undercluedRule.d.ts +24 -0
- package/dist/src/data/rules/undercluedRule.js +53 -0
- package/dist/src/data/rules/uniqueShapeRule.d.ts +28 -0
- package/dist/src/data/rules/uniqueShapeRule.js +65 -0
- package/dist/src/data/rules/wrapAroundRule.d.ts +36 -0
- package/dist/src/data/rules/wrapAroundRule.js +241 -0
- package/dist/src/data/serializer/allSerializers.d.ts +35 -0
- package/dist/src/data/serializer/allSerializers.js +78 -0
- package/dist/src/data/serializer/compressor/allCompressors.d.ts +14 -0
- package/dist/src/data/serializer/compressor/allCompressors.js +43 -0
- package/dist/src/data/serializer/compressor/checksumCompressor.d.ts +6 -0
- package/dist/src/data/serializer/compressor/checksumCompressor.js +21 -0
- package/dist/src/data/serializer/compressor/compressorBase.d.ts +16 -0
- package/dist/src/data/serializer/compressor/compressorBase.js +2 -0
- package/dist/src/data/serializer/compressor/deflateCompressor.d.ts +7 -0
- package/dist/src/data/serializer/compressor/deflateCompressor.js +17 -0
- package/dist/src/data/serializer/compressor/gzipCompressor.d.ts +5 -0
- package/dist/src/data/serializer/compressor/gzipCompressor.js +9 -0
- package/dist/src/data/serializer/compressor/streamCompressor.d.ts +6 -0
- package/dist/src/data/serializer/compressor/streamCompressor.js +41 -0
- package/dist/src/data/serializer/serializerBase.d.ts +32 -0
- package/dist/src/data/serializer/serializerBase.js +2 -0
- package/dist/src/data/serializer/serializer_checksum.d.ts +35 -0
- package/dist/src/data/serializer/serializer_checksum.js +179 -0
- package/dist/src/data/serializer/serializer_v0.d.ts +55 -0
- package/dist/src/data/serializer/serializer_v0.js +484 -0
- package/dist/src/data/shapes.d.ts +19 -0
- package/dist/src/data/shapes.js +137 -0
- package/dist/src/data/solver/allSolvers.d.ts +3 -0
- package/dist/src/data/solver/allSolvers.js +13 -0
- package/dist/src/data/solver/auto/autoSolver.d.ts +18 -0
- package/dist/src/data/solver/auto/autoSolver.js +156 -0
- package/dist/src/data/solver/backtrack/backtrackSolver.d.ts +11 -0
- package/dist/src/data/solver/backtrack/backtrackSolver.js +54 -0
- package/dist/src/data/solver/backtrack/backtrackWorker.d.ts +1 -0
- package/dist/src/data/solver/backtrack/backtrackWorker.js +312 -0
- package/dist/src/data/solver/backtrack/data.d.ts +47 -0
- package/dist/src/data/solver/backtrack/data.js +151 -0
- package/dist/src/data/solver/backtrack/rules/banPattern.d.ts +9 -0
- package/dist/src/data/solver/backtrack/rules/banPattern.js +77 -0
- package/dist/src/data/solver/backtrack/rules/cellCount.d.ts +7 -0
- package/dist/src/data/solver/backtrack/rules/cellCount.js +25 -0
- package/dist/src/data/solver/backtrack/rules/connectAll.d.ts +7 -0
- package/dist/src/data/solver/backtrack/rules/connectAll.js +44 -0
- package/dist/src/data/solver/backtrack/rules/regionArea.d.ts +8 -0
- package/dist/src/data/solver/backtrack/rules/regionArea.js +71 -0
- package/dist/src/data/solver/backtrack/rules/regionShape.d.ts +8 -0
- package/dist/src/data/solver/backtrack/rules/regionShape.js +57 -0
- package/dist/src/data/solver/backtrack/rules/sameShape.d.ts +8 -0
- package/dist/src/data/solver/backtrack/rules/sameShape.js +14 -0
- package/dist/src/data/solver/backtrack/rules/symbolsPerRegion.d.ts +10 -0
- package/dist/src/data/solver/backtrack/rules/symbolsPerRegion.js +82 -0
- package/dist/src/data/solver/backtrack/rules/uniqueShape.d.ts +8 -0
- package/dist/src/data/solver/backtrack/rules/uniqueShape.js +14 -0
- package/dist/src/data/solver/backtrack/symbols/areaNumber.d.ts +9 -0
- package/dist/src/data/solver/backtrack/symbols/areaNumber.js +75 -0
- package/dist/src/data/solver/backtrack/symbols/dart.d.ts +8 -0
- package/dist/src/data/solver/backtrack/symbols/dart.js +45 -0
- package/dist/src/data/solver/backtrack/symbols/directionLinker.d.ts +11 -0
- package/dist/src/data/solver/backtrack/symbols/directionLinker.js +121 -0
- package/dist/src/data/solver/backtrack/symbols/focus.d.ts +9 -0
- package/dist/src/data/solver/backtrack/symbols/focus.js +48 -0
- package/dist/src/data/solver/backtrack/symbols/galaxy.d.ts +9 -0
- package/dist/src/data/solver/backtrack/symbols/galaxy.js +14 -0
- package/dist/src/data/solver/backtrack/symbols/letter.d.ts +9 -0
- package/dist/src/data/solver/backtrack/symbols/letter.js +95 -0
- package/dist/src/data/solver/backtrack/symbols/lotus.d.ts +11 -0
- package/dist/src/data/solver/backtrack/symbols/lotus.js +55 -0
- package/dist/src/data/solver/backtrack/symbols/minesweeper.d.ts +9 -0
- package/dist/src/data/solver/backtrack/symbols/minesweeper.js +44 -0
- package/dist/src/data/solver/backtrack/symbols/myopia.d.ts +7 -0
- package/dist/src/data/solver/backtrack/symbols/myopia.js +73 -0
- package/dist/src/data/solver/backtrack/symbols/viewpoint.d.ts +7 -0
- package/dist/src/data/solver/backtrack/symbols/viewpoint.js +51 -0
- package/dist/src/data/solver/cspuz/cspuzSolver.d.ts +13 -0
- package/dist/src/data/solver/cspuz/cspuzSolver.js +124 -0
- package/dist/src/data/solver/cspuz/cspuzWorker.d.ts +1 -0
- package/dist/src/data/solver/cspuz/cspuzWorker.js +82 -0
- package/dist/src/data/solver/cspuz/jsonify.d.ts +3 -0
- package/dist/src/data/solver/cspuz/jsonify.js +215 -0
- package/dist/src/data/solver/eventIteratingSolver.d.ts +8 -0
- package/dist/src/data/solver/eventIteratingSolver.js +54 -0
- package/dist/src/data/solver/solver.d.ts +77 -0
- package/dist/src/data/solver/solver.js +59 -0
- package/dist/src/data/solver/universal/universalSolver.d.ts +7 -0
- package/dist/src/data/solver/universal/universalSolver.js +13 -0
- package/dist/src/data/solver/universal/universalWorker.d.ts +1 -0
- package/dist/src/data/solver/universal/universalWorker.js +128 -0
- package/dist/src/data/symbols/areaNumberSymbol.d.ts +31 -0
- package/dist/src/data/symbols/areaNumberSymbol.js +80 -0
- package/dist/src/data/symbols/customIconSymbol.d.ts +35 -0
- package/dist/src/data/symbols/customIconSymbol.js +94 -0
- package/dist/src/data/symbols/customSymbol.d.ts +25 -0
- package/dist/src/data/symbols/customSymbol.js +45 -0
- package/dist/src/data/symbols/customTextSymbol.d.ts +35 -0
- package/dist/src/data/symbols/customTextSymbol.js +95 -0
- package/dist/src/data/symbols/dartSymbol.d.ts +36 -0
- package/dist/src/data/symbols/dartSymbol.js +96 -0
- package/dist/src/data/symbols/directionLinkerSymbol.d.ts +29 -0
- package/dist/src/data/symbols/directionLinkerSymbol.js +232 -0
- package/dist/src/data/symbols/everyLetterSymbol.d.ts +32 -0
- package/dist/src/data/symbols/everyLetterSymbol.js +119 -0
- package/dist/src/data/symbols/focusSymbol.d.ts +40 -0
- package/dist/src/data/symbols/focusSymbol.js +159 -0
- package/dist/src/data/symbols/galaxySymbol.d.ts +27 -0
- package/dist/src/data/symbols/galaxySymbol.js +61 -0
- package/dist/src/data/symbols/hiddenSymbol.d.ts +38 -0
- package/dist/src/data/symbols/hiddenSymbol.js +113 -0
- package/dist/src/data/symbols/houseSymbol.d.ts +33 -0
- package/dist/src/data/symbols/houseSymbol.js +104 -0
- package/dist/src/data/symbols/index.d.ts +3 -0
- package/dist/src/data/symbols/index.js +10 -0
- package/dist/src/data/symbols/letterSymbol.d.ts +32 -0
- package/dist/src/data/symbols/letterSymbol.js +118 -0
- package/dist/src/data/symbols/lotusSymbol.d.ts +30 -0
- package/dist/src/data/symbols/lotusSymbol.js +132 -0
- package/dist/src/data/symbols/minesweeperSymbol.d.ts +33 -0
- package/dist/src/data/symbols/minesweeperSymbol.js +106 -0
- package/dist/src/data/symbols/myopiaSymbol.d.ts +37 -0
- package/dist/src/data/symbols/myopiaSymbol.js +182 -0
- package/dist/src/data/symbols/numberSymbol.d.ts +19 -0
- package/dist/src/data/symbols/numberSymbol.js +32 -0
- package/dist/src/data/symbols/symbol.d.ts +29 -0
- package/dist/src/data/symbols/symbol.js +87 -0
- package/dist/src/data/symbols/symbols.gen.d.ts +15 -0
- package/dist/src/data/symbols/symbols.gen.js +19 -0
- package/dist/src/data/symbols/unsupportedSymbol.d.ts +23 -0
- package/dist/src/data/symbols/unsupportedSymbol.js +47 -0
- package/dist/src/data/symbols/viewpointSymbol.d.ts +32 -0
- package/dist/src/data/symbols/viewpointSymbol.js +95 -0
- package/dist/src/data/tile.d.ts +26 -0
- package/dist/src/data/tile.js +56 -0
- package/dist/src/data/tileConnections.d.ts +25 -0
- package/dist/src/data/tileConnections.js +74 -0
- package/dist/src/data/validate.d.ts +5 -0
- package/dist/src/data/validate.js +131 -0
- package/dist/src/data/validateAsync.d.ts +15 -0
- package/dist/src/data/validateAsync.js +71 -0
- package/dist/src/data/validateAsyncWorker.d.ts +1 -0
- package/dist/src/data/validateAsyncWorker.js +9 -0
- package/dist/src/index.d.ts +109 -0
- package/dist/src/index.js +112 -0
- package/dist/src/polyfill/streamPolyfill.d.ts +2 -0
- package/dist/src/polyfill/streamPolyfill.js +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { AnyConfig } from '../config.js';
|
|
2
|
+
import GridData from '../grid.js';
|
|
3
|
+
import { Orientation } from '../primitives.js';
|
|
4
|
+
import NumberSymbol from './numberSymbol.js';
|
|
5
|
+
export default class DartSymbol extends NumberSymbol {
|
|
6
|
+
readonly orientation: Orientation;
|
|
7
|
+
readonly title = "Dart";
|
|
8
|
+
private static readonly CONFIGS;
|
|
9
|
+
private static readonly EXAMPLE_GRID;
|
|
10
|
+
/**
|
|
11
|
+
* **Darts count opposite color cells in that direction**
|
|
12
|
+
*
|
|
13
|
+
* @param x - The x-coordinate of the symbol.
|
|
14
|
+
* @param y - The y-coordinate of the symbol.
|
|
15
|
+
* @param number - The number of cells seen by the symbol.
|
|
16
|
+
* @param orientation - The orientation of the symbol.
|
|
17
|
+
*/
|
|
18
|
+
constructor(x: number, y: number, number: number, orientation: Orientation);
|
|
19
|
+
get id(): string;
|
|
20
|
+
get placementStep(): number;
|
|
21
|
+
get explanation(): string;
|
|
22
|
+
get configs(): readonly AnyConfig[] | null;
|
|
23
|
+
createExampleGrid(): GridData;
|
|
24
|
+
countTiles(grid: GridData): {
|
|
25
|
+
completed: number;
|
|
26
|
+
possible: number;
|
|
27
|
+
};
|
|
28
|
+
copyWith({ x, y, number, orientation, }: {
|
|
29
|
+
x?: number;
|
|
30
|
+
y?: number;
|
|
31
|
+
number?: number;
|
|
32
|
+
orientation?: Orientation;
|
|
33
|
+
}): this;
|
|
34
|
+
withNumber(number: number): this;
|
|
35
|
+
}
|
|
36
|
+
export declare const instance: DartSymbol;
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { ConfigType } from '../config.js';
|
|
2
|
+
import GridData from '../grid.js';
|
|
3
|
+
import { Color, Orientation } from '../primitives.js';
|
|
4
|
+
import NumberSymbol from './numberSymbol.js';
|
|
5
|
+
export default class DartSymbol extends NumberSymbol {
|
|
6
|
+
orientation;
|
|
7
|
+
title = 'Dart';
|
|
8
|
+
static CONFIGS = Object.freeze([
|
|
9
|
+
{
|
|
10
|
+
type: ConfigType.Number,
|
|
11
|
+
default: 0,
|
|
12
|
+
field: 'x',
|
|
13
|
+
description: 'X',
|
|
14
|
+
configurable: false,
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
type: ConfigType.Number,
|
|
18
|
+
default: 0,
|
|
19
|
+
field: 'y',
|
|
20
|
+
description: 'Y',
|
|
21
|
+
configurable: false,
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
type: ConfigType.Number,
|
|
25
|
+
default: 1,
|
|
26
|
+
field: 'number',
|
|
27
|
+
description: 'Number',
|
|
28
|
+
configurable: true,
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
type: ConfigType.Orientation,
|
|
32
|
+
default: Orientation.Right,
|
|
33
|
+
field: 'orientation',
|
|
34
|
+
description: 'Orientation',
|
|
35
|
+
configurable: true,
|
|
36
|
+
},
|
|
37
|
+
]);
|
|
38
|
+
static EXAMPLE_GRID = Object.freeze(GridData.create(['wwbbw', 'wwwww', 'wbwbb', 'wwwww'])
|
|
39
|
+
.addSymbol(new DartSymbol(1, 0, 1, Orientation.Down))
|
|
40
|
+
.addSymbol(new DartSymbol(4, 0, 2, Orientation.Left))
|
|
41
|
+
.addSymbol(new DartSymbol(3, 1, 1, Orientation.Down))
|
|
42
|
+
.addSymbol(new DartSymbol(0, 2, 3, Orientation.Right)));
|
|
43
|
+
/**
|
|
44
|
+
* **Darts count opposite color cells in that direction**
|
|
45
|
+
*
|
|
46
|
+
* @param x - The x-coordinate of the symbol.
|
|
47
|
+
* @param y - The y-coordinate of the symbol.
|
|
48
|
+
* @param number - The number of cells seen by the symbol.
|
|
49
|
+
* @param orientation - The orientation of the symbol.
|
|
50
|
+
*/
|
|
51
|
+
constructor(x, y, number, orientation) {
|
|
52
|
+
super(x, y, number);
|
|
53
|
+
this.orientation = orientation;
|
|
54
|
+
this.orientation = orientation;
|
|
55
|
+
}
|
|
56
|
+
get id() {
|
|
57
|
+
return `dart`;
|
|
58
|
+
}
|
|
59
|
+
get placementStep() {
|
|
60
|
+
return 1;
|
|
61
|
+
}
|
|
62
|
+
get explanation() {
|
|
63
|
+
return `*Darts* count opposite color cells in that direction`;
|
|
64
|
+
}
|
|
65
|
+
get configs() {
|
|
66
|
+
return DartSymbol.CONFIGS;
|
|
67
|
+
}
|
|
68
|
+
createExampleGrid() {
|
|
69
|
+
return DartSymbol.EXAMPLE_GRID;
|
|
70
|
+
}
|
|
71
|
+
countTiles(grid) {
|
|
72
|
+
if (Math.floor(this.x) !== this.x || Math.floor(this.y) !== this.y)
|
|
73
|
+
return { completed: 0, possible: Number.MAX_SAFE_INTEGER };
|
|
74
|
+
const color = grid.getTile(this.x, this.y).color;
|
|
75
|
+
if (color === Color.Gray)
|
|
76
|
+
return { completed: 0, possible: Number.MAX_SAFE_INTEGER };
|
|
77
|
+
let gray = 0;
|
|
78
|
+
let opposite = 0;
|
|
79
|
+
grid.iterateDirectionAll({ x: this.x, y: this.y }, this.orientation, () => true, tile => {
|
|
80
|
+
if (!tile.exists)
|
|
81
|
+
return;
|
|
82
|
+
if (tile.color === Color.Gray)
|
|
83
|
+
gray++;
|
|
84
|
+
else if (tile.color !== color)
|
|
85
|
+
opposite++;
|
|
86
|
+
});
|
|
87
|
+
return { completed: opposite, possible: opposite + gray };
|
|
88
|
+
}
|
|
89
|
+
copyWith({ x, y, number, orientation, }) {
|
|
90
|
+
return new DartSymbol(x ?? this.x, y ?? this.y, number ?? this.number, orientation ?? this.orientation);
|
|
91
|
+
}
|
|
92
|
+
withNumber(number) {
|
|
93
|
+
return this.copyWith({ number });
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
export const instance = new DartSymbol(0, 0, 1, Orientation.Right);
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { AnyConfig } from '../config.js';
|
|
2
|
+
import GridData from '../grid.js';
|
|
3
|
+
import { Direction, State } from '../primitives.js';
|
|
4
|
+
import Symbol from './symbol.js';
|
|
5
|
+
export type DirectionLinkerMap = Record<Direction, Direction>;
|
|
6
|
+
export default abstract class DirectionLinkerSymbol extends Symbol {
|
|
7
|
+
readonly x: number;
|
|
8
|
+
readonly y: number;
|
|
9
|
+
private static readonly CONFIGS;
|
|
10
|
+
private static readonly EXAMPLE_GRID;
|
|
11
|
+
private static readonly directionDeltas;
|
|
12
|
+
private linkedDirections;
|
|
13
|
+
/**
|
|
14
|
+
* **Darts count opposite color cells in that direction**
|
|
15
|
+
*
|
|
16
|
+
* @param x - The x-coordinate of the symbol.
|
|
17
|
+
* @param y - The y-coordinate of the symbol.
|
|
18
|
+
*/
|
|
19
|
+
constructor(x: number, y: number);
|
|
20
|
+
changeDirections(linkedDirections: DirectionLinkerMap): this;
|
|
21
|
+
get id(): string;
|
|
22
|
+
get explanation(): string;
|
|
23
|
+
get configs(): readonly AnyConfig[] | null;
|
|
24
|
+
createExampleGrid(): GridData;
|
|
25
|
+
private deltaCoordinate;
|
|
26
|
+
validateSymbol(grid: GridData): State;
|
|
27
|
+
private getInitialCheckedCouples;
|
|
28
|
+
}
|
|
29
|
+
export declare const instance: undefined;
|
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
import { ConfigType } from '../config.js';
|
|
2
|
+
import GridData from '../grid.js';
|
|
3
|
+
import { Color, Direction, State } from '../primitives.js';
|
|
4
|
+
import Symbol from './symbol.js';
|
|
5
|
+
function getColor(c, grid) {
|
|
6
|
+
if (!grid.isPositionValid(c.x, c.y) || !grid.getTile(c.x, c.y).exists) {
|
|
7
|
+
return null;
|
|
8
|
+
}
|
|
9
|
+
return grid.getTile(c.x, c.y).color;
|
|
10
|
+
}
|
|
11
|
+
function makeTurtle(pos1, pos2, grid) {
|
|
12
|
+
return {
|
|
13
|
+
pos1,
|
|
14
|
+
color1: getColor(pos1, grid),
|
|
15
|
+
pos2,
|
|
16
|
+
color2: getColor(pos2, grid),
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
export default class DirectionLinkerSymbol extends Symbol {
|
|
20
|
+
x;
|
|
21
|
+
y;
|
|
22
|
+
static CONFIGS = Object.freeze([
|
|
23
|
+
{
|
|
24
|
+
type: ConfigType.Number,
|
|
25
|
+
default: 0,
|
|
26
|
+
field: 'x',
|
|
27
|
+
description: 'X',
|
|
28
|
+
configurable: false,
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
type: ConfigType.Number,
|
|
32
|
+
default: 0,
|
|
33
|
+
field: 'y',
|
|
34
|
+
description: 'Y',
|
|
35
|
+
configurable: false,
|
|
36
|
+
},
|
|
37
|
+
]);
|
|
38
|
+
static EXAMPLE_GRID = Object.freeze(GridData.create(['wwbbw', 'wwwww', 'wwwww', 'wwwww']));
|
|
39
|
+
static directionDeltas = {
|
|
40
|
+
[Direction.Up]: { dx: 0, dy: -1 },
|
|
41
|
+
[Direction.Down]: { dx: 0, dy: 1 },
|
|
42
|
+
[Direction.Left]: { dx: -1, dy: 0 },
|
|
43
|
+
[Direction.Right]: { dx: 1, dy: 0 },
|
|
44
|
+
};
|
|
45
|
+
linkedDirections = {
|
|
46
|
+
[Direction.Left]: Direction.Left,
|
|
47
|
+
[Direction.Up]: Direction.Up,
|
|
48
|
+
[Direction.Right]: Direction.Right,
|
|
49
|
+
[Direction.Down]: Direction.Down,
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* **Darts count opposite color cells in that direction**
|
|
53
|
+
*
|
|
54
|
+
* @param x - The x-coordinate of the symbol.
|
|
55
|
+
* @param y - The y-coordinate of the symbol.
|
|
56
|
+
*/
|
|
57
|
+
constructor(x, y) {
|
|
58
|
+
super(x, y);
|
|
59
|
+
this.x = x;
|
|
60
|
+
this.y = y;
|
|
61
|
+
}
|
|
62
|
+
changeDirections(linkedDirections) {
|
|
63
|
+
this.linkedDirections = linkedDirections;
|
|
64
|
+
return this;
|
|
65
|
+
}
|
|
66
|
+
get id() {
|
|
67
|
+
return `linkedDirection`;
|
|
68
|
+
}
|
|
69
|
+
get explanation() {
|
|
70
|
+
return `Direction pointed by this symbol should *behave* the same.`;
|
|
71
|
+
}
|
|
72
|
+
get configs() {
|
|
73
|
+
return DirectionLinkerSymbol.CONFIGS;
|
|
74
|
+
}
|
|
75
|
+
createExampleGrid() {
|
|
76
|
+
return DirectionLinkerSymbol.EXAMPLE_GRID;
|
|
77
|
+
}
|
|
78
|
+
deltaCoordinate(c, direction) {
|
|
79
|
+
return {
|
|
80
|
+
x: c.x + DirectionLinkerSymbol.directionDeltas[direction].dx,
|
|
81
|
+
y: c.y + DirectionLinkerSymbol.directionDeltas[direction].dy,
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
validateSymbol(grid) {
|
|
85
|
+
// A turtle is an object which have 2 coordinates
|
|
86
|
+
// This turtle when activated will check the color of both the cells it is pointing to
|
|
87
|
+
// If the color of one of the cell is gray, the turtle doesn't fire any other turtle
|
|
88
|
+
// If one of the turtle's coordinate is out of the grid, consider it's color as opposite of the base color
|
|
89
|
+
// If the color of both cells are different, return a State.Error
|
|
90
|
+
// If the color of both are the same as the color of the turtle, the turtle fires another turtle in all the directions according to the linked directions except the one it came from and the directions where a turtle has already been fired
|
|
91
|
+
// If the color of both are the opposite of the turtle, the turtle doesn't fire any other turtle
|
|
92
|
+
// If no turtle remains, go to final state
|
|
93
|
+
// Final state is State.Satisfied if no gray cell is found, State.Incomplete otherwise
|
|
94
|
+
let checkedCouples = this.getInitialCheckedCouples(this.x, this.y, grid);
|
|
95
|
+
if (checkedCouples.some(({ color1, color2 }) => (color1 === null && color2 !== null) ||
|
|
96
|
+
(color1 !== null && color2 === null))) {
|
|
97
|
+
return State.Error;
|
|
98
|
+
}
|
|
99
|
+
if (checkedCouples.some(({ color1, color2 }) => color1 === Color.Gray || color2 === Color.Gray)) {
|
|
100
|
+
return State.Incomplete;
|
|
101
|
+
}
|
|
102
|
+
checkedCouples = checkedCouples.filter(({ color1, color2 }) => color1 !== null && color2 !== null);
|
|
103
|
+
const queue = checkedCouples.slice();
|
|
104
|
+
let grayFound = false;
|
|
105
|
+
while (queue.length > 0) {
|
|
106
|
+
const turtle = queue.shift();
|
|
107
|
+
const { pos1, pos2, color1: baseColor1, color2: baseColor2 } = turtle;
|
|
108
|
+
const color1 = getColor(pos1, grid);
|
|
109
|
+
const color2 = getColor(pos2, grid);
|
|
110
|
+
if (color1 === Color.Gray || color2 === Color.Gray) {
|
|
111
|
+
grayFound = true;
|
|
112
|
+
}
|
|
113
|
+
else if (color1 === null || color2 === null) {
|
|
114
|
+
if ((color1 === null && color2 === baseColor2) ||
|
|
115
|
+
(color2 === null && color1 === baseColor1)) {
|
|
116
|
+
return State.Error;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
else if (color1 !== baseColor1 || color2 !== baseColor2) {
|
|
120
|
+
if (color1 === baseColor1 || color2 === baseColor2) {
|
|
121
|
+
return State.Error;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
if (color1 === baseColor1) {
|
|
125
|
+
const directions = Object.keys(this.linkedDirections);
|
|
126
|
+
for (const direction of directions) {
|
|
127
|
+
const newTurtle = {
|
|
128
|
+
pos1: this.deltaCoordinate(pos1, direction),
|
|
129
|
+
pos2: this.deltaCoordinate(pos2, this.linkedDirections[direction]),
|
|
130
|
+
color1: baseColor1,
|
|
131
|
+
color2: baseColor2,
|
|
132
|
+
};
|
|
133
|
+
const newArrTurtle = {
|
|
134
|
+
pos1: grid.toArrayCoordinates(newTurtle.pos1.x, newTurtle.pos1.y),
|
|
135
|
+
pos2: grid.toArrayCoordinates(newTurtle.pos2.x, newTurtle.pos2.y),
|
|
136
|
+
color1: baseColor1,
|
|
137
|
+
color2: baseColor2,
|
|
138
|
+
};
|
|
139
|
+
const newColor1 = getColor(newArrTurtle.pos1, grid);
|
|
140
|
+
const newColor2 = getColor(newArrTurtle.pos2, grid);
|
|
141
|
+
if (newColor1 !== baseColor1 &&
|
|
142
|
+
newColor2 !== baseColor2 &&
|
|
143
|
+
newColor1 !== Color.Gray &&
|
|
144
|
+
newColor2 !== Color.Gray) {
|
|
145
|
+
continue;
|
|
146
|
+
}
|
|
147
|
+
if (checkedCouples.some(({ pos1, pos2 }) => pos1.x === newArrTurtle.pos1.x &&
|
|
148
|
+
pos1.y === newArrTurtle.pos1.y &&
|
|
149
|
+
pos2.x === newArrTurtle.pos2.x &&
|
|
150
|
+
pos2.y === newArrTurtle.pos2.y) ||
|
|
151
|
+
(pos1.x === newArrTurtle.pos2.x &&
|
|
152
|
+
pos1.y === newArrTurtle.pos2.y &&
|
|
153
|
+
pos2.x === newArrTurtle.pos1.x &&
|
|
154
|
+
pos2.y === newArrTurtle.pos1.y)) {
|
|
155
|
+
continue;
|
|
156
|
+
}
|
|
157
|
+
checkedCouples.push(newArrTurtle);
|
|
158
|
+
queue.push(newTurtle);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
return grayFound ? State.Incomplete : State.Satisfied;
|
|
163
|
+
}
|
|
164
|
+
getInitialCheckedCouples(x, y, grid) {
|
|
165
|
+
// 1x1
|
|
166
|
+
if (x % 1 === 0 && y % 1 === 0) {
|
|
167
|
+
return [makeTurtle({ x, y }, { x, y }, grid)];
|
|
168
|
+
}
|
|
169
|
+
// 1x2
|
|
170
|
+
if (x % 1 === 0) {
|
|
171
|
+
if (this.linkedDirections[Direction.Up] === Direction.Up &&
|
|
172
|
+
this.linkedDirections[Direction.Down] === Direction.Down) {
|
|
173
|
+
return [
|
|
174
|
+
makeTurtle({ x, y: y - 0.5 }, { x, y: y - 0.5 }, grid),
|
|
175
|
+
makeTurtle({ x, y: y + 0.5 }, { x, y: y + 0.5 }, grid),
|
|
176
|
+
];
|
|
177
|
+
}
|
|
178
|
+
else {
|
|
179
|
+
return [makeTurtle({ x, y: y - 0.5 }, { x, y: y + 0.5 }, grid)];
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
// 2x1
|
|
183
|
+
if (y % 1 === 0) {
|
|
184
|
+
if (this.linkedDirections[Direction.Left] === Direction.Left &&
|
|
185
|
+
this.linkedDirections[Direction.Right] === Direction.Right) {
|
|
186
|
+
return [
|
|
187
|
+
makeTurtle({ x: x - 0.5, y }, { x: x - 0.5, y }, grid),
|
|
188
|
+
makeTurtle({ x: x + 0.5, y }, { x: x + 0.5, y }, grid),
|
|
189
|
+
];
|
|
190
|
+
}
|
|
191
|
+
else {
|
|
192
|
+
return [makeTurtle({ x: x - 0.5, y }, { x: x + 0.5, y }, grid)];
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
// 2x2
|
|
196
|
+
if (this.linkedDirections[Direction.Left] === Direction.Left &&
|
|
197
|
+
this.linkedDirections[Direction.Right] === Direction.Right) {
|
|
198
|
+
return [
|
|
199
|
+
makeTurtle({ x: x - 0.5, y: y - 0.5 }, { x: x - 0.5, y: y + 0.5 }, grid),
|
|
200
|
+
makeTurtle({ x: x + 0.5, y: y - 0.5 }, { x: x + 0.5, y: y + 0.5 }, grid),
|
|
201
|
+
];
|
|
202
|
+
}
|
|
203
|
+
if (this.linkedDirections[Direction.Up] === Direction.Up &&
|
|
204
|
+
this.linkedDirections[Direction.Down] === Direction.Down) {
|
|
205
|
+
return [
|
|
206
|
+
makeTurtle({ x: x - 0.5, y: y - 0.5 }, { x: x + 0.5, y: y - 0.5 }, grid),
|
|
207
|
+
makeTurtle({ x: x - 0.5, y: y + 0.5 }, { x: x + 0.5, y: y + 0.5 }, grid),
|
|
208
|
+
];
|
|
209
|
+
}
|
|
210
|
+
else if (this.linkedDirections[Direction.Up] === Direction.Left &&
|
|
211
|
+
this.linkedDirections[Direction.Left] === Direction.Up) {
|
|
212
|
+
return [
|
|
213
|
+
makeTurtle({ x: x - 0.5, y: y - 0.5 }, { x: x - 0.5, y: y - 0.5 }, grid),
|
|
214
|
+
makeTurtle({ x: x - 0.5, y: y + 0.5 }, { x: x + 0.5, y: y - 0.5 }, grid),
|
|
215
|
+
makeTurtle({ x: x + 0.5, y: y + 0.5 }, { x: x + 0.5, y: y + 0.5 }, grid),
|
|
216
|
+
];
|
|
217
|
+
}
|
|
218
|
+
else if (this.linkedDirections[Direction.Up] === Direction.Right &&
|
|
219
|
+
this.linkedDirections[Direction.Right] === Direction.Up) {
|
|
220
|
+
return [
|
|
221
|
+
makeTurtle({ x: x + 0.5, y: y - 0.5 }, { x: x + 0.5, y: y - 0.5 }, grid),
|
|
222
|
+
makeTurtle({ x: x - 0.5, y: y - 0.5 }, { x: x + 0.5, y: y + 0.5 }, grid),
|
|
223
|
+
makeTurtle({ x: x - 0.5, y: y + 0.5 }, { x: x - 0.5, y: y + 0.5 }, grid),
|
|
224
|
+
];
|
|
225
|
+
}
|
|
226
|
+
return [
|
|
227
|
+
makeTurtle({ x: x - 0.5, y: y - 0.5 }, { x: x + 0.5, y: y + 0.5 }, grid),
|
|
228
|
+
makeTurtle({ x: x - 0.5, y: y + 0.5 }, { x: x + 0.5, y: y - 0.5 }, grid),
|
|
229
|
+
];
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
export const instance = undefined;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { AnyConfig } from '../config.js';
|
|
2
|
+
import GridData from '../grid.js';
|
|
3
|
+
import { State } from '../primitives.js';
|
|
4
|
+
import Symbol from './symbol.js';
|
|
5
|
+
export default class EveryLetterSymbol extends Symbol {
|
|
6
|
+
readonly x: number;
|
|
7
|
+
readonly y: number;
|
|
8
|
+
readonly letter: string;
|
|
9
|
+
readonly title = "Hollow Letter";
|
|
10
|
+
private static readonly CONFIGS;
|
|
11
|
+
private static readonly EXAMPLE_GRID;
|
|
12
|
+
/**
|
|
13
|
+
* **Include each Hollow Letter once per region**
|
|
14
|
+
*
|
|
15
|
+
* @param x - The x-coordinate of the symbol.
|
|
16
|
+
* @param y - The y-coordinate of the symbol.
|
|
17
|
+
* @param letter - The letter of the symbol.
|
|
18
|
+
*/
|
|
19
|
+
constructor(x: number, y: number, letter: string);
|
|
20
|
+
get id(): string;
|
|
21
|
+
get explanation(): string;
|
|
22
|
+
get configs(): readonly AnyConfig[] | null;
|
|
23
|
+
createExampleGrid(): GridData;
|
|
24
|
+
validateSymbol(grid: GridData): State;
|
|
25
|
+
copyWith({ x, y, letter, }: {
|
|
26
|
+
x?: number;
|
|
27
|
+
y?: number;
|
|
28
|
+
letter?: string;
|
|
29
|
+
}): this;
|
|
30
|
+
withLetter(letter: string): this;
|
|
31
|
+
}
|
|
32
|
+
export declare const instance: EveryLetterSymbol;
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { ConfigType } from '../config.js';
|
|
2
|
+
import GridData from '../grid.js';
|
|
3
|
+
import { array } from '../dataHelper.js';
|
|
4
|
+
import { Color, State } from '../primitives.js';
|
|
5
|
+
import Symbol from './symbol.js';
|
|
6
|
+
export default class EveryLetterSymbol extends Symbol {
|
|
7
|
+
x;
|
|
8
|
+
y;
|
|
9
|
+
letter;
|
|
10
|
+
title = 'Hollow Letter';
|
|
11
|
+
static CONFIGS = Object.freeze([
|
|
12
|
+
{
|
|
13
|
+
type: ConfigType.Number,
|
|
14
|
+
default: 0,
|
|
15
|
+
field: 'x',
|
|
16
|
+
description: 'X',
|
|
17
|
+
configurable: false,
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
type: ConfigType.Number,
|
|
21
|
+
default: 0,
|
|
22
|
+
field: 'y',
|
|
23
|
+
description: 'Y',
|
|
24
|
+
configurable: false,
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
type: ConfigType.String,
|
|
28
|
+
default: 'a',
|
|
29
|
+
field: 'letter',
|
|
30
|
+
description: 'Letter',
|
|
31
|
+
explanation: 'Use single lowercase letters by convention.',
|
|
32
|
+
configurable: true,
|
|
33
|
+
},
|
|
34
|
+
]);
|
|
35
|
+
static EXAMPLE_GRID = Object.freeze(GridData.create(['bwwbw', 'bwbbw', 'wwbww', 'bbbwb'])
|
|
36
|
+
.addSymbol(new EveryLetterSymbol(2, 0, 'b'))
|
|
37
|
+
.addSymbol(new EveryLetterSymbol(4, 1, 'a'))
|
|
38
|
+
.addSymbol(new EveryLetterSymbol(0, 2, 'a'))
|
|
39
|
+
.addSymbol(new EveryLetterSymbol(3, 2, 'b')));
|
|
40
|
+
/**
|
|
41
|
+
* **Include each Hollow Letter once per region**
|
|
42
|
+
*
|
|
43
|
+
* @param x - The x-coordinate of the symbol.
|
|
44
|
+
* @param y - The y-coordinate of the symbol.
|
|
45
|
+
* @param letter - The letter of the symbol.
|
|
46
|
+
*/
|
|
47
|
+
constructor(x, y, letter) {
|
|
48
|
+
super(x, y);
|
|
49
|
+
this.x = x;
|
|
50
|
+
this.y = y;
|
|
51
|
+
this.letter = letter;
|
|
52
|
+
this.letter = letter;
|
|
53
|
+
}
|
|
54
|
+
get id() {
|
|
55
|
+
return `every_letter`;
|
|
56
|
+
}
|
|
57
|
+
get explanation() {
|
|
58
|
+
return 'Include each *Hollow Letter* once per region';
|
|
59
|
+
}
|
|
60
|
+
get configs() {
|
|
61
|
+
return EveryLetterSymbol.CONFIGS;
|
|
62
|
+
}
|
|
63
|
+
createExampleGrid() {
|
|
64
|
+
return EveryLetterSymbol.EXAMPLE_GRID;
|
|
65
|
+
}
|
|
66
|
+
validateSymbol(grid) {
|
|
67
|
+
if (!this.validateSubtilePlacement(grid))
|
|
68
|
+
return State.Error;
|
|
69
|
+
const uniqueLetters = new Set(grid.symbols.get(this.id)?.map(s => s.letter));
|
|
70
|
+
if (uniqueLetters.size === 0) {
|
|
71
|
+
return State.Satisfied;
|
|
72
|
+
}
|
|
73
|
+
const possibleLetters = new Set(uniqueLetters);
|
|
74
|
+
const thisX = Math.floor(this.x);
|
|
75
|
+
const thisY = Math.floor(this.y);
|
|
76
|
+
let complete = true;
|
|
77
|
+
const visited = array(grid.width, grid.height, () => false);
|
|
78
|
+
const connected = array(grid.width, grid.height, () => false);
|
|
79
|
+
const color = grid.getTile(thisX, thisY).color;
|
|
80
|
+
if (color !== Color.Gray) {
|
|
81
|
+
grid.iterateArea({ x: thisX, y: thisY }, tile => tile.color === Color.Gray || tile.color === color, (tile, x, y) => {
|
|
82
|
+
visited[y][x] = true;
|
|
83
|
+
if (tile.color === Color.Gray)
|
|
84
|
+
complete = false;
|
|
85
|
+
});
|
|
86
|
+
grid.iterateArea({ x: thisX, y: thisY }, tile => tile.color === color, (_, x, y) => {
|
|
87
|
+
connected[y][x] = true;
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
return State.Incomplete;
|
|
92
|
+
}
|
|
93
|
+
for (const symbol of grid.symbols.get(this.id) ?? []) {
|
|
94
|
+
if (symbol instanceof EveryLetterSymbol) {
|
|
95
|
+
const symbolX = Math.floor(symbol.x);
|
|
96
|
+
const symbolY = Math.floor(symbol.y);
|
|
97
|
+
if (visited[symbolY][symbolX]) {
|
|
98
|
+
possibleLetters.delete(symbol.letter);
|
|
99
|
+
}
|
|
100
|
+
if (connected[symbolY][symbolX]) {
|
|
101
|
+
if (!uniqueLetters.delete(symbol.letter)) {
|
|
102
|
+
return State.Error;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
if (possibleLetters.size > 0) {
|
|
108
|
+
return State.Error;
|
|
109
|
+
}
|
|
110
|
+
return complete ? State.Satisfied : State.Incomplete;
|
|
111
|
+
}
|
|
112
|
+
copyWith({ x, y, letter, }) {
|
|
113
|
+
return new EveryLetterSymbol(x ?? this.x, y ?? this.y, letter ?? this.letter);
|
|
114
|
+
}
|
|
115
|
+
withLetter(letter) {
|
|
116
|
+
return this.copyWith({ letter });
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
export const instance = new EveryLetterSymbol(0, 0, 'a');
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { AnyConfig } from '../config.js';
|
|
2
|
+
import { SymbolMergeHandler } from '../events/onSymbolMerge.js';
|
|
3
|
+
import GridData from '../grid.js';
|
|
4
|
+
import NumberSymbol from './numberSymbol.js';
|
|
5
|
+
import Symbol from './symbol.js';
|
|
6
|
+
export default class FocusSymbol extends NumberSymbol implements SymbolMergeHandler {
|
|
7
|
+
readonly deadEnd: boolean;
|
|
8
|
+
get title(): string;
|
|
9
|
+
private static readonly CONFIGS;
|
|
10
|
+
private static readonly EXAMPLE_GRID;
|
|
11
|
+
private static readonly EXAMPLE_GRID_DEAD_END;
|
|
12
|
+
/**
|
|
13
|
+
* **Focus Numbers count directly adjacent cells of the same color**
|
|
14
|
+
* @param x - The x-coordinate of the symbol.
|
|
15
|
+
* @param y - The y-coordinate of the symbol.
|
|
16
|
+
* @param deadEnd - Whether this Focus Number is a Dead End.
|
|
17
|
+
* @param number - The focus number.
|
|
18
|
+
*/
|
|
19
|
+
constructor(x: number, y: number, deadEnd: boolean, number: number);
|
|
20
|
+
get id(): string;
|
|
21
|
+
get placementStep(): number;
|
|
22
|
+
get explanation(): string;
|
|
23
|
+
get configs(): readonly AnyConfig[] | null;
|
|
24
|
+
createExampleGrid(): GridData;
|
|
25
|
+
private countForColor;
|
|
26
|
+
countTiles(grid: GridData): {
|
|
27
|
+
completed: number;
|
|
28
|
+
possible: number;
|
|
29
|
+
};
|
|
30
|
+
descriptionEquals(other: Symbol): boolean;
|
|
31
|
+
copyWith({ x, y, deadEnd, number, }: {
|
|
32
|
+
x?: number;
|
|
33
|
+
y?: number;
|
|
34
|
+
deadEnd?: boolean;
|
|
35
|
+
number?: number;
|
|
36
|
+
}): this;
|
|
37
|
+
withNumber(number: number): this;
|
|
38
|
+
withDeadEnd(deadEnd: boolean): this;
|
|
39
|
+
}
|
|
40
|
+
export declare const instance: FocusSymbol;
|