Circle on a Canvas: An AI Story
I wanted the circle to touch the right hand of the rectangle:
I was feeling lazy, so I asked Claude to solve the issue for me, and then I spent a fascinating hour watching it fail.
The problem is simple for humans to solve. The canvas is 150 pixels wide. The circle has a radius of 20 pixels, and marches to the right at a rate of 1 radius per re-draw. 150 cannot be divided equally by 20, so the circle never touches the right hand side.
Why couldn't Claude see the issue? That's the problem that I've been wondering about since then. I'm just a casual user of these tools, not an AI expert, but I see a few potential reasons:
- The canvas element contains its own width; the code that draws on the canvas is defined elsewhere. It could be that Claude had trouble relating the width element from the canvas to the width of the circle.
- Canvas involves spatial reasoning. Claude's generating predictive patterns, not reasoning about anything. This issue's easy for humans who can hold shapes in our minds, but Claude has to have been exposed to training data asking similar questions, it can't reason from basic geometry. Unfortunately, I think SpaRC and SpaRP: Spatial Reasoning Characterization and Path Generation for Understanding Spatial Reasoning Capability of Large Language Models may discredit this explanation.
I mostly think that trying to understand this issue shows me that these tools are damn hard to understand and figure out. A bit of research will get you past a lot of supposedly "hard" problems in software, like understanding machine language or most sorting algorithms or whatever, but these are genuinely hard tools to get to grips with.