maze-test 0.2.0 → 0.4.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/README-CN.md +189 -0
- package/README.md +85 -7
- package/dist/cli.cjs +700 -418
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +700 -418
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +684 -428
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +102 -9
- package/dist/index.d.ts +102 -9
- package/dist/index.js +678 -428
- package/dist/index.js.map +1 -1
- package/package.json +3 -2
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,24 @@
|
|
|
1
1
|
type Language = "en" | "zh";
|
|
2
|
-
type ScenarioKind = "success" | "treasure-and-leave" | "death-and-stop";
|
|
2
|
+
type ScenarioKind = "success" | "treasure-and-leave" | "death-and-stop" | "mechanism-tour";
|
|
3
3
|
type Direction = "up" | "down" | "left" | "right";
|
|
4
|
+
type MechanismComplexity = "basic" | "intermediate" | "advanced";
|
|
5
|
+
type KeyMaterial = "copper" | "silver" | "gold";
|
|
6
|
+
type TreasureType = "treasure" | "coin" | "gem" | "relic";
|
|
7
|
+
type PotionKind = "healing" | "poison" | "antidote" | "haste" | "slow";
|
|
8
|
+
type SpeedMode = "normal" | "fast" | "slow";
|
|
9
|
+
type MaterialCounts = Record<KeyMaterial, number>;
|
|
10
|
+
type TreasureCounts = Record<TreasureType, number>;
|
|
11
|
+
interface MechanismConfig {
|
|
12
|
+
complexity: MechanismComplexity;
|
|
13
|
+
trapDamages: number[];
|
|
14
|
+
potionKinds: PotionKind[];
|
|
15
|
+
keyMaterials: KeyMaterial[];
|
|
16
|
+
treasureTypes: TreasureType[];
|
|
17
|
+
poisonDamage: number;
|
|
18
|
+
poisonDuration: number;
|
|
19
|
+
speedDuration: number;
|
|
20
|
+
movementTime: Record<SpeedMode, number>;
|
|
21
|
+
}
|
|
4
22
|
interface Cell {
|
|
5
23
|
row: number;
|
|
6
24
|
col: number;
|
|
@@ -9,17 +27,25 @@ interface Door {
|
|
|
9
27
|
id: string;
|
|
10
28
|
position: Cell;
|
|
11
29
|
state: "closed";
|
|
30
|
+
material?: KeyMaterial;
|
|
12
31
|
}
|
|
13
32
|
interface KeyObject {
|
|
14
33
|
id: string;
|
|
15
34
|
type: "key";
|
|
16
35
|
position: Cell;
|
|
36
|
+
material?: KeyMaterial;
|
|
37
|
+
}
|
|
38
|
+
interface TreasureContent {
|
|
39
|
+
type: TreasureType;
|
|
40
|
+
count: number;
|
|
17
41
|
}
|
|
18
42
|
interface ChestObject {
|
|
19
43
|
id: string;
|
|
20
44
|
type: "chest";
|
|
21
45
|
position: Cell;
|
|
22
46
|
treasures: number;
|
|
47
|
+
contents: TreasureContent[];
|
|
48
|
+
lockMaterial?: KeyMaterial;
|
|
23
49
|
}
|
|
24
50
|
interface TrapObject {
|
|
25
51
|
id: string;
|
|
@@ -27,13 +53,22 @@ interface TrapObject {
|
|
|
27
53
|
position: Cell;
|
|
28
54
|
damage: number;
|
|
29
55
|
}
|
|
56
|
+
/** Legacy basic-mode healing object retained for schema compatibility. */
|
|
30
57
|
interface MedicineObject {
|
|
31
58
|
id: string;
|
|
32
59
|
type: "medicine";
|
|
33
60
|
position: Cell;
|
|
34
61
|
recovery: number;
|
|
35
62
|
}
|
|
36
|
-
|
|
63
|
+
interface PotionObject {
|
|
64
|
+
id: string;
|
|
65
|
+
type: "potion";
|
|
66
|
+
position: Cell;
|
|
67
|
+
kind: PotionKind;
|
|
68
|
+
potency?: number;
|
|
69
|
+
duration?: number;
|
|
70
|
+
}
|
|
71
|
+
type MazeObject = KeyObject | ChestObject | TrapObject | MedicineObject | PotionObject;
|
|
37
72
|
interface MazeMetrics {
|
|
38
73
|
totalCells: number;
|
|
39
74
|
wallCells: number;
|
|
@@ -50,7 +85,7 @@ interface MazeMetrics {
|
|
|
50
85
|
objectCounts: Partial<Record<MazeObject["type"], number>>;
|
|
51
86
|
}
|
|
52
87
|
interface Maze {
|
|
53
|
-
schemaVersion: "solid-cell-maze-v3@1";
|
|
88
|
+
schemaVersion: "solid-cell-maze-v3@1" | "solid-cell-maze-v4@1";
|
|
54
89
|
id: string;
|
|
55
90
|
seed: number;
|
|
56
91
|
requestedSeed: number;
|
|
@@ -62,6 +97,7 @@ interface Maze {
|
|
|
62
97
|
columns: "letters-left-to-right";
|
|
63
98
|
rows: "numbers-top-to-bottom";
|
|
64
99
|
};
|
|
100
|
+
mechanisms: MechanismConfig;
|
|
65
101
|
terrain: string[];
|
|
66
102
|
entry: Cell;
|
|
67
103
|
goal: Cell;
|
|
@@ -76,6 +112,7 @@ interface GenerateMazeOptions {
|
|
|
76
112
|
requestedSeed?: number;
|
|
77
113
|
braid?: number;
|
|
78
114
|
id?: string;
|
|
115
|
+
mechanisms?: MechanismConfig;
|
|
79
116
|
}
|
|
80
117
|
interface DecorateMazeOptions {
|
|
81
118
|
seed?: number;
|
|
@@ -83,15 +120,35 @@ interface DecorateMazeOptions {
|
|
|
83
120
|
chestCount?: number;
|
|
84
121
|
trapCount?: number;
|
|
85
122
|
medicineCount?: number;
|
|
123
|
+
potionCount?: number;
|
|
124
|
+
mechanisms?: MechanismConfig;
|
|
86
125
|
}
|
|
87
126
|
interface InitialState {
|
|
88
127
|
health: number;
|
|
89
128
|
healthMax: number;
|
|
90
129
|
keys: number;
|
|
91
130
|
treasures: number;
|
|
131
|
+
keysByMaterial?: Partial<MaterialCounts>;
|
|
132
|
+
treasuresByType?: Partial<TreasureCounts>;
|
|
133
|
+
elapsedTime?: number;
|
|
134
|
+
speed?: SpeedMode;
|
|
135
|
+
speedRemaining?: number;
|
|
136
|
+
poisonDamage?: number;
|
|
137
|
+
poisonRemaining?: number;
|
|
92
138
|
}
|
|
93
|
-
interface TrialState
|
|
139
|
+
interface TrialState {
|
|
94
140
|
position: Cell;
|
|
141
|
+
health: number;
|
|
142
|
+
healthMax: number;
|
|
143
|
+
keys: number;
|
|
144
|
+
keysByMaterial: MaterialCounts;
|
|
145
|
+
treasures: number;
|
|
146
|
+
treasuresByType: TreasureCounts;
|
|
147
|
+
elapsedTime: number;
|
|
148
|
+
speed: SpeedMode;
|
|
149
|
+
speedRemaining: number;
|
|
150
|
+
poisonDamage: number;
|
|
151
|
+
poisonRemaining: number;
|
|
95
152
|
alive: boolean;
|
|
96
153
|
reachedGoal: boolean;
|
|
97
154
|
openedDoors: string[];
|
|
@@ -99,16 +156,22 @@ interface TrialState extends InitialState {
|
|
|
99
156
|
openedChests: string[];
|
|
100
157
|
triggeredTraps: string[];
|
|
101
158
|
usedMedicines: string[];
|
|
159
|
+
usedPotions: string[];
|
|
102
160
|
}
|
|
103
161
|
interface TrialEvent {
|
|
104
|
-
type: "open-door" | "collect-key" | "open-chest" | "pass-closed-chest" | "trigger-trap" | "use-medicine" | "die" | "reach-goal";
|
|
162
|
+
type: "open-door" | "collect-key" | "open-chest" | "pass-closed-chest" | "trigger-trap" | "use-medicine" | "drink-potion" | "poison-tick" | "speed-expired" | "die" | "reach-goal";
|
|
105
163
|
id?: string;
|
|
164
|
+
material?: KeyMaterial;
|
|
165
|
+
potionKind?: PotionKind;
|
|
106
166
|
keyCost?: number;
|
|
107
167
|
treasures?: number;
|
|
168
|
+
contents?: TreasureContent[];
|
|
108
169
|
damage?: number;
|
|
109
170
|
recovery?: number;
|
|
171
|
+
duration?: number;
|
|
172
|
+
timeCost?: number;
|
|
110
173
|
}
|
|
111
|
-
type BlockedReason = "dead" | "wall-or-outside" | "closed-door-without-key";
|
|
174
|
+
type BlockedReason = "dead" | "wall-or-outside" | "closed-door-without-key" | "closed-door-without-matching-key";
|
|
112
175
|
interface TrialTraceItem {
|
|
113
176
|
step: number;
|
|
114
177
|
direction: Direction;
|
|
@@ -121,7 +184,9 @@ interface TrialTraceItem {
|
|
|
121
184
|
interface TrialAnswers {
|
|
122
185
|
finalPosition: string;
|
|
123
186
|
keys: number;
|
|
187
|
+
keysByMaterial: MaterialCounts;
|
|
124
188
|
treasures: number;
|
|
189
|
+
treasuresByType: TreasureCounts;
|
|
125
190
|
health: number;
|
|
126
191
|
alive: boolean;
|
|
127
192
|
reachedGoal: boolean;
|
|
@@ -129,6 +194,12 @@ interface TrialAnswers {
|
|
|
129
194
|
openedChests: number;
|
|
130
195
|
triggeredTraps: number;
|
|
131
196
|
usedMedicines: number;
|
|
197
|
+
usedPotions: number;
|
|
198
|
+
elapsedTime: number;
|
|
199
|
+
finalSpeed: SpeedMode;
|
|
200
|
+
speedRemaining: number;
|
|
201
|
+
poisonDamage: number;
|
|
202
|
+
poisonRemaining: number;
|
|
132
203
|
blockedMoves: number;
|
|
133
204
|
blockedAfterDeath: number;
|
|
134
205
|
}
|
|
@@ -146,6 +217,15 @@ interface TrialOptions {
|
|
|
146
217
|
chestCount?: number;
|
|
147
218
|
trapCount?: number;
|
|
148
219
|
medicineCount?: number;
|
|
220
|
+
potionCount?: number;
|
|
221
|
+
complexity?: MechanismComplexity;
|
|
222
|
+
trapDamages?: number[];
|
|
223
|
+
potionKinds?: PotionKind[];
|
|
224
|
+
keyMaterials?: KeyMaterial[];
|
|
225
|
+
treasureTypes?: TreasureType[];
|
|
226
|
+
poisonDamage?: number;
|
|
227
|
+
poisonDuration?: number;
|
|
228
|
+
speedDuration?: number;
|
|
149
229
|
scenario?: ScenarioKind;
|
|
150
230
|
language?: Language;
|
|
151
231
|
style?: number;
|
|
@@ -160,7 +240,8 @@ interface ResolvedTrialOptions {
|
|
|
160
240
|
doorCount: number;
|
|
161
241
|
chestCount: number;
|
|
162
242
|
trapCount: number;
|
|
163
|
-
|
|
243
|
+
potionCount: number;
|
|
244
|
+
mechanisms: MechanismConfig;
|
|
164
245
|
scenario: ScenarioKind;
|
|
165
246
|
language: Language;
|
|
166
247
|
style: number;
|
|
@@ -174,7 +255,7 @@ interface TrialSections {
|
|
|
174
255
|
questions: string;
|
|
175
256
|
}
|
|
176
257
|
interface MazeTrial {
|
|
177
|
-
schemaVersion: "maze-test-trial@
|
|
258
|
+
schemaVersion: "maze-test-trial@2";
|
|
178
259
|
options: ResolvedTrialOptions;
|
|
179
260
|
maze: Maze;
|
|
180
261
|
initialState: InitialState;
|
|
@@ -208,6 +289,18 @@ declare function isFloor(maze: Pick<Maze, "rows" | "cols" | "terrain">, value: C
|
|
|
208
289
|
|
|
209
290
|
declare function renderCharacterMaze(maze: Maze, language?: Language): string;
|
|
210
291
|
|
|
292
|
+
declare function mechanismPreset(complexity: MechanismComplexity): MechanismConfig;
|
|
293
|
+
declare function resolveMechanisms(options: TrialOptions): MechanismConfig;
|
|
294
|
+
declare function defaultObjectCounts(complexity: MechanismComplexity): {
|
|
295
|
+
doors: number;
|
|
296
|
+
chests: number;
|
|
297
|
+
traps: number;
|
|
298
|
+
potions: number;
|
|
299
|
+
};
|
|
300
|
+
declare function emptyMaterialCounts(values?: Partial<MaterialCounts>): MaterialCounts;
|
|
301
|
+
declare function emptyTreasureCounts(values?: Partial<TreasureCounts>): TreasureCounts;
|
|
302
|
+
declare function totalMaterialKeys(counts: MaterialCounts): number;
|
|
303
|
+
|
|
211
304
|
declare function simulateTrial(maze: Maze, actions: readonly Direction[], initial?: Partial<InitialState>): SimulationResult;
|
|
212
305
|
declare function stateKey(state: TrialState): string;
|
|
213
306
|
|
|
@@ -219,4 +312,4 @@ declare function resolveTrialOptions(options?: TrialOptions): ResolvedTrialOptio
|
|
|
219
312
|
/** The npm package name. Retained for compatibility with the initial release. */
|
|
220
313
|
declare const packageName = "maze-test";
|
|
221
314
|
|
|
222
|
-
export { type BlockedReason, type Cell, type ChestObject, type DecorateMazeOptions, type Direction, type Door, type GenerateMazeOptions, type InitialState, type KeyObject, type Language, type Maze, type MazeMetrics, type MazeObject, type MazeTrial, type MazeValidation, type MedicineObject, type ResolvedTrialOptions, type ScenarioKind, type SimulationResult, type TrapObject, type TrialAnswers, type TrialEvent, type TrialOptions, type TrialSections, type TrialState, type TrialTraceItem, analyzeSolidCellMaze, cell, cellKey, columnLabel, decorateSolidCellMaze, generateAnswer, generateQuestion, generateSolidCellMaze, generateTrial, isFloor, letterNumberCoordinate, neighbors, packageName, renderCharacterMaze, resolveTrialOptions, rowColumnCoordinate, sameCell, shortestPath, simulateTrial, stateKey, terrainAt, validateSolidCellMaze };
|
|
315
|
+
export { type BlockedReason, type Cell, type ChestObject, type DecorateMazeOptions, type Direction, type Door, type GenerateMazeOptions, type InitialState, type KeyMaterial, type KeyObject, type Language, type MaterialCounts, type Maze, type MazeMetrics, type MazeObject, type MazeTrial, type MazeValidation, type MechanismComplexity, type MechanismConfig, type MedicineObject, type PotionKind, type PotionObject, type ResolvedTrialOptions, type ScenarioKind, type SimulationResult, type SpeedMode, type TrapObject, type TreasureContent, type TreasureCounts, type TreasureType, type TrialAnswers, type TrialEvent, type TrialOptions, type TrialSections, type TrialState, type TrialTraceItem, analyzeSolidCellMaze, cell, cellKey, columnLabel, decorateSolidCellMaze, defaultObjectCounts, emptyMaterialCounts, emptyTreasureCounts, generateAnswer, generateQuestion, generateSolidCellMaze, generateTrial, isFloor, letterNumberCoordinate, mechanismPreset, neighbors, packageName, renderCharacterMaze, resolveMechanisms, resolveTrialOptions, rowColumnCoordinate, sameCell, shortestPath, simulateTrial, stateKey, terrainAt, totalMaterialKeys, validateSolidCellMaze };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,24 @@
|
|
|
1
1
|
type Language = "en" | "zh";
|
|
2
|
-
type ScenarioKind = "success" | "treasure-and-leave" | "death-and-stop";
|
|
2
|
+
type ScenarioKind = "success" | "treasure-and-leave" | "death-and-stop" | "mechanism-tour";
|
|
3
3
|
type Direction = "up" | "down" | "left" | "right";
|
|
4
|
+
type MechanismComplexity = "basic" | "intermediate" | "advanced";
|
|
5
|
+
type KeyMaterial = "copper" | "silver" | "gold";
|
|
6
|
+
type TreasureType = "treasure" | "coin" | "gem" | "relic";
|
|
7
|
+
type PotionKind = "healing" | "poison" | "antidote" | "haste" | "slow";
|
|
8
|
+
type SpeedMode = "normal" | "fast" | "slow";
|
|
9
|
+
type MaterialCounts = Record<KeyMaterial, number>;
|
|
10
|
+
type TreasureCounts = Record<TreasureType, number>;
|
|
11
|
+
interface MechanismConfig {
|
|
12
|
+
complexity: MechanismComplexity;
|
|
13
|
+
trapDamages: number[];
|
|
14
|
+
potionKinds: PotionKind[];
|
|
15
|
+
keyMaterials: KeyMaterial[];
|
|
16
|
+
treasureTypes: TreasureType[];
|
|
17
|
+
poisonDamage: number;
|
|
18
|
+
poisonDuration: number;
|
|
19
|
+
speedDuration: number;
|
|
20
|
+
movementTime: Record<SpeedMode, number>;
|
|
21
|
+
}
|
|
4
22
|
interface Cell {
|
|
5
23
|
row: number;
|
|
6
24
|
col: number;
|
|
@@ -9,17 +27,25 @@ interface Door {
|
|
|
9
27
|
id: string;
|
|
10
28
|
position: Cell;
|
|
11
29
|
state: "closed";
|
|
30
|
+
material?: KeyMaterial;
|
|
12
31
|
}
|
|
13
32
|
interface KeyObject {
|
|
14
33
|
id: string;
|
|
15
34
|
type: "key";
|
|
16
35
|
position: Cell;
|
|
36
|
+
material?: KeyMaterial;
|
|
37
|
+
}
|
|
38
|
+
interface TreasureContent {
|
|
39
|
+
type: TreasureType;
|
|
40
|
+
count: number;
|
|
17
41
|
}
|
|
18
42
|
interface ChestObject {
|
|
19
43
|
id: string;
|
|
20
44
|
type: "chest";
|
|
21
45
|
position: Cell;
|
|
22
46
|
treasures: number;
|
|
47
|
+
contents: TreasureContent[];
|
|
48
|
+
lockMaterial?: KeyMaterial;
|
|
23
49
|
}
|
|
24
50
|
interface TrapObject {
|
|
25
51
|
id: string;
|
|
@@ -27,13 +53,22 @@ interface TrapObject {
|
|
|
27
53
|
position: Cell;
|
|
28
54
|
damage: number;
|
|
29
55
|
}
|
|
56
|
+
/** Legacy basic-mode healing object retained for schema compatibility. */
|
|
30
57
|
interface MedicineObject {
|
|
31
58
|
id: string;
|
|
32
59
|
type: "medicine";
|
|
33
60
|
position: Cell;
|
|
34
61
|
recovery: number;
|
|
35
62
|
}
|
|
36
|
-
|
|
63
|
+
interface PotionObject {
|
|
64
|
+
id: string;
|
|
65
|
+
type: "potion";
|
|
66
|
+
position: Cell;
|
|
67
|
+
kind: PotionKind;
|
|
68
|
+
potency?: number;
|
|
69
|
+
duration?: number;
|
|
70
|
+
}
|
|
71
|
+
type MazeObject = KeyObject | ChestObject | TrapObject | MedicineObject | PotionObject;
|
|
37
72
|
interface MazeMetrics {
|
|
38
73
|
totalCells: number;
|
|
39
74
|
wallCells: number;
|
|
@@ -50,7 +85,7 @@ interface MazeMetrics {
|
|
|
50
85
|
objectCounts: Partial<Record<MazeObject["type"], number>>;
|
|
51
86
|
}
|
|
52
87
|
interface Maze {
|
|
53
|
-
schemaVersion: "solid-cell-maze-v3@1";
|
|
88
|
+
schemaVersion: "solid-cell-maze-v3@1" | "solid-cell-maze-v4@1";
|
|
54
89
|
id: string;
|
|
55
90
|
seed: number;
|
|
56
91
|
requestedSeed: number;
|
|
@@ -62,6 +97,7 @@ interface Maze {
|
|
|
62
97
|
columns: "letters-left-to-right";
|
|
63
98
|
rows: "numbers-top-to-bottom";
|
|
64
99
|
};
|
|
100
|
+
mechanisms: MechanismConfig;
|
|
65
101
|
terrain: string[];
|
|
66
102
|
entry: Cell;
|
|
67
103
|
goal: Cell;
|
|
@@ -76,6 +112,7 @@ interface GenerateMazeOptions {
|
|
|
76
112
|
requestedSeed?: number;
|
|
77
113
|
braid?: number;
|
|
78
114
|
id?: string;
|
|
115
|
+
mechanisms?: MechanismConfig;
|
|
79
116
|
}
|
|
80
117
|
interface DecorateMazeOptions {
|
|
81
118
|
seed?: number;
|
|
@@ -83,15 +120,35 @@ interface DecorateMazeOptions {
|
|
|
83
120
|
chestCount?: number;
|
|
84
121
|
trapCount?: number;
|
|
85
122
|
medicineCount?: number;
|
|
123
|
+
potionCount?: number;
|
|
124
|
+
mechanisms?: MechanismConfig;
|
|
86
125
|
}
|
|
87
126
|
interface InitialState {
|
|
88
127
|
health: number;
|
|
89
128
|
healthMax: number;
|
|
90
129
|
keys: number;
|
|
91
130
|
treasures: number;
|
|
131
|
+
keysByMaterial?: Partial<MaterialCounts>;
|
|
132
|
+
treasuresByType?: Partial<TreasureCounts>;
|
|
133
|
+
elapsedTime?: number;
|
|
134
|
+
speed?: SpeedMode;
|
|
135
|
+
speedRemaining?: number;
|
|
136
|
+
poisonDamage?: number;
|
|
137
|
+
poisonRemaining?: number;
|
|
92
138
|
}
|
|
93
|
-
interface TrialState
|
|
139
|
+
interface TrialState {
|
|
94
140
|
position: Cell;
|
|
141
|
+
health: number;
|
|
142
|
+
healthMax: number;
|
|
143
|
+
keys: number;
|
|
144
|
+
keysByMaterial: MaterialCounts;
|
|
145
|
+
treasures: number;
|
|
146
|
+
treasuresByType: TreasureCounts;
|
|
147
|
+
elapsedTime: number;
|
|
148
|
+
speed: SpeedMode;
|
|
149
|
+
speedRemaining: number;
|
|
150
|
+
poisonDamage: number;
|
|
151
|
+
poisonRemaining: number;
|
|
95
152
|
alive: boolean;
|
|
96
153
|
reachedGoal: boolean;
|
|
97
154
|
openedDoors: string[];
|
|
@@ -99,16 +156,22 @@ interface TrialState extends InitialState {
|
|
|
99
156
|
openedChests: string[];
|
|
100
157
|
triggeredTraps: string[];
|
|
101
158
|
usedMedicines: string[];
|
|
159
|
+
usedPotions: string[];
|
|
102
160
|
}
|
|
103
161
|
interface TrialEvent {
|
|
104
|
-
type: "open-door" | "collect-key" | "open-chest" | "pass-closed-chest" | "trigger-trap" | "use-medicine" | "die" | "reach-goal";
|
|
162
|
+
type: "open-door" | "collect-key" | "open-chest" | "pass-closed-chest" | "trigger-trap" | "use-medicine" | "drink-potion" | "poison-tick" | "speed-expired" | "die" | "reach-goal";
|
|
105
163
|
id?: string;
|
|
164
|
+
material?: KeyMaterial;
|
|
165
|
+
potionKind?: PotionKind;
|
|
106
166
|
keyCost?: number;
|
|
107
167
|
treasures?: number;
|
|
168
|
+
contents?: TreasureContent[];
|
|
108
169
|
damage?: number;
|
|
109
170
|
recovery?: number;
|
|
171
|
+
duration?: number;
|
|
172
|
+
timeCost?: number;
|
|
110
173
|
}
|
|
111
|
-
type BlockedReason = "dead" | "wall-or-outside" | "closed-door-without-key";
|
|
174
|
+
type BlockedReason = "dead" | "wall-or-outside" | "closed-door-without-key" | "closed-door-without-matching-key";
|
|
112
175
|
interface TrialTraceItem {
|
|
113
176
|
step: number;
|
|
114
177
|
direction: Direction;
|
|
@@ -121,7 +184,9 @@ interface TrialTraceItem {
|
|
|
121
184
|
interface TrialAnswers {
|
|
122
185
|
finalPosition: string;
|
|
123
186
|
keys: number;
|
|
187
|
+
keysByMaterial: MaterialCounts;
|
|
124
188
|
treasures: number;
|
|
189
|
+
treasuresByType: TreasureCounts;
|
|
125
190
|
health: number;
|
|
126
191
|
alive: boolean;
|
|
127
192
|
reachedGoal: boolean;
|
|
@@ -129,6 +194,12 @@ interface TrialAnswers {
|
|
|
129
194
|
openedChests: number;
|
|
130
195
|
triggeredTraps: number;
|
|
131
196
|
usedMedicines: number;
|
|
197
|
+
usedPotions: number;
|
|
198
|
+
elapsedTime: number;
|
|
199
|
+
finalSpeed: SpeedMode;
|
|
200
|
+
speedRemaining: number;
|
|
201
|
+
poisonDamage: number;
|
|
202
|
+
poisonRemaining: number;
|
|
132
203
|
blockedMoves: number;
|
|
133
204
|
blockedAfterDeath: number;
|
|
134
205
|
}
|
|
@@ -146,6 +217,15 @@ interface TrialOptions {
|
|
|
146
217
|
chestCount?: number;
|
|
147
218
|
trapCount?: number;
|
|
148
219
|
medicineCount?: number;
|
|
220
|
+
potionCount?: number;
|
|
221
|
+
complexity?: MechanismComplexity;
|
|
222
|
+
trapDamages?: number[];
|
|
223
|
+
potionKinds?: PotionKind[];
|
|
224
|
+
keyMaterials?: KeyMaterial[];
|
|
225
|
+
treasureTypes?: TreasureType[];
|
|
226
|
+
poisonDamage?: number;
|
|
227
|
+
poisonDuration?: number;
|
|
228
|
+
speedDuration?: number;
|
|
149
229
|
scenario?: ScenarioKind;
|
|
150
230
|
language?: Language;
|
|
151
231
|
style?: number;
|
|
@@ -160,7 +240,8 @@ interface ResolvedTrialOptions {
|
|
|
160
240
|
doorCount: number;
|
|
161
241
|
chestCount: number;
|
|
162
242
|
trapCount: number;
|
|
163
|
-
|
|
243
|
+
potionCount: number;
|
|
244
|
+
mechanisms: MechanismConfig;
|
|
164
245
|
scenario: ScenarioKind;
|
|
165
246
|
language: Language;
|
|
166
247
|
style: number;
|
|
@@ -174,7 +255,7 @@ interface TrialSections {
|
|
|
174
255
|
questions: string;
|
|
175
256
|
}
|
|
176
257
|
interface MazeTrial {
|
|
177
|
-
schemaVersion: "maze-test-trial@
|
|
258
|
+
schemaVersion: "maze-test-trial@2";
|
|
178
259
|
options: ResolvedTrialOptions;
|
|
179
260
|
maze: Maze;
|
|
180
261
|
initialState: InitialState;
|
|
@@ -208,6 +289,18 @@ declare function isFloor(maze: Pick<Maze, "rows" | "cols" | "terrain">, value: C
|
|
|
208
289
|
|
|
209
290
|
declare function renderCharacterMaze(maze: Maze, language?: Language): string;
|
|
210
291
|
|
|
292
|
+
declare function mechanismPreset(complexity: MechanismComplexity): MechanismConfig;
|
|
293
|
+
declare function resolveMechanisms(options: TrialOptions): MechanismConfig;
|
|
294
|
+
declare function defaultObjectCounts(complexity: MechanismComplexity): {
|
|
295
|
+
doors: number;
|
|
296
|
+
chests: number;
|
|
297
|
+
traps: number;
|
|
298
|
+
potions: number;
|
|
299
|
+
};
|
|
300
|
+
declare function emptyMaterialCounts(values?: Partial<MaterialCounts>): MaterialCounts;
|
|
301
|
+
declare function emptyTreasureCounts(values?: Partial<TreasureCounts>): TreasureCounts;
|
|
302
|
+
declare function totalMaterialKeys(counts: MaterialCounts): number;
|
|
303
|
+
|
|
211
304
|
declare function simulateTrial(maze: Maze, actions: readonly Direction[], initial?: Partial<InitialState>): SimulationResult;
|
|
212
305
|
declare function stateKey(state: TrialState): string;
|
|
213
306
|
|
|
@@ -219,4 +312,4 @@ declare function resolveTrialOptions(options?: TrialOptions): ResolvedTrialOptio
|
|
|
219
312
|
/** The npm package name. Retained for compatibility with the initial release. */
|
|
220
313
|
declare const packageName = "maze-test";
|
|
221
314
|
|
|
222
|
-
export { type BlockedReason, type Cell, type ChestObject, type DecorateMazeOptions, type Direction, type Door, type GenerateMazeOptions, type InitialState, type KeyObject, type Language, type Maze, type MazeMetrics, type MazeObject, type MazeTrial, type MazeValidation, type MedicineObject, type ResolvedTrialOptions, type ScenarioKind, type SimulationResult, type TrapObject, type TrialAnswers, type TrialEvent, type TrialOptions, type TrialSections, type TrialState, type TrialTraceItem, analyzeSolidCellMaze, cell, cellKey, columnLabel, decorateSolidCellMaze, generateAnswer, generateQuestion, generateSolidCellMaze, generateTrial, isFloor, letterNumberCoordinate, neighbors, packageName, renderCharacterMaze, resolveTrialOptions, rowColumnCoordinate, sameCell, shortestPath, simulateTrial, stateKey, terrainAt, validateSolidCellMaze };
|
|
315
|
+
export { type BlockedReason, type Cell, type ChestObject, type DecorateMazeOptions, type Direction, type Door, type GenerateMazeOptions, type InitialState, type KeyMaterial, type KeyObject, type Language, type MaterialCounts, type Maze, type MazeMetrics, type MazeObject, type MazeTrial, type MazeValidation, type MechanismComplexity, type MechanismConfig, type MedicineObject, type PotionKind, type PotionObject, type ResolvedTrialOptions, type ScenarioKind, type SimulationResult, type SpeedMode, type TrapObject, type TreasureContent, type TreasureCounts, type TreasureType, type TrialAnswers, type TrialEvent, type TrialOptions, type TrialSections, type TrialState, type TrialTraceItem, analyzeSolidCellMaze, cell, cellKey, columnLabel, decorateSolidCellMaze, defaultObjectCounts, emptyMaterialCounts, emptyTreasureCounts, generateAnswer, generateQuestion, generateSolidCellMaze, generateTrial, isFloor, letterNumberCoordinate, mechanismPreset, neighbors, packageName, renderCharacterMaze, resolveMechanisms, resolveTrialOptions, rowColumnCoordinate, sameCell, shortestPath, simulateTrial, stateKey, terrainAt, totalMaterialKeys, validateSolidCellMaze };
|