Skip to content

Commit 9447b79

Browse files
committed
Consolidate to 4 cost metrics, add test
1 parent 6c1ce52 commit 9447b79

4 files changed

Lines changed: 239 additions & 10 deletions

File tree

rust/maprando/src/traverse.rs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ fn apply_enemy_kill_requirement(
103103
#[derive(Clone)]
104104
pub struct CostConfig {}
105105

106-
pub const NUM_COST_METRICS: usize = 5;
106+
pub const NUM_COST_METRICS: usize = 4;
107107
type CostValue = i32;
108108

109109
fn compute_cost(
@@ -160,12 +160,7 @@ fn compute_cost(
160160
+ blue_suit_cost
161161
+ cycle_frames_cost;
162162
let ammo_sensitive_cost_metric = total_energy_cost
163-
+ 100000 * total_ammo_cost
164-
+ shinecharge_cost
165-
+ blue_suit_cost
166-
+ cycle_frames_cost;
167-
let shinecharge_sensitive_cost_metric = total_energy_cost
168-
+ total_ammo_cost
163+
+ 2000 * total_ammo_cost
169164
+ 100000 * shinecharge_cost
170165
+ blue_suit_cost
171166
+ cycle_frames_cost;
@@ -176,13 +171,12 @@ fn compute_cost(
176171
+ cycle_frames_cost;
177172
let blue_suit_ammo_sensitive_cost_metric = total_energy_cost
178173
+ 2000 * total_ammo_cost
179-
+ shinecharge_cost
174+
+ 10000 * shinecharge_cost
180175
+ 5000000 * blue_suit_cost
181176
+ cycle_frames_cost;
182177
[
183178
energy_sensitive_cost_metric,
184179
ammo_sensitive_cost_metric,
185-
shinecharge_sensitive_cost_metric,
186180
blue_suit_energy_sensitive_cost_metric,
187181
blue_suit_ammo_sensitive_cost_metric,
188182
]
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
{
2+
"$schema": "../../../../../sm-json-data/schema/m3-room.schema.json",
3+
"roomEnvironments": [{"heated": false}],
4+
"id": 0,
5+
"roomAddress": "0x0000",
6+
"name": "Test Room",
7+
"area": "Test Area",
8+
"subarea": "Test Subarea",
9+
"mapTileMask": [
10+
[1]
11+
],
12+
"nodes": [
13+
{
14+
"id": 1,
15+
"name": "Starting Node",
16+
"nodeType": "junction",
17+
"nodeSubType": "junction",
18+
"mapTileMask": [
19+
[1]
20+
]
21+
},
22+
{
23+
"id": 2,
24+
"name": "Middle Node",
25+
"nodeType": "junction",
26+
"nodeSubType": "junction",
27+
"mapTileMask": [
28+
[1]
29+
]
30+
},
31+
{
32+
"id": 3,
33+
"name": "Ending Node",
34+
"nodeType": "junction",
35+
"nodeSubType": "junction",
36+
"mapTileMask": [
37+
[1]
38+
]
39+
}
40+
],
41+
"strats": [
42+
{
43+
"link": [1, 2],
44+
"name": "Base",
45+
"requires": [
46+
{"or": [
47+
{"heatFrames": 200},
48+
{"and": [
49+
"canDash",
50+
{"heatFrames": 100}
51+
]}
52+
]}
53+
],
54+
"flashSuitChecked": true,
55+
"blueSuitChecked": true
56+
},
57+
{
58+
"link": [2, 2],
59+
"name": "Heated Crystal Flash",
60+
"requires": [
61+
"h_heatedCrystalFlash"
62+
],
63+
"flashSuitChecked": true,
64+
"blueSuitChecked": true
65+
},
66+
{
67+
"link": [2, 3],
68+
"name": "Base",
69+
"requires": [
70+
{"or": [
71+
{"heatFrames": 80},
72+
{"and": [
73+
"canDash",
74+
{"heatFrames": 40}
75+
]}
76+
]}
77+
],
78+
"flashSuitChecked": true,
79+
"blueSuitChecked": true
80+
}
81+
],
82+
"devNote": [
83+
"This is used to test the effectiveness of all 4 cost metrics."
84+
]
85+
}
Lines changed: 150 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,150 @@
1+
{
2+
"$schema": "../../schema/scenarios.schema.json",
3+
"scenarios": [
4+
{
5+
"name": "Dashless",
6+
"startRoomId": 0,
7+
"startNodeId": 1,
8+
"startState": {
9+
"energy": {"remaining": 99},
10+
"flashSuit": 1,
11+
"blueSuit": 1
12+
},
13+
"endRoomId": 0,
14+
"endNodeId": 3,
15+
"endState": {
16+
"energy": {"remaining": 29},
17+
"flashSuit": 1,
18+
"blueSuit": 1
19+
}
20+
},
21+
{
22+
"name": "Dash",
23+
"startRoomId": 0,
24+
"startNodeId": 1,
25+
"startState": {
26+
"energy": {"remaining": 99},
27+
"flashSuit": 1
28+
},
29+
"endRoomId": 0,
30+
"endNodeId": 3,
31+
"endState": {
32+
"energy": {"remaining": 64},
33+
"flashSuit": 1
34+
}
35+
},
36+
{
37+
"name": "Skip Crystal Flash: Dashless",
38+
"globalState": {
39+
"items": ["Morph"],
40+
"maxMissiles": 10,
41+
"maxSupers": 10,
42+
"maxPowerBombs": 15
43+
},
44+
"startRoomId": 0,
45+
"startNodeId": 1,
46+
"startState": {
47+
"energy": {"remaining": 99},
48+
"missiles": {"remaining": 10},
49+
"supers": {"remaining": 10},
50+
"powerBombs": {"remaining": 11},
51+
"flashSuit": 1,
52+
"blueSuit": 1
53+
},
54+
"endRoomId": 0,
55+
"endNodeId": 3,
56+
"endState": {
57+
"energy": {"remaining": 29},
58+
"missiles": {"remaining": 10},
59+
"supers": {"remaining": 10},
60+
"powerBombs": {"remaining": 11},
61+
"flashSuit": 1,
62+
"blueSuit": 1
63+
}
64+
},
65+
{
66+
"name": "Skip Crystal Flash: Dash",
67+
"globalState": {
68+
"items": ["Morph"],
69+
"maxMissiles": 10,
70+
"maxSupers": 10,
71+
"maxPowerBombs": 15
72+
},
73+
"startRoomId": 0,
74+
"startNodeId": 1,
75+
"startState": {
76+
"energy": {"remaining": 99},
77+
"missiles": {"remaining": 10},
78+
"supers": {"remaining": 10},
79+
"powerBombs": {"remaining": 11},
80+
"flashSuit": 1,
81+
"blueSuit": 1
82+
},
83+
"endRoomId": 0,
84+
"endNodeId": 3,
85+
"endState": {
86+
"energy": {"remaining": 64},
87+
"missiles": {"remaining": 10},
88+
"supers": {"remaining": 10},
89+
"powerBombs": {"remaining": 11},
90+
"flashSuit": 1,
91+
"blueSuit": 0
92+
},
93+
"reverse": "weak"
94+
},
95+
{
96+
"name": "Crystal Flash: Dashless",
97+
"globalState": {
98+
"items": ["Morph"],
99+
"maxMissiles": 10,
100+
"maxSupers": 10,
101+
"maxPowerBombs": 15
102+
},
103+
"startRoomId": 0,
104+
"startNodeId": 1,
105+
"startState": {
106+
"energy": {"remaining": 99},
107+
"missiles": {"remaining": 10},
108+
"supers": {"remaining": 10},
109+
"powerBombs": {"remaining": 11},
110+
"flashSuit": 1,
111+
"blueSuit": 1
112+
},
113+
"endRoomId": 0,
114+
"endNodeId": 3,
115+
"endState": {
116+
"energy": {"remaining": 74},
117+
"flashSuit": 0,
118+
"blueSuit": 1
119+
},
120+
"reverse": "weak"
121+
},
122+
{
123+
"name": "Crystal Flash: Dash",
124+
"globalState": {
125+
"items": ["Morph"],
126+
"maxMissiles": 10,
127+
"maxSupers": 10,
128+
"maxPowerBombs": 15
129+
},
130+
"startRoomId": 0,
131+
"startNodeId": 1,
132+
"startState": {
133+
"energy": {"remaining": 99},
134+
"missiles": {"remaining": 10},
135+
"supers": {"remaining": 10},
136+
"powerBombs": {"remaining": 11},
137+
"flashSuit": 1,
138+
"blueSuit": 1
139+
},
140+
"endRoomId": 0,
141+
"endNodeId": 3,
142+
"endState": {
143+
"energy": {"remaining": 84},
144+
"flashSuit": 0,
145+
"blueSuit": 0
146+
},
147+
"reverse": "weak"
148+
}
149+
]
150+
}

visualizer/script.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ function updateDebugData() {
311311
}
312312
let costMetric = parseInt(document.getElementById("debugCostMetric").value);
313313
let historyIndex = parseInt(document.getElementById("debugHistoryIndex").value);
314-
if (costMetric < 0 || costMetric > 4) {
314+
if (costMetric < 0 || costMetric > 3) {
315315
return;
316316
}
317317

0 commit comments

Comments
 (0)