Solving Old-Time Problems with New Solutions
If for some reason you have difficulties solving puzzles by yourself, you can leverage AI to do that.
Consider this scenario: you have a large image and a small missing piece that belongs somewhere inside it — your goal is to figure out exactly how many pixels you need to drag that piece to make it fit perfectly.
Most frontier LLMs support image input, but they struggle to reason about precise pixel offsets. To work around this limitation, we can leverage one of the oldest concepts in a developer’s toolkit: binary search.
The idea is elegantly simple. We ask an LLM a single question: should the piece move left or right to align with its gap? To make this as easy as possible for the model, we strip away colors and paint both the piece and the gap in distinct, high-contrast colors so the distinction is immediately obvious. After each iteration, we repaint the image with the piece in its new position, while halving the step size — allowing the algorithm to converge on the correct placement.

You can find the source code here.