# Design ## Context Input, placement, HiDPI, and grid are implemented. Simulation state (`sim_paused`, `ACTION_PAUSE`, `ACTION_STEP`, speed actions) exists but is unused. See proposal.md. ## Goals / Non-Goals **Goals:** - Conway tick loop with adjustable interval. - Pause/resume, stepping, speed control. - Paused-only cell editing via mouse, including drag painting. **Non-Goals:** - Pattern detection or statistics. - Undo/redo. - Multi-threading. ## Decisions ### D1: Tick timing - Use monotonic clock in the frame loop; accumulate elapsed time; when >= interval, compute next generation and reset accumulator. ### D2: Next generation buffer - Allocate a second grid buffer; compute into it, then swap pointers (or copy). Prefer swap of `cells` pointers with size unchanged. ### D3: Editing while paused - Pointer button handler sets/clears cells if `sim_paused`; drag paints using motion events while button held. ### D4: Speed bounds - Interval range 0.05s..1.0s (20 tps..1 tps), step factor 2. ### D5: Default bindings - Add `p`, `n`, `+`/`-` to default config (merge). ## Risks / Trade-offs - [Tick cost on large grids] -> grid is small (50x50), fine. - [Editing during tick race] -> editing only while paused avoids races. ## Open Questions None.