Part 1 — Claude learns to play Factorio
Part 1 ended on my Mac: Claude’s character had gone from an empty inventory to red and green science at 29 and 28 a minute, blue at 15 a minute on a test copy, and a biter nest cleared by turret creep. It was a good first day. It was also a world Claude could watch, poke and restart whenever it liked, on one map it had come to know.
This post is the week after. The bot moved to an AWS server that runs around the clock, a second machine runs test starts, and the goal got sharper: win Space Age as fast as possible in game time, from a cold start, playing honestly. The rules from part 1 still hold: no items from nothing, walking instead of teleporting, and nothing tuned to one map.
The yardstick is the default-settings Space Age speedrun record, 7:31:00, or 451 game minutes, for the whole game: from crash site to a ship parked at the edge of the solar system. Claude’s best world so far is at game minute 2,930 and has not built blue science. Most of this post is about why, written for people who play the game, with the arithmetic for each gap.
Seven worlds in eight days
Claude does not get to keep a world just because it is attached to it. A world ends when its clock can no longer produce a good result, when a fix needs to be seen from the opening, or when I ask. Seven numbered worlds ran on the server between 24 and 31 October.
| World | Seed | Game minutes | Evolution at the end | What ended it |
|---|---|---|---|---|
| 1 | 1245862515 | 3,640 | 0.57 | Lost the biter war: 164 gun turrets lost against 10 spawners killed |
| 2 | 1245862515 | 15 | 0.00 | World 1’s seed again; I asked for a fresh one |
| 3 | 1264984934 | 1,290 | 0.29 | Two hours of real time in a turret-creep loop: 537 of 538 steps |
| 4 | 314752922 | 33 | 0.00 | A crash in the level script; the restart rolled the world back |
| 5 | 314752922 | 2,385 | 0.45 | Biters inside the base, no oil, labs idle |
| 6 | 1093975671 | about 420 | Restarted to see the splitter and wreck-clearing fixes from the opening | |
| 7 | 3171297304 | 2,930 and live | 0.51 |
Two things stand out. World 1 is still the furthest the bot has climbed: it built its blue block at minute 308, had construction robots at 433, researched the rocket silo at 1,165 and laid solar at 1,291. Then it fought a war it could not win, losing 16 turrets for every spawner it killed. The four worlds since have all died or stalled earlier on the ladder, because each one changed something in the opening and found a new way to break.
World 7, by the numbers
World 7’s health record is written every five game minutes. These are its milestones in game minutes:
| Milestone | World 7 | World 1 | Strong opening |
|---|---|---|---|
| Steam power | 29.8 | 28.8 | |
| First lab | 31.6 | 29.7 | |
| Red automated | 51.2 | 40.2 | |
| Defense up | 52.9 | 40.2 | |
| Green automated | 112.0 | 108.5 | 19 (red, green and a mall) |
| Oil gathering researched | 118.0 | ||
| Mall built | 151.8 | 19 | |
| Oil built | 566.6 | 262.3 | 32 (oil build begins) |
| Blue researched | 586.5 | 313.8 | |
| Blue block built | never | 307.5 | 51 |
The right-hand column is the 2.x any% run’s video chapters, which the opening lesson uses as its benchmark. They are not the same category as the Space Age record, but they show what a strong opening looks like on the clock.
Three things in that chart tell most of the story.
- The flat stretch from minute 245 to 560. The technology count sits at 42 for five game hours. The oil search wanted a radar the bot no longer counted as built, so it waited (factorio-agent #196). In real time that was two and a half hours of a bot standing still.
- The second climb stops at 66 and never really restarts. Red and green run at 30 a minute for about two hours, then fall to zero at minute 700 and stay there, apart from short bursts. Blue was researched at 587; the bot has made zero blue packs.
- No new technology since minute 2,306, 624 game minutes ago. At the last record all ten labs were idle, and the bot’s own blocker line said red science was waiting on its steel project, which had been open for 596 minutes.
At minute 2,930 world 7 has 68 technologies, 5,441 entities, 6 deaths, 71 spawners and 42 worms killed, and 46 turrets lost. Its power draw was 697 kW out of 9 MW of capacity. Ninety-two percent of the power plant is idle because the factory is idle.
The opening, against strong play
The opening lesson (5.7.7.2.3.9.1) compares world 7 with the strong opening, step by step.
The cost of reaching blue is fixed by the tech tree. It takes 15 technologies, four of them trigger technologies and the rest 1,050 red and 915 green units, about 347 lab-minutes in all. At 2 iron and 1 copper per red pack and 5.5 iron and 1.5 copper per green, the research alone eats 7,133 iron and 2,423 copper plates before a single building is placed. A strong player reaches blue at 51 minutes because three things happen at once: research never stops, the mall is building the next block while the current one is placed, and oil starts by minute 32 so that the refinery comes on as the technology lands.
World 7 did each of these things in order rather than together, and each one waited on the one before. The gap to blue was 449 minutes of waiting on one radar, then a long stall when iron ran short. Measured as divergence from strong play:
| Step | Strong play | World 7 | Lost |
|---|---|---|---|
| Red and green automated, mall up | 19 | 112 / 152 | 93 to 133 min |
| Oil built | 32 | 567 | 535 min |
| Blue automated | 51 | not yet at 2,930 | at least 2,879 min |
Where the time went
Every step the bot takes is logged with a family: build, gather, upkeep, defense, research, idle, stuck. Grouped by game hour, the families show what the bot was doing with its time.
The first hour is mostly building, which is right. After that the mix drifts: hours of upkeep (refueling, re-arming, hand-carrying to cells), whole hours of idle while the radar wait ran, and in the last day a growing band of gathering and stuck. Two hours in particular show what a strong player would never do.
- Hour 43: steel by hand. In the hour to minute 2,290, 257 of 437 steps were “gathering steel-plate for the piercing-rounds-magazine cell”, while the character held 2 steel all hour (factorio-agent #219). That is about 35 game minutes of one hour spent walking to furnaces.
- Hour 48: one worm. In the hour around minute 2,900, 1,226 of 1,231 steps were “waiting (stocked) … no way round the worm” (factorio-agent #128). The bot had the ammunition; it had no path that kept clear of one worm’s reach and no rule that said “kill it”.
The sections below go through each flaw, with the arithmetic for what it cost.
Flaw 1: five pumpjacks full since minute 567
The oil field is the clearest case of a strong player and the bot disagreeing about what matters (lesson 5.7.7.2.3.3.1). World 7 placed five pumpjacks at minute 567. They have stood full ever since, at 67.3 crude a second, with no refinery behind them.
Here is what that crude would make. A blue pack needs 1.5 advanced circuits (3 plastic) and half a sulfur. Plastic is 10 petroleum gas a bar and sulfur is 15 gas a unit, so a blue pack costs 37.5 gas.
- Basic oil processing, three refineries: 100 crude makes 45 gas in 5 s, so a refinery at speed 1 takes 20 crude a second and makes 9 gas. Three refineries take 60 of the 67.3 crude and make 27 gas a second: 27 × 60 / 37.5 = 43 blue a minute.
- Advanced processing with cracking, the same three refineries: 60 crude a second gives 15 heavy, 27 light and 33 gas. Cracking the heavy (40 to 30) adds 11.25 light; cracking all 38.25 light (30 to 20) adds 25.5 gas. Total 58.5 gas a second, which is 93 blue a minute.
The oil buildings that would turn this on cost about 435 iron. The bot was in an iron shortage: it planned “another iron unit” 247 times in one hour and built none (factorio-agent #200). A strong player sees the shape: 435 iron is half a minute of one full yellow belt of plates (15 a second), and those refineries unlock every technology left on the tree. The bot weighed the refinery against everything else that wanted iron and kept losing the comparison.
The field will not wait forever either. Pumpjacks deplete toward a floor; the figure shows these five falling below what 30 blue a minute needs on basic processing in about four hours of pumping, and to their floor of 13.5 a second after about eleven. Cracking moves the demand lines down, so the same field serves longer.
Flaw 2: no splitters, and lanes that fill with the wrong thing
I asked Claude on 30 October whether the bot used splitters. It did not. World 7 had 2,645 transport belts, 68 undergrounds and no splitter, with the recipe unlocked since early in the game (factorio-agent #206). World 1 had 1,988 belts and no splitter either (factorio-agent #57). The bot’s own milestone 5 says “a bus tapped by splitters”; it has never built one.
Without splitters, each consumer gets its own line from its own drills. That works until a producer outruns its consumer and a consumer elsewhere starves. On world 7 the ore drills stood still on full belts the same evening that copper consumers went short. A splitter would have handed the surplus across. A yellow belt is two lanes of 7.5 items a second, so a full belt sitting still is 15 plates a second of production thrown away.
The lane problem came from the other direction. On 31 October a change that filled holes in belts (PR #201) went live and began joining two lines the planners had built apart. The bot’s own lane check went from zero contaminated lanes to 12 to 17 within one record of the deploy, and the watch filed factorio-agent #214 about 35 game minutes later.
Why a few foreign items matter: an item no inserter takes rides to the end of the lane and stops. A lane holds four items a tile, so each stopped item holds a quarter tile for good, and the dead stretch grows backward past each inserter in turn. At 1% contamination on a lane moving 7.5 a second, 0.075 foreign items arrive each second; a 20-tile tail has 80 slots and fills in 80 / 0.075 = 1,067 seconds, about 18 minutes. After that, every inserter along those 20 tiles is starved. A strong player either keeps lanes pure or ends a mixed lane in a filter splitter or a chest. The fix for #214, PR #215, refuses joins no plan designed, undoes the joins already made and cleans the lanes.
Flaw 3: the mall, and steel carried by hand
A mall is a stock problem, not a rate problem (lesson 5.7.7.2.3.2.2). One assembling machine 2 makes 180 belts or 90 inserters a minute, so a cell fills its stack in under a minute. The difficulty is keeping its inputs full. The bot’s mall is fed by hand, and the hands are Claude’s character.
In the three hours to game minute 1,690, 224 of 515 steps (43%) were hand-supplying the ammunition cells. At that point five of sixteen mall chests were empty, among them belts, inserters and gears, which are the three items a growing factory places most. I noticed this by watching (“spends a lot of time filling chests”, #95) and said what a player would do (“the mall should be belt fed”, #175).
The steel numbers show the size of it. A turret gun fires 10 rounds a second and a magazine holds 10, so a firing turret empties a magazine a second. Each piercing magazine is half a steel plate. The bot’s creep holds 160 of them, which is 80 steel, carried. A stone furnace makes a steel plate from 5 iron in 16 seconds. One furnace would take 21 minutes for 80 steel; a column of twelve makes 45 a minute and covers it in under two. The bot had steel furnaces. What it did not have was a belt from them to the ammunition cell, so its character walked to the furnaces for steel for 35 minutes of an hour, and held two plates the whole time.
PR #209 belts the mall. It was also the first change the seed panel judged, below.
Flaw 4: one worm
At evolution 0.51, a medium worm reaches 30 tiles. World 7’s base has worms at its edge, and the bot’s pathing treats every worm zone as a wall: 69 failed walks with “no path” around 556 worm zones (factorio-agent #218). When the only route to a job crosses one worm’s reach, the bot waits, stocked, and in one hour that was 1,226 steps out of 1,231.
A strong player kills that worm. The bot already knows how: it runs turret creep against nests, and part 1 described the first one it cleared. What it lacks is the rule that a worm sitting on its only route is a target, not a wall. The cost of not doing it was one full game hour at the moment the base most needed to restart research.
Evolution: mostly the clock
Evolution in Factorio is a raw sum squashed into a factor: factor = raw / (1 + raw). Time adds 0.000004 a second, pollution 0.0000009 a unit, and each spawner killed 0.002.
At minute 2,818 the watch split world 7’s evolution by cause (factorio-agent #153):
| Cause | Arithmetic | Raw | Share |
|---|---|---|---|
| Time | 2,818 min × 60 s × 0.000004 | 0.676 | 67% |
| Pollution | 215,556 units × 0.0000009 | 0.194 | 19% |
| Spawners killed | 71 × 0.002 | 0.142 | 14% |
| Total | 1.012 | factor 1.012 / 2.012 = 0.503 |
The base averages about 76 pollution a minute (215,556 units over 47 game hours), which is small. Time does two thirds of the work. Time alone would give a factor of 0.403 at minute 2,818; pollution takes it to 0.465 and the kills to 0.503. A run at record pace, 451 minutes, has a factor from time alone of 0.098: the record never meets a medium biter in numbers, let alone a big one. World 7 crossed 0.2 (medium biters) at minute 620 and 0.5 (big biters) at minute 2,780. The biter problem is a speed problem. Every hour the factory idles costs 0.0144 of raw evolution, and nothing else the bot does moves it as much.
Finding flaws without me
On 25 October I asked for a way to find flaws like these without my watching (factorio-agent #96). The answer is an hourly watch. It reads the live world’s health, runs the benchmark checks, and keeps one issue per regression kind: it opens “REGRESSION <kind>” the first hour and comments “Still regressing” each hour after. Since 26 October it also reads the last hour of the bot’s log, counts step families and repeats, and asks whether a strong player would do this; when the answer is no, it files a behavior issue.
From 23 to 31 October I filed 17 issues by eye: five on the 24th, four on the 25th, none on the 31st. The watch opened 29 regression issues and added 187 hourly repeats, 216 reports in all, rising from 4 a day to 48. On the 31st I filed nothing; the watch filed everything. Every flaw I spot by eye now becomes a benchmark rule, so the watch catches the next one (#96).
The watch does not replace a player’s eye. Its job is to make sure nothing I already caught can come back silently.
The pipeline, and what review missed
Every change to the bot now goes through the same steps: an issue, a cloud session that writes the change with tests planted in both directions (and a TLA+ model where the order of events matters), an independent review that ends MERGE or FIX FIRST, a seed panel on the test machine, a merge with the full gate on the merged tree, and a deploy.
Since 23 October the main branch has taken 495 commits, 116 of them merges. On the latest PR the gate ran 2,921 tests and 622 TLA+ cases.
The seed panel is the newest step. It exists because review alone had been merging changes that read well and played badly. It runs five seeds (one of them an awkward start with worms near spawn), baseline and candidate back to back on each, for 60 game minutes at speed 4: ten runs per change. A change passes if no milestone is lost and no new deaths appear.
Its first three verdicts, all on 31 October, mixed signal with noise, and the honest reading is that none of them is settled yet.
- #209, the belt-fed mall. Review had passed it and it had been merged. On the panel, deaths went from zero on every seed to 1, 2 and 3 on three of the five, all between game minutes 35 and 50 (#216). That looks like a real effect, but it is one run per side.
- #217. Review said MERGE twice, in round 2 and again after a rebase. The panel reported 12 regressions across all five seeds: on s4858 the candidate never automated red and lost five research milestones; on s3520 it had 4 deaths against 0; on the awkward start it went 35 minutes without research. The merge was held. A later fix agent found that the mall code never ran on any of the regressed seeds, because neither side reached green automation in the hour. Whatever changed those runs, it was not the PR’s code, and the cause is still open.
- #215, the belt-hole fix. The panel failed it on 8 regressions, and all 8 were noise. In every run, baseline and candidate, the belt-hole filler found 0 holes and made 0 joins, so the PR’s code never made a decision. The bot runs in real time, so the same seed reaches the same milestone 5 to 8 game minutes earlier or later from run to run. And one run counted as a regression had been killed by a failed poll in the test harness, not by the bot.
#215 is the case that showed what the gate lacks, and it is the same lesson any benchmark teaches. A sound panel needs two things this one does not yet have. The first is a noise floor: repeat runs of the baseline alone, so that a milestone 6 minutes late can be told apart from the spread of ±5 to 8. The second is coverage: a verdict of “not exercised” when the changed code never ran, instead of pass or fail. A 60-minute panel can only judge what happens in the first hour, and a fix to a world at minute 2,000 never runs there. Both gaps are filed (factorio-agent #224 for the noise floor and the not-exercised verdict, #225 for a killed run counted as a regression). Until they land, a red panel is a reason to look, not a verdict.
The world map
The whole of world 7, as of game minute 2,692:
Distance is the next problem after splitters. The east iron patch (4.0 million ore) is 290 tiles from the core, the copper (7.9 million) 545, and the oil 475. Trains are the answer at that range (lesson 5.7.7.2.3.2.3).
A yellow belt costs 1.5 iron plates a tile (one plate and one gear make two belts). A straight rail is two tiles of track for a stone, an iron stick and a steel plate, about 1.375 plates a tile. One belt’s worth is always cheaper by belt, but a train has a fixed cost (locomotive, wagons, stations, signals) of 540 to 960 plates and then carries several belts’ worth on one track. For 30 ore a second (two belts) a train is cheaper past about 420 tiles; for 60 a second, past about 210. World 7’s copper at 545 tiles and oil at 475 are both past the line.
What winning takes
Blue science is milestone 6. Ten more follow, and every one of them is bigger than everything world 7 has built so far.
For 60 packs a minute (lesson 5.7.7.2.3.6.1): red takes about 7 assembling machine 2s, green about 12, blue 52, counting the machines on its engines, advanced circuits and plastic. A blue pack takes 24 seconds for two; at crafting speed 0.75 that is 3.75 a minute per machine, so 16 machines on the pack alone. World 7’s ten labs at research speed 1.5 balance its 30 a minute of red and green on 30-second technologies; every technology left on the tree needs blue.
After blue come robots, logistics and solar, the silo, and then the planets, each gated by the ones before.
The record does all of this in 451 minutes. World 1 got as far as the silo technology in 1,165. The honest summary is that the bot is at milestone 5 of 16 on world 7, partly: green is automated and the mall stands, but there is no bus and no splitter.
What’s next
The queue is ordered by impact and by how soon the live world meets each problem.
- Land the four open fixes (three PRs and an issue): #215 (the belt-hole filler that joined lines), #217 (the mall), #219 (steel belted to the ammunition cell instead of carried) and #218 (pathing that treats worm zones as walls).
- Restart iron and move toward blue on world 7. If world 7 has not done that within two or three game hours, Claude backs it up and starts world 8. Restarting is now Claude’s call, not mine.
- Secure the base (#171), so that evolution from the clock stops costing turrets.
- Splitters and a bus (#206), so producers share instead of stalling.
- The blue block (#200), sized for 60 a minute from the first build rather than grown one machine at a time.
- Trains (#167) for the outposts past 400 tiles.
Part 1 was about whether Claude could play by the rules at all. It can. This week was about the distance between playing and playing well, and that distance turns out to be the same list any veteran would give a new player: never let research stop, belt everything that has a rate, share with splitters, take oil early, kill the worm, and go faster, because the biters are mostly a clock.