Write
A model is one .pet file with named sections: world, params, patches, pets, setup, step. Sliders and readouts are declared in the file, so there is no interface to wire up.
Read the language referenceAgent-based modelling in the browser
MathPets is a small language in the NetLogo tradition: patches on a grid, agents that move across them, links between agents, and rules that run each tick. Most models in the library are under 100 lines.
Runs in the browser. No account needed.
world: x: -60..60 y: -44..44 topology: box params: density = slider(62, 0..100) monitors: burned-trees = count patches where burned burning-trees = count patches where burning living-trees = count patches where tree patches: state: empty | tree | burning | burned = empty setup: patches: state := tree chance density 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) The complete Fire model, 32 lines, running beside its source.
A model is one .pet file with named sections: world, params, patches, pets, setup, step. Sliders and readouts are declared in the file, so there is no interface to wire up.
Read the language referenceModels compile and run in the browser. Each run has a seed, so it can be replayed exactly. Inspect any patch or agent on the board, and change parameters while it runs.
Browse the modelsEvery model in the library opens with its source. Change a rule or a colour, apply it to the running model, and keep your version.
Follow the quickstartFrom the library
Scroll to switch between them. Each one opens in the studio with its source.
Reynolds' boids. Each bird turns away from a neighbour that is too close; otherwise it turns toward its neighbours' average heading and their centre.
No bird leads and nothing is global. Flocks form, split and merge, and leave one edge of the torus to come back on the other.
Open modelAnts that find food carry it home and drop a chemical on the way. It diffuses and evaporates, and searching ants follow its gradient.
Trails form to the nearest food pile first and fade once it is empty. The three piles are usually emptied in order of distance.
Open modelBert Chan's continuous Game of Life: cells hold values between 0 and 1, neighbours are weighted by a ring-shaped kernel, and a smooth growth rule replaces birth and survival.
The seed settles into Orbium, a glider that keeps its shape and crosses the board at about half a cell per tick. Raise sigma from 0.016 to 0.02 and it splits until rings fill the board.
Open modelSheep eat grass, wolves eat sheep, and grass regrows after a delay. Moving costs energy, births are random, and an animal dies when its energy runs out.
The populations cycle, with wolves lagging sheep. Switch model-version to sheep-wolves (no grass) and the cycles usually end in extinction.
Open modelFree course
6 units, from patch rules to network dynamics. Lessons are narrated over a live model, with exercises that have you run it, tune it and edit its code.
The language reference, a quickstart that builds Fire and Ants line by line, and the physics, sound and X libraries.
Read the docsConnect an MCP client such as Claude Code to the model you have open. It can search the docs, render previews and edit the draft, and its edits are highlighted as they land.
Set up a connectionThe parser, compiler, deterministic runtime and VS Code extension are Apache-2.0 on GitHub. You can compile and run model files without this site.
Read about the core