Code RoomObject pool state not reset
MediumPrep Room Coding #4297

Object pool state not reset

Vibe & agenticAlgorithms & data structuresMid–Senior~16 min

To avoid GC spikes from spawning bullets, an AI assistant wrote this Unity (C#) object pool. After a few minutes of play, bullets start appearing pre-damaged, flying in stale directions, or already 'dead.' Review the pool and find the reuse bug.

Implement
simulate_bullet_pool(commands: list[list[int]], slot_count: int) → list[list[int]]
Examples
in[[[0,0,0],[1,0,3],[2,0,0]],2]out[[0,3]]
in[[[0,0,0],[1,0,3],[2,0,0],[0,0,0],[1,0,1],[2,0,0]],2]out[[0,3],[0,1]]
in[[[0,0,0],[0,1,0],[1,0,2],[1,1,5],[2,1,0],[2,0,0]],2]out[[1,5],[0,2]]
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 16 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.