Slime MoldCase study

The sim finding three foods, recorded at its real speed. Play with the live sim

Type
Creative coding, and a test of Grok
Role
Direction, behaviour and motion rules, visual design
Built with
Grok wrote the sim. Later changes with Cursor. Claude helped plan and check the series.
Tech
One HTML file. WebGL2 with a Canvas2D fallback, Web Audio.
Time frame
Build Oct 30 to Nov 5, 2026. Series on X Nov 11 to 30. Still changing.

A slime mold that hunts for food, directed by me, coded by Grok.

A playable simulation of how Physarum, a slime mold, finds food. I built it to see how far Grok could go as a coding partner. I chose the behaviour, the look and the rules. Grok wrote the code, and I sent rounds back until it moved like the real thing.

87Commits on top of the first build, across three working days
5Research papers behind the model, each linked in the series
13Posts on X showing the process, Nov 11 to 30
// 01It rests until it smells foodScent spreads out from the food, fast at first and then slower. Growth starts where the scent first touches the edge, and only on that side.
// 02It searches as one wide fanA beaded front, lace behind it, tubes behind that, all pulsing together. Left is real footage. Right is the sim.
// 03Contact changes everythingWhen a vein tip touches the food, the glow starts there and the tube thickens back toward the body. The rest of the fan dims and stays as a faint trace.
01 · Where it starts

The first build moved, but nothing held it together.

I watched a slime mold documentary and wondered if AI could recreate how it searches for food. I gave the question to Grok to see what it would build. It began as a one-shot creative lab, then narrowed to one organism and six questions: forage, maze, trail, network, pulse, split.

The forage card ran 48,000 agents on a standard model (Jones, 2010). Lots of motion. No body.

Left: real slime mold, a thick sheet with veins running through it. Right: my first attempt, clean white spokes on black. That gap became the brief. Real footage: "Timelapse of Slime Mould" by Phy sarum, CC BY 3.0.
Six small simulations on black: forage, maze, trail, network, pulse and split
Oct 30, the baseline. Six agent experiments on black, with a magenta accent that didn't last.
02 · Principles

Three things I held through every round.

  1. Behaviour is the briefEach round was judged on what the mold does: when it rests, where it grows, what happens on contact.
  2. Slow and smoothReal slime mold never snaps, so nothing here does. No springs, no overshoot.
  3. The picture is the proofA passing check means little if the still shows the bug. I judged every round by looking at it.

Six rules that held to the last round

  1. Before R10Rest until scent touches the edgeThen grow from that point, on that side only. I asked twice before it held.
  2. Kept from R12Contact starts at the foodThe glow begins at the food and the tube thickens back to the body. Every later round had to keep this.
  3. R17No springs, no snapI said it three times. Round 15 still shipped springs. Round 17 took them out.
  4. R18The front stays ahead of the veinsWhile it searches, no tube pokes past the beaded edge.
  5. R18Growth roots in the moldNever in a food, even when several drop at once.
  6. R21Search follows the foodNew growth never fills the empty sides.
03 · The model

Agents made motion. Flow made a body.

The agent model draws trails. It can't hold a network. So the forage card moved to a flow model from the research on real slime mold: tubes that carry more flow get thicker, idle ones fade. Before any styling, I had Grok animate that one equation so I could watch it work.

Left: the same seed and food, 48,000 agents beside the flow network. Right: the equation in a maze. Only the shortest path survives.
04 · The look

Painted with a river, framed like a lab instrument.

The colours come from aerial photos of glacial rivers in Iceland. I didn't pick them one swatch at a time. I looked at each photo as a whole and at how much of the frame each colour takes. Most of it is dark ground, a smaller share is pale water, and only a little is warm. The sim keeps those shares: an umber field instead of pure black, pale ice-blue channels for the network, and ochre only where the flow is strongest.

What the rivers gave the sim

I read each photo as a whole first: how much of the frame is dark ground, how much is water, how little is warm. Then each share got a job in the sim. Under each photo, its shares; under all three, the sim. Hover a band to see where that colour sits. The figures were measured afterwards, for this page.

Aerial photo of a braided glacial river in Iceland, from Jan Erik Waider's series Blue Veins

63 dark · 18 grey · 19 pale

Jan Erik Waider, Blue Veins
Aerial photo of a glacial river in Iceland over black sand and yellow moss, by Andre Ermolaev

29 dark · 34 grey · 33 pale · 4 warm

Andre Ermolaev, via Smithsonian
Top-down photo of braided streams on the Katmai coast, Alaska, pale channels between grey sediment bars

5 dark · 65 grey · 30 pale

Katmai National Park and Preserve, NPS, public domain

Left and middle: from the reference set, by Jan Erik Waider (from his series "Blue Veins") and Andre Ermolaev. Right: braided streams on the Katmai coast, Alaska, by the US National Park Service (public domain), added for this page for its top-down braiding. Each photo belongs to its photographer.

In the sim: the first river render

  1. Field #1A1214 · 94%
  2. Slate #677E8D · 2%
  3. Ice #93B4CC · 4%
  4. Ochre #E2B33C · 0.3%
Aerial photo of braided glacial river channels over black sand
Left: "Water streams from air, Iceland 2013" by Stig Nygaard, CC BY 3.0. Right: the first river render, running live.

The river version was all channels and no body, so I kept going.

One day of commits on the same food: river channels, flat channels with ochre silt, a mesh behind a fanning edge, a lace body around the tubes.

A specimen on a lab monitor

I kept asking what this would look like in a sci-fi film. So the interface narrates the organism like an instrument: food dropped, scent detected, growing toward, contact, linked. Labels appear when their event fires. They never cover each other, the log or the controls.

