Play Notebook Marimo Globals¶
The Harvest, Territory, and Chemistry play_mo.py notebooks keep their
interactive pygame loop in a single marimo cell. marimo still treats top-level
imports and helper definitions inside a cell as notebook-level names, so generic
helpers such as blit_frame and build_keymap can trip "redefines variables
from other cells" errors when a notebook is edited or split.
The play notebooks avoid that by:
- importing shared rendering modules under domain-specific aliases, e.g.
harvest_rgb_rendererinstead of bindingblit_framedirectly; - giving local helpers domain-specific names, e.g.
build_territory_keymap; - keeping mutable pygame toggles in a small
runtime_statedict instead of usingnonlocalfrom notebook cell scope.
After touching these files, run: