When implementing a cursor for a game controller, it can be quite troublesome if the puzzle has a large number of parts that move freely.
So we thought we’d make it so that the cursor would automatically move to the center of the part and then move it with the directional keys. However, the parts aren’t just arranged in a grid pattern up, down, left, and right, so if player want to move to the right, for example, program have to find the nearest part in that direction.
For coding, we decided to have them try Gemini again. First, we listed the necessary specifications, such as puzzle parts configuration, screen coordinate management, optimal destination search, and search efficiency. Then we listed function specifications for subsequent use, such as initialization, search, and updating by moving puzzle parts. Finally, we added a thorough emphasis on quality and efficiency, creating a prompt of around 30 lines.
We had them create this in Gemini3’s thinking mode and then did a code review. Since the search was performed on all parts every time, we requested the addition of efficient search, assuming there were thousands of parts. In response, Gemini added a culling feature that divides the screen into a certain size and first searches only for parts roughly in the desired direction within each division.
We immediately implemented it in the app. At first it didn’t work well, but we found that it was possible to specify the parameters for the vector calculation used in the search, so by adjusting these values we were able to move the cursor in the desired direction.