05 · Interaction

It reacts to you, but only up close.

Hover near the edge and the blobs split and lean toward the cursor like iron filings. The pull stops about 80 px out and never moves a blob more than 22 px. Earlier versions stretched bubbles across the screen, and it took several rounds of notes to cut that back. Click the centre and a pulse runs through every vein, stronger on the wide ones.

Drop food, hover the edge, click the centre.

Sound took three tries

  1. FirstA sci-fi clickOne sound, on label open. My note: too lazy, make it bassy, like a game menu.
  2. ShippedSounds from the organismA low hum when it smells food, a soft crackle for labels, one deep thump when you tap the centre. All made live in the browser.
  3. ExploredTwo more versionsOne layered recorded slime under the synth. One turned the network's flow into tones, mapped to published findings. Neither shipped.
06 · Direction

Most of the direction was saying no.

Grok sent a build, I played with it, and I sent back what was wrong. When words weren't enough I marked up a screenshot, seven of them over the build. Here are three, each beside the round that answered it.

A screenshot with three numbered red marks, beside round 19 where the search veins grow outward
"they are facing towards the core right now, but they should go outwards" Round 19 rooted the veins at the base of the fan, doubled their number and thinned them.
A screenshot with red loops over gaps and a green circle over a folded front, beside round 20
"still seeing some gaps in network(red), also (green) avoid these shapes" Round 20 added side branches and filled the hollows. The gaps got smaller. They are not gone.
A screenshot with the left and right sides of a downward fan circled and crossed out, beside round 21 in a new test scene
"the food was in the bottom, it should not have spread on the sides" Round 21 limits new growth to the side the scent comes from.

Finding the floor

After contact the searched web stays as a trace. How visible took five tries. I asked for 70 percent to see it, and a twelve-food network got too dense to read. Veins settled at 20 percent, lace at 30.

Two calls that cost rounds

  1. R18Trust the stillGrok's check passed and the picture still showed tubes past the front. The check measured an internal edge. I was looking at the drawn one. From then on a build had to pass the stills.
  2. R17Back to round 12Rounds 13 to 16 stacked search features on a build that had drifted, and the contact behaviour was getting harder to keep. Round 17 went back to the round 12 file and ported the search onto it.
07 · Working with Grok

Where Grok was strong, and where it needed me.

This began as a test of Grok. It held up well, and it still needed a hand. This is what the chat log shows.

What worked

  • It repeated my notes back as a short listMy notes were long and dictated. Before building, Grok answered with five or six plain bullets of what would change. Twice that caught a misreading before any code was written.
  • Every build came with what was still wrongEach delivery ended with its own list of rough spots.
  • It checked the research and disagreedI asked how real slime mold builds its main vein. The answer began "You're half right."
  • It left the choices to me"One choice is left for you: which way the thickening should visibly travel."
  • It held builds backRound 18 passed its own checks. Grok still wouldn't send it, because the picture was wrong.
  • Its bots handed work to each otherThe bot planning the X series asked the coding bot for the early material and had a full reply two minutes later.

Where I stepped in

  • Rules had to be repeatedNo snapping, three times. Rest until scent, twice. Grow only from the mold, twice.
  • New features broke old behaviourTwice the fix was to go back to an older build and port forward.
  • Its checks measured the wrong thingThe round 18 check passed on an edge nobody could see.
  • It overcorrectedRemove the thin fingers and the fan came back too wide. Fill the notches and the sides filled too.
  • It went quietRuns were cut off or stalled, and I had to ask where things were.
  • It couldn't see or hear the resultIt tested without a graphics card or speakers. The glow and the sound were mine to judge.
08 · In public

Shown as it happened, in 13 posts.

I wanted people to follow the build while it changed. Grok's first advice was to lead with the best frame and then rewind. I asked it to argue both sides, and we went progress first: open on the early experiment, show one change per post, keep the evidence in the replies.

The series in 67 seconds, one caption per day, from 48,000 agents to the playable sim. It has sound.

The series ran on X from Nov 11 to Nov 30, 2026. Papers, footage credits and limits went in the replies. Where the sim didn't match the real clip, the post said so. The last post hands over the link and says the search still isn't right.

So I kept going after it. Each food now gets its own search the moment its scent arrives, and the mold goes after all of them at once.

09 · Tradeoffs

What I gave up, and why.

Four choices, four costs

Go back, don't patch forwardRound 17 restarted from round 12 to protect the contact behaviour.CostFour rounds of search work had to be ported again.
Keep the searched webThe faint trace shows where it looked before it found food.CostA twelve-food network gets dense, even at 20 percent.
Stylise, don't simulateRiver colours, an instrument interface, a pulse sped up so you can watch it.CostIt is inspired by the papers. It is not a validated model.
Ship it unfinishedPeople got the link while the search still felt wrong to me.CostEveryone can see the gaps I marked in red.
10 · Looking back

What I'd take into the next build.

  1. A red circle beats a paragraph.

    My dictated notes ran long and Grok had to untangle them. The rounds that followed a marked-up screenshot fixed the thing I marked.

    NextLabel every mark. The one area I left unlabelled, Grok guessed at.

  2. Write the rules down once.

    I said no snapping three times in two days. At the end Grok compiled every standing rule into one file. That file should have existed from round one.

    NextStart with the rules file, and have the AI read it before each round.

  3. Check what the eye sees.

    A check that measures the wrong edge keeps passing. The stills caught what the numbers missed.

    NextAgree which stills a round must show before any code changes.