Code RoomCollision detection AI spec constraints
MediumPrep Room Coding #3981

Collision detection AI spec constraints

Vibe & agenticAlgorithms & data structuresMid–Senior~18 min

You're building a 2D spatial-hash collision system in C++ for a game's update loop and want an AI agent to write it. Write the spec so the result is correct AND fast enough for a 60fps loop. What performance and correctness constraints must you pin down, and what does a generic 'write a collision detection function' prompt get wrong?

Implement
find_collision_pairs(min_xs: list[int], min_ys: list[int], max_xs: list[int], max_ys: list[int], cell_size: int) → list[list[int]]
Examples
in[[0,5],[0,5],[10,15],[10,15],16]out[[0,1]]
in[[0,20],[0,0],[5,25],[5,5],100]out[]
in[[-5,-3],[-5,-3],[-1,3],[-1,3],4]out[[0,1]]
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 18 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.