Games made with the library. In each game, each thing that moves is a boid: one Erlang process that senses, decides and acts. The server runs the game, and the page only draws it.
Fly a ship in a field of rocks. A queen makes drones, and the drones hunt you and shoot at you.
Shows: a boid that a person controls, a rule that is a function, messages between boids, boids that start other boids, and a relation from each drone to its queen.
Lead a flock to the exit of each land, past rocks and hawks. You never control a bird: after each land, you take a card and put the rules of the flock in an order.
Shows: rules as data that change while the boids run, the priority order of the rules, and relations to elders.
Steal purses in a busy market, then leave through a gate. The police know only what the witnesses tell them: walk with the crowd, and change your coat.
Shows: information that goes from boid to boid with delays (a witness, a call, officers that share), boids that act on old information, and a crowd as cover.
Puzzles for young programmers. Snap rule blocks together to tell the sheep what to do, then press Run and see if they reach the pen.
Shows: a program as a list of rules, an order, numbers that change a behavior, "when" blocks, and the same program as Erlang and Elixir code.
Cross a field of grazing deer to reach the far side. A deer that sees you too near becomes afraid, and fear goes from deer to deer. Do not start a wave.
Shows: a state of each boid (its fear) that changes its rules, and a behavior of the herd that no boid has: the wave of fear.
Grazers eat, have young, and die. Their young get the weights of their rules with small changes. Hunters do the same. Change the land, and see what evolves.
Shows: processes that are born and die all the time, rule weights as genes, and a world that a person changes while it runs.
You are a sheepdog. Bring the scattered sheep into the fold before the night: they run from you, so come from the correct side. At night, wolves take the sheep that are outside.
Shows: one boid that a person controls moves a whole flock, because each sheep flees from it, and the flock is something that no sheep is (flocks/2).
Place pillars and signs in a full hall, then sound the alarm. Bring all the people out fast, with no one hurt in the crush at the doors.
Shows: a crowd as boids, rules that are functions, obstacles that a person places while the world runs, and a crush that no person makes alone.
Waves of beetles walk along a path to your hive. Place guard bees with your nectar. Each bee guards its post, chases the beetles that it sees, and stings them.
Shows: the rule follow along a path, pursue of a group, messages that change the state of another boid, and boids that the person starts while the world runs.
Be the predator of a reef, and catch small fish for 90 seconds. A fish in a school is hard to catch, because its neighbors confuse you. Split a school, and catch the fish that stay alone.
Shows: a school that protects each fish with no fish that knows it: the confusion comes from the neighbors of the target. Also the rule evade, and the schools from flocks/2.
Swim as a mother duck, and collect the lost ducklings into a line behind you. Lead the line around the rocks and the pikes to the nest. Do not go too fast, or the line breaks.
Shows: relations that the boids make and remove while the game runs, a chain of leaders, and the rule leader with the target {related, follows}.
Ants search for food, and an ant with food leaves a scent on its way home. Place food and rocks, and see the ants make a trail.
Shows: the rule flow with a field that is a function, a grid of scent that the boids read and write, and a trail that no ant knows.
Play tag in a school yard. Run from the child that is "it". When it touches you, you are it, and you must touch another child.
Shows: a state that goes from boid to boid by a message, rules that change with the state, and a role that moves through a crowd.
Lead groups of fireflies with a lantern at night. The fireflies that see each other flash together. Make all of them flash at one moment before the dawn.
Shows: data that the neighbors see as a signal (the time of a flash), a sync that no firefly makes: it comes from small changes of each clock. Also the groups from flocks/2.
Each rock, drone, bird, deer and grazer is a gen_boid process with its own clock. It reads its neighbors from the world, and asks no other process.
Each game is one module of the examples, in its folder of examples. Read it to see how a game uses the library.
A game starts a world when you open its page, and stops it when you close the page. The site runs a small number of worlds at one time.