Code Room
Vibe codingHard
Question
An AI assistant hand-rolled the main loop for a C++ engine using a fixed-timestep accumulator. On fast machines it's smooth, but on a slow laptop the game enters a death spiral and freezes once physics gets expensive. Review the loop and explain the failure mode.
while (running) { double now = Clock(); double frameTime = now - last; last = now; accumulator += frameTime; while (accumulator >= FIXED_DT) { Physics::Step(FIXED_DT); // can itself take longer than FIXED_DT accumulator -= FIXED_DT; } Render(accumulator / FIXED_DT);}What a strong answer looks like
Treat the AI’s output as a draft to verify, not an answer to trust. Name the specific flaw and the input that triggers it, say how you’d catch it — tests, edge cases, reading critically — and how you’d re-prompt or decompose to get it right.
Learn the concepts
Vibe coding: describe the solution in plain language (or narrate it) and the coach grades your approach. Generating runnable code from your description is coming next.
Run or narrate your approach, then ask the coach.