Observation
main.py's render loop is uncapped. Every iteration re-fills the surface, re-draws the
whole environment and calls pygame.display.update(), with nothing limiting how often
that happens:
while window.should_continue():
...
gameDisplay.fill(white)
drawEnvironment(locationsCache, graphik, locationWidth, locationHeight)
pygame.display.update()
RenderWindow already exposes tick(fps) for exactly this purpose, and it is not
called from anywhere in the repository.
Because drawEnvironment chooses a fresh random colour per location on every call:
red = random.randrange(50, 200)
green = random.randrange(50, 200)
blue = random.randrange(50, 200)
the visualization also re-randomizes as fast as the machine can redraw, rather than
presenting a stable image.
Suggested change
- Call
window.tick(60) (or another chosen frame rate) at the end of the loop body so
the loop stops consuming a whole CPU core.
- Separately, decide whether the per-location colour is meant to be stable. If it is,
the colours should be computed once — for example when locationsCache is populated
— rather than on every frame.
The two are related but separable: the frame-rate cap is a small change confined to the
loop, whereas making colours stable changes what the tool actually displays and should
be confirmed against the intended behavior first.
Scope note
This touches the live render loop, so the project's live-Viron manual-validation anchor
is expected to be required.
This issue body was drafted during a Gardener session (https://github.com/Stephenson-Software/gardener).
drafted by Claude on behalf of Daniel Stephenson
Observation
main.py's render loop is uncapped. Every iteration re-fills the surface, re-draws thewhole environment and calls
pygame.display.update(), with nothing limiting how oftenthat happens:
RenderWindowalready exposestick(fps)for exactly this purpose, and it is notcalled from anywhere in the repository.
Because
drawEnvironmentchooses a fresh random colour per location on every call:the visualization also re-randomizes as fast as the machine can redraw, rather than
presenting a stable image.
Suggested change
window.tick(60)(or another chosen frame rate) at the end of the loop body sothe loop stops consuming a whole CPU core.
the colours should be computed once — for example when
locationsCacheis populated— rather than on every frame.
The two are related but separable: the frame-rate cap is a small change confined to the
loop, whereas making colours stable changes what the tool actually displays and should
be confirmed against the intended behavior first.
Scope note
This touches the live render loop, so the project's live-Viron manual-validation anchor
is expected to be required.
This issue body was drafted during a Gardener session (https://github.com/Stephenson-Software/gardener).
drafted by Claude on behalf of Daniel Stephenson