How to play
This is a sandbox with no score. A world starts running as soon as the page loads. Pick a preset, or press New rules to roll a random world, and watch what the colours do to each other. Then open the rule matrix and change a single cell: make red stop fleeing from orange, or turn a self-attraction on, and the whole pattern changes within seconds. When you find a world you like, press Copy link to share it or Save current to keep it.
Controls
- Mouse: move over the canvas to push or pull nearby particles, or hold the button to paint new particles in the chosen colour. In the matrix, click a cell, then use the slider, the − / 0 / + buttons, drag the cell up or down, or turn the mouse wheel over it.
- Touch: touch and hold on the canvas to push, pull or paint. The page does not scroll while a finger is on the canvas, so scroll using the area around it.
- Keyboard: Space pauses or resumes, R creates new random rules, S shuffles the positions. In the matrix use the arrow keys to move between cells and the slider to change the value.
- Settings: everything is remembered in this browser.
How the simulation works
Every particle has a colour. For each pair of particles closer than the interaction radius rmax, the colour of the first one and the colour of the second one look up a number a between −1 and +1 in the matrix. A positive number means “I am attracted to that colour”, a negative one means “I flee from it”. With r as the distance divided by rmax and β as the repulsion core, the force that a neighbour exerts is:
The short-range part is the same for every pair, so particles never collapse into one point. Beyond it, the matrix decides. Each step the forces from all neighbours are added up and the velocity is updated with friction, then the position:
The half-life is the time friction needs to halve a velocity. A short half-life makes the world thick and slow, a long one makes it slippery and energetic. The time step is fixed, so the result does not depend on your screen’s refresh rate. To stay fast with thousands of particles, the world is cut into a grid of cells as wide as rmax, so each particle checks only nine cells. With wrapping edges the world is the surface of a doughnut.
Why the matrix is not symmetric
If red pulls on orange exactly as hard as orange pulls on red, the forces are equal and opposite and the system calms down: friction eats the energy until clusters sit still. In this model the two numbers are independent. When red is attracted to orange but orange is repelled by red, red chases and orange runs. Newton’s third law is broken on purpose, so energy is constantly injected and the particles keep moving. Real forces do not behave like this, so treat it as a toy.
Emergence and “life”
No particle knows about a cluster, a membrane or a chase. Each one only reacts to neighbours within a short distance, yet shapes appear that hold together, move, split and merge. That is emergence: large-scale patterns that exist only in the interaction of many simple parts. Calling them alive is a metaphor. There is no metabolism, reproduction or evolution here; the patterns are just stable solutions of the force rule. It builds intuition for how complexity arises from simplicity and is not a model of biology.
Things to try
- Press Zero. Only the repulsion core is left, so the particles spread out evenly and the average speed falls to nearly nothing.
- Give one colour a self-attraction of about 0.6 and leave everything else at zero. Clumps of that colour form.
- Press Symmetric random a few times. Compare the calm result with Randomise, where motion keeps going.
- Take the Chasers preset and flip one chase around with the matrix slider.
- Raise the repulsion core β and watch the clusters become looser and more liquid.
- Switch on trails and glow with a few hundred particles to paint their paths.
- Find a world you like, copy the link, open it in another tab and check that it is identical.
Frequently asked questions
What does the seed do?
Random rules and starting positions come from a seeded random number generator, so the same seed always gives the same matrix and the same starting layout. The link also contains the matrix itself, so edited rules are shared as well.
Why do many random worlds look boring?
Most random matrices end in a few static blobs or in pure noise. Interesting worlds are a small fraction, which is why the presets and the share link are useful. Keep the ones you like with Favourites.
How many particles can my device handle?
Most computers handle 2,000 or more comfortably. On phones the limit is lower. If the page gets slow it lowers the count for you; you can also reduce the interaction radius, which cuts the work for every particle.
What is the difference between wrap and walls?
With wrap, particles leaving one edge appear on the opposite edge and also feel forces across it. With walls they bounce back and the world has a real border.