Slime Pong

A reinforcement-learning agent plays Pong, but it can't move the paddle. The paddle is a simulated slime mould, and the agent can only steer it by deciding where to put food.

Who's steering the slime

Warming up the slime…

How it works

Every 8 simulation steps: the slime moves, the paddle follows the densest slime, the policy looks at the ball and the slime, the policy places food, and the slime moves towards it. Slime moves Paddle follows it Policy looks Policy feeds

The slime is about 70 simulated agents following Jeff Jones's model of Physarum polycephalum. Each one sniffs the chemical trail ahead of it, turns towards the strongest smell and leaves more trail behind. Left alone near food, they gather into a blob on it.

The paddle sits wherever the lane holds the most slime. Nothing else moves it.

The policy is a small neural network (21,136 numbers). Every 8 simulation steps it sees the ball's position and velocity and a coarse profile of the slime, and puts food at one of 16 heights. The slime takes time to follow, so it has to aim where the ball will arrive, not where it is now. It learned that from scratch with PPO, over millions of simulated steps.

How well it plays

Share of balls returned in 20 games it never saw during training.

The hand-coded controller knows the exact geometry of every bounce and puts the food at the arrival point. The trained policy had to discover that from experience, through a paddle it can only coax.

Learning

Notes

This is a simulation of slime mould, not the organism itself. The agents follow published rules (Jones 2010, 2011, 2015), but real Physarum grows, pulses and remembers in ways the model leaves out. Here the food can only pull the slime; there is nothing to push it away.

Everything you see is computed live in your browser: the slime simulation in TypeScript, and the trained network running on its exported weights, with no server. The policy was trained in Python with stable-baselines3 against the same TypeScript simulation, and every game replays exactly from its seed.