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.
C calculatorcalculator-gamescasiochesscrossy-roaddrive-madfx-cg50gamesgeometry-dashgraphing-calculatorndlessnumworksnumworks-appsnumworks-calculatornumworks-gamenumworks-gamestetristi-84-plus-ceti-nspire
Level Devil: tested on the emulator, springs at full height
Mason36311270d610701
diff --git a/games/leveldevil/src/main.c b/games/leveldevil/src/main.cindex 6e913c81..73cf3645 100644--- a/games/leveldevil/src/main.c+++ b/games/leveldevil/src/main.c@@ -120,7 +120,7 @@ static color_t strip[SCREEN_W * STRIP_H];static const uint8_t *room;static int level, rnum, tries, mode, scr, ov, sel, banner, dlo, dhi, full;static int32_t px, py, vx, vy; /* the runner: its box's top-left and its speed, in 256ths of a pixel */-static int face = 1, ground, coyote, buffer, held_in, anim, dead, won, warped, curtain;+static int face = 1, ground, coyote, buffer, held_in, anim, dead, won, warped, curtain, sprung;static uint32_t found, seed, banner_t, now;static const obj_t *skip_ob; /* left out of collisions (a block pushing the runner) */static color_t bg, fg;@@ -223,7 +223,7 @@ static void mark(int y, int h) { /* rows y to y + h (game pixels) to draw againstatic void reset(void) { /* the room as it starts, the runner at the start */const uint8_t *p = room;mode = p[0], px = p[1] * 256, py = (p[2] - PH) * 256, vx = vy = 0;- ground = coyote = buffer = dead = won = warped = 0, face = 1;+ ground = coyote = buffer = dead = won = warped = sprung = 0, face = 1;int n = p[3];no = 0, p += 4;for (int i = 0; i < n; i++) {@@ -359,7 +359,7 @@ static void contacts(void) {int c = b[2] / 2, cx = b[0] + c, cy = b[1] + c, dx = cx - clampi(cx, x, x + PW - 1), dy = cy - clampi(cy, y, y + PH - 1);if (dx * dx + dy * dy < (c - 1) * (c - 1)) die();} else if (kind == K_SPRING) {- if (overlap(x, y + PH - 1, PW, 2, b) && vy * g >= 0) vy = -g * SPRING, o->t = 236, ground = 0;+ if (overlap(x, y + PH - 1, PW, 2, b) && vy * g >= 0) vy = -g * SPRING, o->t = 236, ground = 0, sprung = 1;} else if (kind == K_WARP) {int e[4] = {o->r[3], o->r[4], 8, 12}, a = overlap(x, y, PW, PH, b), z = overlap(x, y, PW, PH, e);if ((a || z) && !warped) {@@ -400,7 +400,8 @@ static void step(int in) {if (dir) vx = clampi(vx + dir * acc, -RUN, RUN), face = dir;else vx = vx > dec ? vx - dec : vx < -dec ? vx + dec : 0;if (buffer && (buffer--, coyote || mode & R_AIR)) vy = -g * JUMP, buffer = coyote = 0;- vy += g * (vy * g < 0 && !(in & I_JUMP) ? 3 * GRAV : GRAV);+ sprung &= vy * g < 0; /* (a spring's lift isn't cut short like a jump let go) */+ vy += g * (vy * g < 0 && !(in & I_JUMP) && !sprung ? 3 * GRAV : GRAV);if (vy * g > FALL) vy = g * FALL;if (move(&px, vx, 0)) vx = 0;if (move(&py, vy, 1)) vy = 0;diff --git a/games/leveldevil/tests/play.c b/games/leveldevil/tests/play.cindex 3daefca2..776e9a9f 100644--- a/games/leveldevil/tests/play.c+++ b/games/leveldevil/tests/play.c@@ -121,20 +121,20 @@ static int run(const char *s, const char *film) {as it starts, through states not seen yet, the nearest to the door first */typedef struct {obj_t ob[28];- int no, face, ground, coyote, buffer, held_in, anim, mode, warped;+ int no, face, ground, coyote, buffer, held_in, anim, mode, warped, sprung;int32_t px, py, vx, vy;uint32_t found;} snap_t;static void take(snap_t *s) {memcpy(s->ob, ob, sizeof ob);s->no = no, s->face = face, s->ground = ground, s->coyote = coyote, s->buffer = buffer, s->held_in = held_in;- s->anim = anim, s->mode = mode, s->warped = warped, s->px = px, s->py = py, s->vx = vx, s->vy = vy;+ s->anim = anim, s->mode = mode, s->warped = warped, s->sprung = sprung, s->px = px, s->py = py, s->vx = vx, s->vy = vy;s->found = found;}static void give(const snap_t *s) {memcpy(ob, s->ob, sizeof ob);no = s->no, face = s->face, ground = s->ground, coyote = s->coyote, buffer = s->buffer, held_in = s->held_in;- anim = s->anim, mode = s->mode, warped = s->warped, px = s->px, py = s->py, vx = s->vx, vy = s->vy;+ anim = s->anim, mode = s->mode, warped = s->warped, sprung = s->sprung, px = s->px, py = s->py, vx = s->vx, vy = s->vy;found = s->found, dead = won = 0;}static uint64_t key_of(void) { /* the state, roughly: the runner and every object */diff --git a/games/leveldevil/tests/solutions.txt b/games/leveldevil/tests/solutions.txtindex c5d8f451..101e33bf 100644--- a/games/leveldevil/tests/solutions.txt+++ b/games/leveldevil/tests/solutions.txt@@ -12,7 +12,7 @@2-5: R96 RJ4 R203-1: R52 RJ12 R20 RJ4 R323-2: R56 RJ8 R44-3-3: R60 RJ4 R56+3-3: R60 RJ4 R4 RJ4 N4 L4 R523-4: R40 RJ4 R32 RJ8 R12 RJ4 R203-5: R40 RJ4 R32 RJ8 R12 RJ4 R204-1: R68 RJ4 L4 LJ8 L12 LJ8 N4 L32@@ -31,7 +31,7 @@6-4: R24 RJ4 R56 RJ4 R8 RJ4 R206-5: R16 RJ4 R20 RJ4 R20 LJ4 R8 N8 R12 RJ16 R8 RJ4 R87-1: RJ8 J4 RJ4 R4 RJ4 R4 RJ16 R4 L4 RJ24 R44-7-2: R68 RJ4 R48+7-2: R52 RJ4 R647-3: R24 RJ8 R20 L8 RJ8 R20 N12 R4 RJ4 R287-4: RJ12 R12 J4 RJ12 R8 RJ16 R4 RJ28 R247-5: RJ4 R12 RJ8 J4 R8 N4 RJ20 R16 RJ8 R36diff --git a/games/leveldevil/tools/rooms.py b/games/leveldevil/tools/rooms.pyindex 74853fda..e73618f8 100644--- a/games/leveldevil/tools/rooms.py+++ b/games/leveldevil/tools/rooms.py@@ -162,7 +162,7 @@ room([floor(0, 70), floor(80, 80), block(86, 100, 8, 20, trap=trap(RIGHT, 64, ONroom([floor(0, 160), block(148, 86, 12, 14, trap=trap(RIGHT, 40, ONCE, dx=-110, speed=1.5)), door(128)])# a wall comes down from the ceiling, low enough to walk under but not to jump; then a crusherroom([floor(0, 160), block(66, 10, 14, 60, trap=trap(RIGHT, 50, ONCE, dy=22, speed=3)),- block(100, 10, 14, 30, trap=trap(RIGHT, 76, LOOP, dy=60, speed=3)), door(DOOR_X)])+ block(100, 10, 14, 30, trap=trap(RIGHT, 86, LOOP, dy=60, speed=3)), door(DOOR_X)])# the ceiling comes down on the whole room: hurryroom([floor(0, 160), block(4, 10, 152, 10, trap=trap(RIGHT, 20, ONCE, dy=78, speed=0.5)), spikes(60, 95, 2),spikes(100, 95, 3), door(DOOR_X)])@@ -220,7 +220,7 @@ room([floor(0, 30), block(34, 112, 106, 8), spikes(34, 107, 21)]# ------------------------------------------------------------------ 7: springsroom([floor(0, 160), spring(60), block(100, 58, 56, 42), door(140, y=38)])# a spring comes out under the runner, into the spikes on the ceiling-room([floor(0, 160), spring(70, flags=HIDDEN, trap=trap(RIGHT, 72)), block(56, 10, 40, 30), spikes(56, 40, 8, "d"),+room([floor(0, 160), spring(70, flags=HIDDEN, trap=trap(RIGHT, 72)), block(56, 10, 40, 36), spikes(56, 46, 8, "d"),door(DOOR_X)])# from spring to spring over the spikesroom([floor(0, 40), block(40, 108, 80, 12), spikes(40, 103, 16), block(62, 96, 10, 12), spring(63, y=93),diff --git a/tests/test_games.py b/tests/test_games.pyindex 6a9692dd..2d2790ae 100644--- a/tests/test_games.py+++ b/tests/test_games.py@@ -86,6 +86,10 @@ GAMES = {# new game from the pause menu and its first square"minesweeper": ("Minesweeper.nwa", "mines.sav", presses((1500, "ok"), (2000, "ok"), (2400, "right")), 3000,presses((1500, "ok"), (2000, "back"), (2300, "down"), (2600, "ok"), (3000, "ok")), 3600),+ # past the keys, the first door: the runner runs right into the first trap, and again; next time the+ # first door again (the keys not shown), and more deaths+ "leveldevil": ("LevelDevil.nwa", "leveldevil.sav", presses((1500, "ok"), (2000, "ok"), (3000, "right", 4000)), 8000,+ presses((1500, "ok"), (2500, "right", 3000)), 6500),# Play, serve, a brick or more: the best is kept; next time, Settings, screen shake off, back"breakout": ("BlockBreaker.nwa", "breakout.sav", presses((1500, "ok"), (2500, "ok")), 6000,presses((1500, "down"), (1800, "ok"), (2100, "down"), (2400, "ok"), (2800, "back")), 4000),@@ -224,6 +228,9 @@ CHECKS = {"blockblast": (lambda v: len(v) == 92 and v[:3] == b"B\1\3" and struct.unpack_from("<I", v, 12)[0] >= 1and struct.unpack_from("<I", v, 8)[0] >= struct.unpack_from("<I", v, 12)[0],lambda v: v[2] & 1 and struct.unpack_from("<I", v, 12)[0] >= 2),+ # the keys were shown and the runner died (the deaths at 8); then died again+ "leveldevil": (lambda v: len(v) == 48 and v[:2] == b"L\1" and v[2] & 1 and struct.unpack_from("<I", v, 8)[0] >= 1,+ lambda v: struct.unpack_from("<I", v, 8)[0] >= 2),"breakout": (lambda v: len(v) == 12 and v[:2] == b"B\2" and v[4] == 1 and struct.unpack_from("<I", v, 8)[0] >= 10,lambda v: v[4] == 0 and struct.unpack_from("<I", v, 8)[0] >= 1), # best kept, shake off}