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
Imposter: Home keeps a name being typed, and the computer build in the tests
Mason3638daae0984bfe
diff --git a/games/imposter/src/ui.c b/games/imposter/src/ui.cindex 2ae5c4c5..05ea150b 100644--- a/games/imposter/src/ui.c+++ b/games/imposter/src/ui.c@@ -814,6 +814,7 @@ bool app_step(uint32_t keys, uint32_t letters, uint32_t now) {uint32_t dt = now - u.now;u.now = now;if (keys & KB_HOME) {+ if (u.screen == SC_NAME) name_done(false); /* (the name typed so far, kept as Back keeps it) */game_save();return false;}diff --git a/games/imposter/tests/check.py b/games/imposter/tests/check.pyindex 7da22e39..1ebdb6fd 100644--- a/games/imposter/tests/check.py+++ b/games/imposter/tests/check.py@@ -190,6 +190,9 @@ st = state(out)check(st and st["names"] == ["Ana", "Bo"], "a player removed after the question: %s" % (st and st["names"]))out, _ = walk("ok")check(out.strip().splitlines()[-2].startswith("DRAW players"), "Start with 2 players opens Players")+out, _ = walk("ok ok " + typed("zoe") + " home")+st = state(out)+check(st and st["names"] == ["Ana", "Bo", "Zoe"], "Home while typing a name keeps it: %s" % (st and st["names"]))# ---- the rules: a word comes again only once its category has run outPLAYERS = "Ann,Bob,Cal,Dee"@@ -301,6 +304,29 @@ reached = sum("phase 3" in o or "phase 2" in o or "phase 1" in o for o in outs)check(not [f for f in failed if "crashed" in f], "%d random-key runs (%d sessions, %d with rounds): no crash" %(FUZZ, sessions, reached))+# ---- the computer build (make port TARGET=sdl), if it's there: a whole round on the screen's letters+SDL = os.path.join(os.path.dirname(PLAY), "sdl", "imposter")+if os.path.exists(SDL):+ d = os.path.join(WORK, "sdl")+ os.makedirs(d)+ t, keys = 400, []+ for k in "ok ok ok ok exe right ok exe down down ok exe back back ok".split() + ["ok", "w", "ok", "w"] * 3 + \+ ["ok", "ok"]:+ if k == "w":+ t += 400+ continue+ keys.append("%d-%d:%s" % (t, t + 90, k))+ t += 300+ env = dict(os.environ, NP_HEADLESS="1", NP_SAVES=d, NP_KEYS=",".join(keys), NP_QUIT_MS=str(t + 300),+ NP_SHOTS="%d:%s/reveal.ppm" % (t + 100, d))+ r = subprocess.run([SDL], env=env, capture_output=True, text=True, timeout=120)+ store = open(os.path.join(d, "imposter.files"), "rb").read() if os.path.exists(os.path.join(d, "imposter.files")) else b""+ ok = r.returncode == 0 and os.path.exists(os.path.join(d, "reveal.ppm")) and b"imposter.sav" in store+ if ok:+ r2, g2, b2 = pixel(os.path.join(d, "reveal.ppm"), 4, 120)+ ok = b2 > r2 # (the reveal's indigo, not a role's red)+ check(ok, "the computer build plays a round to the reveal and keeps its save")+shutil.rmtree(WORK, ignore_errors=True)if failed:print("\n%d FAILED" % len(failed))