kflorence / beaming

Beaming is a free, open source puzzle game that involves directing beams through a hexagonal grid.
https://kflorence.github.io/beaming/
Other
1 stars 0 forks source link

Handle infinite loops gracefully. Fixes #3 #7

Closed kflorence closed 10 months ago

kflorence commented 10 months ago

The primary change that addresses the issue in #3 is that the beam update loop now happens asynchronously via setTimeout -- this allows the UI to update in between loops. Previously, it looped forever and the UI (and browser) would become unresponsive. The UI will now correctly show the beams colliding and updating as the infinite loop occurs, and the UI can still be interacted with, allowing users to make a move to break out of the loop.

This PR also contains a lot of other cleanup that was done as part of a larger refactoring which was eventually removed in favor of this simpler fix.