Building Quickfire with an AI Agent

  • The prompts
  • How it was built
    • 1. Read the guide
    • 2. Pick the fleet
    • 3. Write it and typecheck
    • 4. Watch a few games
    • 5. Check the balance
    • 6. Try the Longboat
    • 7. Final version
  • Mistakes and fixes
    • A bigger ship made games longer
    • A double move that looked like a bug
    • Bots don't fire every turn
    • A trap the agent avoided
  • Results
  • Screenshots
  • The final mod
  • Try it yourself

Quickfire keeps the normal BattleTabs rules and takes away the wait: every ship's ability is ready on every turn. It's four small changes to four ships, and no mod code runs during a match.

The player's request:

Make a BattleTabs mod called Quickfire where every ship can use its ability every turn.

We gave an AI agent that one sentence and the public mod tool, and watched it build the mod from scratch. It took 18 calls to the mod tool, three versions and one wrong turn, and the wrong turn taught the most.

The prompts

All in one go: Paste this into your agent with the battletabs-mod tool connected, and it runs the whole loop by itself: build, test, tune.

Make a BattleTabs mod called Quickfire where every ship can use its ability every turn.
Read the battletabs-mod ship-mods docs first, and only use ships that are allowed in the Arcade.
Typecheck it, then play a few test games on different seeds and check the rule works.
Run 500 bot games and compare the win split and game length with normal rules. If one side wins much more often, or games run much longer, change it and test again.
Save it as case-quickfire, then tell me what you changed along the way and why.

Or step by step, as we did it: Going one prompt at a time lets you look at each result and steer, the way the decisions on this page were made. Some prompts react to what came back, so read the result before you send the next one.

  1. Make a BattleTabs mod called Quickfire where every ship can use its ability every turn.
  2. Read the ship-mods docs first, and only use ships that are allowed in the Arcade and have an active ability.
  3. Typecheck it, then play a few test games on different seeds and show me what happens.
  4. Run 200 bot games and tell me the win split and how long games last compared with normal rules.
  5. Can it be more explosive? Try swapping the Kayak for the Longboat combo ship and run 200 games again.
  6. Games got longer, so go back to the first fleet and list the ships on the rules card.
  7. Run 500 games for a final read, and show me a picture of one ship using its ability two turns in a row.
  8. Save it as case-quickfire.

How it was built

1. Read the guide

Prompt 1

Make a BattleTabs mod called Quickfire where every ship can use its ability every turn.
What the agent did
Read the tool's ship-mods guide before writing anything.
Tool calls
get_docs (ship-mods)
What came back
A ship's cooldown is how many of its owner's turns pass between uses, so cooldown: 1 means every turn. You can't change what an ability does, only how often it fires. Passive ships like the Crab have no ability and need cooldown: 0.
What changed
The whole mod became "set cooldown: 1 on four ships".

2. Pick the fleet

Prompt 2

Read the ship-mods docs first, and only use ships that are allowed in the Arcade and have an active ability.
What the agent did
Listed the ships allowed in the Arcade, with their sizes and cooldowns.
Tool calls
list_ships (arcade_only)
What came back
22 Arcade ships. The Kayak's normal cooldown is 2, the Sailboat's 4, the Raft's 5 and the Medium Galleon's 3. The Crab is passive, and a few ships, like the Long Sub, are already at cooldown 1.
What changed
The fleet: Kayak, Sailboat, Raft and Medium Galleon. Passive ships were left out because they have nothing to fire, and cooldown-1 ships because the mod would change nothing for them.

3. Write it and typecheck

Prompt 3

Typecheck it, then play a few test games on different seeds and show me what happens.
What the agent did
Copied the shape of the quick-dolphin example: four classic.ship(id, { cooldown: 1 }) overrides and no hooks.
Tool calls
get_docs (examples/quick-dolphin), save_mod, typecheck
What came back
"No type errors, and a match starts. The rules card and ship text pass the publish text rules." It passed the first time.
What changed
Version 1 saved as case-quickfire. With no hooks, nothing in the mod can void a match.

4. Watch a few games

Prompt 3

Typecheck it, then play a few test games on different seeds and show me what happens.
What the agent did
Played three full bot games and read the logs.
Tool calls
play_once (seeds 1, 2 and 3)
What came back
Seat 1 won after 30 turns, seat 0 after 25, seat 1 after 15. On seed 3 the Sailboat fired three turns running (turns 4, 6 and 8).
What changed
Nothing: the rule works. The Galleon shows up as two moves in a row, which looks like a free turn but is its own "attacks twice" ability.

5. Check the balance

Prompt 4

Run 200 bot games and tell me the win split and how long games last compared with normal rules.
What the agent did
Played the mod and normal rules on the same fleets and seeds.
Tool calls
simulate_n (200 games)
What came back
Seat 0 won 98 and seat 1 won 102 (49% / 51%). No draws, no errors. Games lasted 26.4 turns against 29.9 under normal rules. The bots used abilities only about 10 times a game.
What changed
Nothing yet. Fair, and quicker, as the name promises.

6. Try the Longboat

Prompt 5

