Skip to content

Free games for graphing calculators: NumWorks, TI-Nspire CX, Casio fx-CG50 and soon TI-84 Plus CE. Balatro, Celeste, Hollow Knight, Minecraft and more.

Level Devil: script steps in order, keys for 75 rooms

Mason3638678b2c806cc
diff --git a/games/leveldevil/tests/play.c b/games/leveldevil/tests/play.c
index 8d39fa10..a6a40fd5 100644
--- a/games/leveldevil/tests/play.c
+++ b/games/leveldevil/tests/play.c
@@ -301,6 +301,10 @@ int main(int argc, char **argv) {
exact = getenv("PLAY_EXACT") || (argc <= 4 && walk[i]);
int got = play(argc > 4 ? argv[4] : solutions[i], 0, getenv("PLAY_EVERY") ? atoi(getenv("PLAY_EVERY")) : 4);
fprintf(stderr, "%d events set off\n", events_set_off());
+ if (getenv("PLAY_OBJS"))
+ for (int k = 0; k < no; k++)
+ fprintf(stderr, "%d: kind %d flags %d at %d,%d size %d,%d\n", k, ob[k].kind & 15, ob[k].f, (int)(ob[k].x >> 8),
+ (int)(ob[k].y >> 8), ob[k].w / 16, ob[k].h / 16);
printf("%d\n", got);
return 0;
}
diff --git a/games/leveldevil/tests/solutions.txt b/games/leveldevil/tests/solutions.txt
index 43a0e5b1..8dc297ae 100644
--- a/games/leveldevil/tests/solutions.txt
+++ b/games/leveldevil/tests/solutions.txt
@@ -47,7 +47,7 @@
9-5: R16 N4 L4 R52 J4 R12 N28 L4 J4 L4 R12 N12 J4 N16 R4 N4 R32
10-1: R88 RJ4 R28 RJ4 R24
10-2: R20 L4 N4 J4 N4 L52 LJ4 L20 LJ4 L28 LJ4 R4 L12 N4 L4 J4 L16 N4 L4 N4 L8 LJ4 N4 L4 N8 L12 LJ4 N4 L4 N8 L4 N4 L4 LJ4 L4 N248 R4
-10-3~ R24 L8 N328
+10-3: N18 R142 L256 R256 L256 R110 RJ4 R200
10-4: R72 RJ4 R4 N4 R20 L4 N8 R4 L16 N36 L4 R4 N8 R4 N8 R4 N4 R12 N16 R4 N8 R4 N4 R4 N8 R12 N8 L4 R8 N8 R8 N4 L4 R12 N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 L772
+16-5: R68 N12 R12 RJ4 R36 RJ4 R240 L772
diff --git a/games/leveldevil/tools/rooms.py b/games/leveldevil/tools/rooms.py
index 7cd9f9f0..c728fc7d 100644
--- a/games/leveldevil/tools/rooms.py
+++ b/games/leveldevil/tools/rooms.py
@@ -372,8 +372,10 @@ class Room:
# the steps: those alike on objects one after the other, at the same time or at times along x
groups = {}
order = []
+ seq = {} # (at the same time, the steps go in the script's order)
for ev in evs:
- for op in self.events[ev]:
+ for i, op in enumerate(self.events[ev]):
+ seq[id(op)] = i
key = (ev, op.code, op.cond, ref(op.a), ref(op.b), ref(op.c))
if key not in groups:
groups[key] = []
@@ -404,9 +406,11 @@ class Room:
if n == 1:
k = 0
a, b, c = (v.index if isinstance(v, Obj) else v for v in (p.a, p.b, p.c))
- recs.append((key[0], frames(p.t), p.code, NOBODY if p.obj is None else p.obj.index, n, key[2], a, b, c, k))
+ recs.append((key[0], frames(p.t), p.code, NOBODY if p.obj is None else p.obj.index, n, key[2], a, b, c, k,
+ seq[id(p)]))
i = j
- recs.sort(key=lambda r: (r[0], r[1]))
+ recs.sort(key=lambda r: (r[0], r[1], r[-1]))
+ recs = [r[:-1] for r in recs]
self.expanded = sum(r[4] for r in recs)
assert len(recs) < 256 and self.expanded <= 240, (self.name, len(recs), self.expanded)
return span_rec, recs