2048-lite
Spike of a small nanopy helper that absorbs the bridge ceremony — DOM lookup, canvas property writes, the integer LCG, the keyboard dispatch, the localStorage try/except — so the game's main.py reads as Python about 2048. Comparable to Snake, whose main.py duplicates all of that scaffolding inline.
Loading…
Arrow keys or WASD to slide. R to restart.
What lives where
Compared to Snake's main.py: the slide-and-merge logic stays in main.py as ordinary Python — that part never touched the bridge. What moves into nanopy.py (81 code-lines, paid once): the _g / _set_text / _set_status wrappers, the 16-bit LCG, the ctx.set("fillStyle", X) property-write idiom (now canvas["fillStyle"] = X), the js.window.set("__gFoo", on_foo) dispatch registrations (now @on_key("ArrowLeft")), and the localStorage try/except dance (now storage.get_int / set_int).
Aspirational shape of main.py after Tier 2 #5 (__setattr__ on nano, deferred from v0.6.0): canvas["fillStyle"] = BG becomes canvas.fillStyle = BG. The helper rewrites trivially; the game code doesn't.