Write
Describe agents, rules, and data in a small language that reads like the model you are thinking about.
Learn the languageMathPets is a friendly language and studio for math-powered agent simulations, experiments, and emergent behavior.
world: x: -60..60 y: -44..44 topology: box params: density: number = slider(62, 0..100) monitors: burned-trees: number = count patches where burned burning-trees: number = count patches where burning living-trees: number = count patches where tree patches: state: empty | tree | burning | burned = empty setup: patches: state := if (random-float(100) < density) then tree else empty where (tree and px = min-x): state := burning step staged: patches: where burning: state := burned where (tree and any neighbors4 where burning): state := burning stop when (count patches where burning = 0) Free self-paced course
Six units of short narrated lessons, runnable experiments, readable source, and end-of-unit checkpoints. No programming background or account required.
Describe agents, rules, and data in a small language that reads like the model you are thinking about.
Learn the languageStep through behavior, tune parameters, inspect state, and watch patterns emerge without leaving the page.
Explore simulationsFork built-in models, reshape appearances, and save your own browser-local experiments.
See how remixing worksEvery board below is a live simulation — scroll and the rules change under it.
Birds align, separate, and cohere using only their nearest neighbors.
No bird is in charge. Watch ribbons and vees assemble out of three local steering rules — then dissolve and reform somewhere else.
Open modelForagers lay pheromone trails that evaporate, diffuse, and recruit.
The first ant wanders at random. Watch highways condense between nest and food as trails reinforce — and fade once a source is exhausted.
Open modelTwo chemicals react and diffuse into spots, stripes, and labyrinths.
Activator and inhibitor race across the grid. The standing pattern that emerges is the same math behind seashell pigment and zebra stripes.
Open modelPredators, prey, and grass chase each other through boom and bust.
Populations oscillate without any schedule: too many wolves starve, sheep recover, grass regrows. Sometimes the whole system collapses instead.
Open modelThe MathPets language, compiler, and runtime are the open core behind the studio.
Explore the language