Code RoomFixed timestep death spiral
HardPrep Room Coding #4301

Fixed timestep death spiral

Vibe & agenticAlgorithms & data structuresSenior–Staff~19 min

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.

Implement
simulate_fixed_steps(frame_times_ms: list[int], fixed_dt_ms: int, max_frame_ms: int, max_steps_per_frame: int) → list[int]
Examples
in[[16,16,16],16,250,5]out[1,1,1]
in[[1000],16,250,5]out[5]
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.

0:00 of about 19 min

Vibe & agentic: describe the solution in plain language (or narrate it) and the coach grades your approach.

Which questions mattered is sealed until you submit. Telling you now would just be handing over the edge cases.