nanopython  /  snake-lite

Snake-lite

Kid-style demo of the nanopy library. No classes, no decorators — just module-level functions (update, draw, on_press) and one call to nanopy.run(...) at the bottom of the file. Pygame-shaped, modulo the event-driven web loop.

Companion to 2048-lite (pro-style: classes + decorators). Both share web/lib/nanopy.py via symlink.

Loading…

Score0
High0

Arrow keys or WASD to steer. R to restart.

How simple is "kid-simple"?

The whole game logic is at module scope. Game state lives in global variables (snake, dx, dy, apple, score). The drawing routine reads as a sequence of screen.fill / screen.rect / screen.text calls. No class hierarchy, no decorators, no setInterval handle to manage. The bottom of the file is one line: nanopy.run(update=update, draw=draw, on_press=on_press, fps=7).