Can it be more explosive? Try swapping the Kayak for the Longboat combo ship and run 200 games again.
What the agent did
Swapped the Kayak for the Longboat, whose ability is a combo of up to 5 shots.
Tool calls
save_mod, typecheck, simulate_n (200 games)
What came back
The Longboat fired twice as often (4.5 uses a game against 2.2), but games got longer: 32.9 turns, against 35.4 under normal rules with the same fleet.
What changed
Rejected. A mod called Quickfire should be quick, so the agent went back to the first fleet.

7. Final version

Prompts 6 to 8

Games got longer, so go back to the first fleet and list the ships on the rules card.
Run 500 games for a final read, and show me a picture of one ship using its ability two turns in a row.
Save it as case-quickfire.
What the agent did
Went back to the first fleet and added a third rules bullet that lists the ships.
Tool calls
save_mod, typecheck, simulate_n (500 games), render_state, play_once (seed 4)
What came back
500 games: 262 / 238, 25.9 turns against 29.7, no draws or errors. A scripted render showed the Raft firing its 2x2 on turn 0 and again on turn 2, and the tool accepted the second use. On seed 4, seat 0 used the Kayak on every one of its turns from turn 29 to 39.
What changed
Saved as the final case-quickfire.

Mistakes and fixes

A bigger ship made games longer

The Longboat swap was meant to make Quickfire more explosive. The Longboat did fire twice as often, but it's a 4-tile ship and the Kayak is 2, so each side had 2 more cells to find and sink. Ship size moved game length more than ability speed did.

Fix: Revert to the first fleet. Compare game length after every fleet change.

A double move that looked like a bug

In the logs, the Medium Galleon appears as two moves in a row. That's easy to read as a free extra turn.

Fix: No fix needed: it's the Galleon's own "attacks twice" ability. Check the ability text before you "fix" something.

Bots don't fire every turn

The bots used abilities only about 10 times a game in total, even when they could fire every turn. In the first 200 games the Kayak was used less than under normal rules (2.4 against 3.1), because the bigger abilities took its place.

Fix: Use simulate_n for fairness, errors and relative length, and the play_once logs or render_state to prove the rule works. A person will fire far more often than the bots.

A trap the agent avoided

Putting the passive Crab in an "every ability, every turn" fleet and giving it cooldown: 1 would have been an error.

Fix: The guide and list_ships both say the Crab is passive, so it stayed out of the fleet.

Results

500 bot games on the final version, seeds 1 to 500, against normal rules on the same fleets and seeds.

QuickfireNormal rules
Wins, seat 0 / seat 1262 / 238 (52% / 48%)262 / 238 (52% / 48%)
First mover won282 (56%)292 (58%)
Average turns played25.929.7
Draws / errors0 / 00 / 0
  • Seat balance is inside chance (±4.4 points), so neither seat gains an edge.
  • Games are 3.8 turns shorter, which is more than chance (noise about 0.6).
  • All 500 games played out differently from normal rules.
  • Ability uses per game per seat (Quickfire / normal): Kayak 2.2 / 3.0, Sailboat 2.0 / 1.2, Raft 1.9 / 0.8, Galleon 4.3 / 3.9.

Every version along the way:

VersionChangeResultKept?
v14 ships at cooldown 126.4 turns (normal 29.9), 200 gamesYes
v2Longboat in place of the Kayak32.9 turns (normal 35.4), 200 gamesNo, longer games
v3v1 fleet plus a fuller rules card25.9 turns (normal 29.7), 500 gamesFinal

Screenshots

TODO: in-game screenshot of this game in the BattleTabs Arcade.

The mod tool's render_state draws the boards as 2D pictures. Dark red cells are a sunk ship.

Four 7x7 boards from the mod tool showing both Quickfire fleets at the start of a game
The first version, seed 3, at the start: Kayak green, Sailboat purple, Raft orange, Galleon cyan, and the rock.
Four 7x7 boards from the mod tool after the Raft fires its 2x2 attack on two turns in a row
The final version, seed 2: seat 0 fires the Raft's 2x2 on turn 0 and again on turn 2. Under normal rules the Raft would have to wait 5 turns.

The final mod

The whole mod, as saved by save_mod. Copy it into your own mods folder to start from it.

import { classic, defineShipMod } from "@battletabs/mod-api";

// Quickfire: the real Battleship rules, but no ability ever waits.
// cooldown: 1 means "usable every one of the owner's turns" (see get_docs ship-mods).
export default defineShipMod({
  id: "case-quickfire",
  apiVersion: 1,
  classicVersion: "classic-2",
  rules: {
    pitch: "No waiting: every ship can use its ability every single turn.",
    bullets: [
      "Sink every enemy ship to win",
      "Every ship's ability is ready every turn",
      "Fleet: Kayak, Sailboat, Raft and Medium Galleon",
    ],
  },
  maxTurns: 200,
  // Small, fast fleet: every ship has an active ability (no passive Crab),
  // and short hulls keep games quick.
  fleet: ["kayak", "sailboat", "raft", "galleonmedium"],
  ships: [
    classic.ship("kayak", { cooldown: 1 }),
    classic.ship("sailboat", { cooldown: 1 }),
    classic.ship("raft", { cooldown: 1 }),
    classic.ship("galleonmedium", { cooldown: 1 }),
  ],
});

Try it yourself

Install the mod tools and connect your agent with the Arcade guide. Then paste the prompts above into your agent, all in one go or one at a time. To play against the bot yourself, ask your agent to open the play page.

Play Quickfire in the Arcade

Next case study: Blood Rush · All case studies