@logic-pad/core 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -5893,6 +5893,7 @@ declare global {
|
|
|
5893
5893
|
readonly x: number;
|
|
5894
5894
|
readonly y: number;
|
|
5895
5895
|
readonly color: Color;
|
|
5896
|
+
readonly revealLocation: boolean;
|
|
5896
5897
|
private static readonly CONFIGS;
|
|
5897
5898
|
private static readonly EXAMPLE_GRID;
|
|
5898
5899
|
/**
|
|
@@ -5901,8 +5902,9 @@ declare global {
|
|
|
5901
5902
|
* @param x - The x-coordinate of the symbol.
|
|
5902
5903
|
* @param y - The y-coordinate of the symbol.
|
|
5903
5904
|
* @param color - The target color of the cell.
|
|
5905
|
+
* @param revealLocation - Whether to reveal the location of the symbol.
|
|
5904
5906
|
*/
|
|
5905
|
-
constructor(x: number, y: number, color: Color);
|
|
5907
|
+
constructor(x: number, y: number, color: Color, revealLocation?: boolean);
|
|
5906
5908
|
get id(): string;
|
|
5907
5909
|
get explanation(): string;
|
|
5908
5910
|
get configs(): readonly AnyConfig[] | null;
|
|
@@ -5916,8 +5918,19 @@ declare global {
|
|
|
5916
5918
|
symbol: Symbol$1,
|
|
5917
5919
|
editing: boolean
|
|
5918
5920
|
): boolean;
|
|
5919
|
-
copyWith({
|
|
5921
|
+
copyWith({
|
|
5922
|
+
x,
|
|
5923
|
+
y,
|
|
5924
|
+
color,
|
|
5925
|
+
revealLocation,
|
|
5926
|
+
}: {
|
|
5927
|
+
x?: number;
|
|
5928
|
+
y?: number;
|
|
5929
|
+
color?: Color;
|
|
5930
|
+
revealLocation?: boolean;
|
|
5931
|
+
}): this;
|
|
5920
5932
|
withColor(color: Color): this;
|
|
5933
|
+
withRevealLocation(revealLocation: boolean): this;
|
|
5921
5934
|
}
|
|
5922
5935
|
export declare const allSymbols: Map<string, Symbol$1>;
|
|
5923
5936
|
export declare function aggregateState(
|
|
@@ -7,6 +7,7 @@ export default class HiddenSymbol extends Symbol implements SymbolDisplayHandler
|
|
|
7
7
|
readonly x: number;
|
|
8
8
|
readonly y: number;
|
|
9
9
|
readonly color: Color;
|
|
10
|
+
readonly revealLocation: boolean;
|
|
10
11
|
private static readonly CONFIGS;
|
|
11
12
|
private static readonly EXAMPLE_GRID;
|
|
12
13
|
/**
|
|
@@ -15,8 +16,9 @@ export default class HiddenSymbol extends Symbol implements SymbolDisplayHandler
|
|
|
15
16
|
* @param x - The x-coordinate of the symbol.
|
|
16
17
|
* @param y - The y-coordinate of the symbol.
|
|
17
18
|
* @param color - The target color of the cell.
|
|
19
|
+
* @param revealLocation - Whether to reveal the location of the symbol.
|
|
18
20
|
*/
|
|
19
|
-
constructor(x: number, y: number, color: Color);
|
|
21
|
+
constructor(x: number, y: number, color: Color, revealLocation?: boolean);
|
|
20
22
|
get id(): string;
|
|
21
23
|
get explanation(): string;
|
|
22
24
|
get configs(): readonly AnyConfig[] | null;
|
|
@@ -26,11 +28,13 @@ export default class HiddenSymbol extends Symbol implements SymbolDisplayHandler
|
|
|
26
28
|
get sortOrder(): number;
|
|
27
29
|
validateSymbol(grid: GridData): State;
|
|
28
30
|
onSymbolDisplay(grid: GridData, symbol: Symbol, editing: boolean): boolean;
|
|
29
|
-
copyWith({ x, y, color, }: {
|
|
31
|
+
copyWith({ x, y, color, revealLocation, }: {
|
|
30
32
|
x?: number;
|
|
31
33
|
y?: number;
|
|
32
34
|
color?: Color;
|
|
35
|
+
revealLocation?: boolean;
|
|
33
36
|
}): this;
|
|
34
37
|
withColor(color: Color): this;
|
|
38
|
+
withRevealLocation(revealLocation: boolean): this;
|
|
35
39
|
}
|
|
36
40
|
export declare const instance: HiddenSymbol;
|
|
@@ -10,8 +10,9 @@ class HiddenSymbol extends Symbol {
|
|
|
10
10
|
* @param x - The x-coordinate of the symbol.
|
|
11
11
|
* @param y - The y-coordinate of the symbol.
|
|
12
12
|
* @param color - The target color of the cell.
|
|
13
|
+
* @param revealLocation - Whether to reveal the location of the symbol.
|
|
13
14
|
*/
|
|
14
|
-
constructor(x, y, color) {
|
|
15
|
+
constructor(x, y, color, revealLocation = false) {
|
|
15
16
|
super(x, y);
|
|
16
17
|
Object.defineProperty(this, "x", {
|
|
17
18
|
enumerable: true,
|
|
@@ -31,7 +32,14 @@ class HiddenSymbol extends Symbol {
|
|
|
31
32
|
writable: true,
|
|
32
33
|
value: color
|
|
33
34
|
});
|
|
35
|
+
Object.defineProperty(this, "revealLocation", {
|
|
36
|
+
enumerable: true,
|
|
37
|
+
configurable: true,
|
|
38
|
+
writable: true,
|
|
39
|
+
value: revealLocation
|
|
40
|
+
});
|
|
34
41
|
this.color = color;
|
|
42
|
+
this.revealLocation = revealLocation;
|
|
35
43
|
}
|
|
36
44
|
get id() {
|
|
37
45
|
return `hidden`;
|
|
@@ -49,7 +57,7 @@ class HiddenSymbol extends Symbol {
|
|
|
49
57
|
return false;
|
|
50
58
|
}
|
|
51
59
|
get visibleWhenSolving() {
|
|
52
|
-
return
|
|
60
|
+
return this.revealLocation;
|
|
53
61
|
}
|
|
54
62
|
get sortOrder() {
|
|
55
63
|
return 0;
|
|
@@ -62,7 +70,7 @@ class HiddenSymbol extends Symbol {
|
|
|
62
70
|
: State.Incomplete;
|
|
63
71
|
}
|
|
64
72
|
onSymbolDisplay(grid, symbol, editing) {
|
|
65
|
-
if (
|
|
73
|
+
if (editing)
|
|
66
74
|
return true;
|
|
67
75
|
const thisX = Math.floor(this.x);
|
|
68
76
|
const thisY = Math.floor(this.y);
|
|
@@ -70,14 +78,21 @@ class HiddenSymbol extends Symbol {
|
|
|
70
78
|
const symY = Math.floor(symbol.y);
|
|
71
79
|
if (thisX !== symX || thisY !== symY)
|
|
72
80
|
return true;
|
|
73
|
-
|
|
81
|
+
const colorMatch = grid.getTile(thisX, thisY).color === this.color;
|
|
82
|
+
if (symbol.id === this.id) {
|
|
83
|
+
return !colorMatch;
|
|
84
|
+
}
|
|
85
|
+
return colorMatch;
|
|
74
86
|
}
|
|
75
|
-
copyWith({ x, y, color, }) {
|
|
76
|
-
return new HiddenSymbol(x ?? this.x, y ?? this.y, color ?? this.color);
|
|
87
|
+
copyWith({ x, y, color, revealLocation, }) {
|
|
88
|
+
return new HiddenSymbol(x ?? this.x, y ?? this.y, color ?? this.color, revealLocation ?? this.revealLocation);
|
|
77
89
|
}
|
|
78
90
|
withColor(color) {
|
|
79
91
|
return this.copyWith({ color });
|
|
80
92
|
}
|
|
93
|
+
withRevealLocation(revealLocation) {
|
|
94
|
+
return this.copyWith({ revealLocation });
|
|
95
|
+
}
|
|
81
96
|
}
|
|
82
97
|
Object.defineProperty(HiddenSymbol, "CONFIGS", {
|
|
83
98
|
enumerable: true,
|
|
@@ -106,6 +121,13 @@ Object.defineProperty(HiddenSymbol, "CONFIGS", {
|
|
|
106
121
|
description: 'Show on color',
|
|
107
122
|
configurable: true,
|
|
108
123
|
},
|
|
124
|
+
{
|
|
125
|
+
type: ConfigType.Boolean,
|
|
126
|
+
default: false,
|
|
127
|
+
field: 'revealLocation',
|
|
128
|
+
description: 'Reveal symbol location',
|
|
129
|
+
configurable: true,
|
|
130
|
+
},
|
|
109
131
|
])
|
|
110
132
|
});
|
|
111
133
|
Object.defineProperty(HiddenSymbol, "EXAMPLE_GRID", {
|