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
#!/usr/bin/env python3
"""How fast Snow Rider 3D draws a ride at an N0110's speed (../../tools/emu.py): bench.py build/bench/snowrider.nwa
[SECONDS] [PICTURES_DIR] (make bench). The timing build (EXTRA=-DSR_BENCH) takes two game steps a drawing and steers
with the autopilot of tests/auto.h, so every build draws the same frames; the sled goes through everything. Prints
the drawing's and the steps' milliseconds from 8 s on, and the frame rate they make while riding."""
import os
import struct
import sys
sys.path.insert(0, os.path.join(os.path.dirname(os.path.abspath(__file__)), "..", "..", "..", "tools"))
import emu # noqa: E402
nwa = sys.argv[1]
secs = int(sys.argv[2]) if len(sys.argv) > 2 else 40
shots = sys.argv[3] if len(sys.argv) > 3 else None
emu.configure("n0110")
c = emu.Calculator(nwa)
c.keys = emu.parse_keys("500-600:ok,1500-1600:ok,2500-2600:ok,3500-3600:ok")
def rd(name):
return struct.unpack("<I", bytes(c.uc.mem_read(c.symbols[name], 4)))[0]
c.run(100)
c.uc.mem_write(c.symbols["host_god"], struct.pack("<I", 1))
c.run(8000)
f0, d0, s0 = rd("perf_frames"), rd("perf_draw"), rd("perf_step")
for t in range(12000, secs * 1000 + 1, 6000):
c.run(t)
if shots:
os.makedirs(shots, exist_ok=True)
c.save_png(os.path.join(shots, f"t{t // 1000:02d}.png"))
c.run(secs * 1000)
n = rd("perf_frames") - f0
draw, step = (rd("perf_draw") - d0) / max(n, 1), (rd("perf_step") - s0) / max(2 * n, 1)
print(f"{n} frames: drawing {draw:.2f} ms a frame, a step {step:.2f} ms; riding at about {(1000 - 60 * step) / draw:.1f} "
f"frames a second; slowest drawing {rd('perf_max')} ms, {rd('perf_slow')} over 33 ms")