I built a game by hand. Then I asked AI to review it.

One snake game, two versions. Version 1 is my hand-built original, with no AI involved, bugs and all. Version 2 is the result of an AI code review that I directed, checked and approved. Play both and see what changed.

Play Version 1 Hand-built Play Version 2 AI-reviewed

Why AI code is “almost right, but not quite”

AI coding tools are everywhere: 84% of developers in Stack Overflow's 2025 survey use them or plan to. But more of those developers distrust the accuracy of what the tools produce (46%) than trust it (33%), and their biggest frustration, named by 66%, is code that's “almost right, but not quite”. That gap is expensive, and hard to see from the inside. In a randomised trial by METR, experienced open-source developers took 19% longer to finish tasks when they used AI, while believing it had made them about 20% faster.

It isn't only about speed. Veracode tested more than 100 AI models and found they chose an insecure way of writing code 45% of the time. And GitClear's analysis of 211 million changed lines found that copy-pasted code now outstrips code that's been tidied up and reused, for the first time. The common thread is unchecked output: code produced quickly and accepted without enough scrutiny. This project flips that around. I wrote the code, used AI to scrutinise it, and checked every finding myself.

AI didn't write this game. It read it.

Most talk about AI and code is about writing more of it, faster. I think the more useful skill is the opposite: using AI to read code you already have, find what you missed, and fix it without losing what made it yours. The engineer's job moves from typing to judgement.

  1. Build me

    I designed and hand-coded the game: grid, obstacles, food, growth and auto-move.

  2. Review AI

    I asked Claude to check the logic. It traced each code path and reported 6 bugs, ranked by impact.

  3. Decide me

    I read the findings and chose what to fix, and kept Version 1's bugs in place for comparison.

  4. Fix & test AI

    It rewrote the game logic and tested it in a simulated browser, including 1,000 random games.

  5. Own it me

    I play it, check it and ship it. The judgement, and the result, are still mine.

Six bugs I'd never noticed

Every one of these is still in Version 1. Most hide in edge cases you'd only hit by luck, which is exactly why a second pair of eyes helps.

  1. Game-breaking

    The game could start already lost

    Obstacles were placed at random, sometimes right in front of the snake. It crashed on the first move, restarted in the same spot and crashed again, forever. Roughly 1 in 30 page loads.

    Obstacles keep clear of the start and the path ahead, and move on every restart.

  2. Broken feature

    The restart key never worked

    The code had an Enter-to-restart handler, but the game restarted itself before you could ever press it, so that branch could never run.

    Show the code
    // On a crash
    alert('Game Over!');
    restartGame();   // sets isGameActive = true
    
    // In the key handler
    if (!isGameActive && key === 'enter') {
      restartGame(); // never runs
    }

    A crash now pauses the game. Enter or Space starts a new one.

  3. Wrong outcome

    Winning ended in "Game Over"

    Filling the board showed a congratulations message, but the game kept running, so the very next move crashed into the snake. You won and lost in the same second.

    Winning stops the game.

  4. Edge case

    A URL could break the board

    The board size comes from ?size= in the URL, with no checks. In Version 1, ?size=1 makes you "win" instantly, then lose, then win, forever. See it happen.

    Sizes are rounded and kept between 5 and 100. Try ?size=1 in Version 2.

  5. Game feel

    Quick turns were lost

    Only one turn could wait for the next move. Press Up then Left quickly and Left was ignored, so tight turns felt unresponsive.

    Up to 3 key presses are queued and each one counts.

  6. Game rules

    Chasing your tail was fatal

    Moving into the square your tail was leaving counted as a crash, even though the tail moves out of the way on the same step.

    Allowed now, as in most snake games, unless the snake is eating.

Under the hood: Version 1 redrew all 900 cells on every move. Version 2 updates only the cells that change, and uses fast lookups for collisions, so it stays smooth on boards of up to 10,000 cells.

Trust, but verify

bugs fixed
6
random games tested, with no instant crashes
1,000
cells redrawn per move, down from 900
≤ 3
Version 1 games that crashed on the very first move
1 in 31

Pick a version

Steer with the arrow keys. On a phone or tablet, Version 2 has swipe and on-screen controls; Version 1 needs a keyboard.

AI made this faster, but the parts that mattered were knowing what to ask, checking the answers, and deciding what to keep.