// article ยท AI-assisted development

How we built Anchor Drop with AI

From a one-paragraph brief to a tested, deployed browser game: what the AI did, what we decided, and what caught the mistakes.

98

automated tests run before every deploy

11

browser journeys, in 3 browser engines and on a phone screen

0

plugins or game engines

Anchor Drop is a small retro game: a ship sails across the sea, you drop the Code Anchor, and it sinks through coins, treasure chests and rocks to the sea bed. We built it with AI to show what an AI-assisted project looks like when it's done properly, with design, tests and a paper trail, not just code that appears to work.

1. Start with a plan, then change it

We began with a one-paragraph brief: a retro game, playable in any browser, with the testing and the process documented. The AI came back with a planning document covering five game styles, a recommended stack, a testing strategy and a six-phase roadmap.

Its suggested game was a brick breaker. That was sensible, but generic. We swapped in our own idea, which carries the brand: the anchor in our logo, dropped from a moving ship, drifting on a current. The AI rewrote the plan around it, worked out the physics, and listed nine open questions for us to answer. The AI gave us speed; the direction stayed with us.

2. Read the codebase before writing any code

The plan said TypeScript and Vite. Before building, the AI read this website's repository and found three things that changed that: a custom build that renames CSS classes, a link checker that fails any deploy with a broken link, and Netlify running the tests before every release. So it dropped the new tooling and wrote the game as plain JavaScript modules that browsers load directly, tested the same way as the rest of the site.

3. Rules first, tests first

The game's rules are a pure state machine: no canvas, no clock, just "given this state and this key press, what happens next?" The AI wrote 41 tests for them before writing the code. For example: the anchor keeps the ship's speed when dropped; a coin scores once; one rattle against a rock costs five points, not five per frame.

npm test # tests 98 # pass 98 # fail 0

It also balanced the game by simulation. It played 400 games with random timing in code, found that the rocks won far too often (median score โˆ’11), adjusted the layout and checked again (median about โˆ’1). No one had to play 400 games by hand.

4. Make the server check the score

A score sent from a browser can be faked. Because the game is deterministic (a fixed time step, a seeded random number generator, and only arithmetic every browser computes identically), the server can simply replay it.

// how the pieces fit

The browser plays it, the server replays it

Browser
+ playerName
+ seed
+ startGame()
game.mjs
+ physics
+ rules
+ step()
Score API
+ dropTimes
+ replay()
Turso
+ games
+ attempts
+ highScores()

same code The browser and the server run the same game.mjs. The browser sends only when each anchor was dropped; the server works out the score itself.

5. Where the AI got it wrong, and what caught it

This is the part most AI demos leave out. Every mistake went into a bug log:

  • A wrong test. One test compared decimal numbers exactly and failed on โˆ’59.99999999999999. The code was right; the test run caught the test.
  • Styles that would vanish in production. The first high-score list relied on class names our build renames. Caught by the AI reading the project's README, before it shipped.
  • An unbalanced game. Caught by the 400-game simulation.
  • A ship that looked wrong. Caught by reviewing screenshots from a real browser.
  • A link to a page that didn't exist yet. This article, in fact. Caught by the site's own link check, which refused to build.

Then, with every test green, we handed the work to a second AI agent that hadn't seen it and asked only for defects. It found a bug every test had missed: the on-screen "tap to drop" prompt never appeared, because no test looked at what the canvas drew. It also found a way to flood the database. Both were fixed the same day.

None of these needed heroics. They needed a safety net that was in place before the code was written, and a second pair of eyes at the end.

6. Test it in real browsers

Unit tests prove the rules. End-to-end tests prove the page. Playwright opens the built site in Chrome, Firefox, Safari's engine and a phone-sized screen, and plays it: it starts a game, drops all five anchors, checks the scoreboard and confirms the game still works when the score server is down. One test takes the drop times the page sends and replays them with the server's code, so if the browser and server ever disagree about a score, the test run on GitHub fails before the change can be merged.

7. Privacy by design

Players never type a name. The game generates one, like "Salty Kraken 42", and the server rejects anything else. The high-score table holds no personal data, and the database sits in London.

What we'd tell a team trying this

  • Own the idea. AI drafts are a fast starting point, not the destination.
  • Make it read before it writes. Most of the good decisions came from the AI understanding the existing project.
  • Put the tests first. They turn "looks right" into "is right", and they catch the AI's mistakes and your own.
  • Get a fresh review. Tests only check what someone thought of. A reviewer who didn't write the code finds the rest.
  • Keep a record. The devlog, decisions and bug log in the repository are what made this article possible to write honestly.

Try it, then try it on your own project

Play Anchor Drop, or talk to us about our Adaptive course on using AI in your workflow.