About a week ago, I published how to get AI to develop a 2048 game emulator. See here for that post.
That was fun, but you know what would be more fun? Having a simulator that can try various sequences and heuristics to solve the 2048 game. Yes, I did that – again with AI.
The playground is here. I utilized Github Copilot via VSCode and settled eventually on Claude Sonnet 4 as it seemed to iterate and test the changes it was making more so than the others.
There were quite a few learnings in this:
- AI is a bit like human developers- the code just increases in complexity and requires sporadic re-factoring. That re-factoring is still human-based intuition and not part of the AI itself.
- Just like it won’t intuitively determine when re-factoring is needed, it also won’t prune / clean temp files or backups itself either. With a few iterations, the AI decided to make backups as the changes were more extensive – those backups ended up being included for a few commits. (I did notice this behavior changed half-way through the project, so maybe this is fixed now).
- When there are extensive changes based on the prompt, there is no warning, and there are sometimes avoidable errors. Missing curly bracket or messing up the UI layout was a common occurrence.
- When I came up against blockers (like finding the right heuristic or fixing the missing UI component) a straight up ask to the AI helped quite a bit. Though the documentation it created was also overly optimistic (claiming up to a 90% success rate).
- Kids are a really good testing group. With their feedback, I implemented mobile device support, descriptions about the heuristics, and made the UI a bit more friendly.
This was such a fun project, and I admit – I keep finding tweaks to make.
If you’re interested in the solution (which heuristic or sequence solves 2048 the most), I suggest you check out the stared heuristics in the playground!
Leave a comment