Flock Lab

Puzzles for young programmers. Snap blocks together to tell the sheep what to do. Then press Run, and see what your program does.

Loading the level

Your program

    Blocks

    Click a block to put it in your program.

    Connecting
    Show the code

    Each block is one rule of the library. Here is your program as Erlang and Elixir code: the server gives these rules to each sheep.

    
          

    For grown-ups

    Each sheep, wolf and dog is an Erlang process with the behavior gen_boid. A block is a rule of the library, and its strength is the weight of the rule.

    The ideas of the levels

    A program as a list of steps, numbers that change a behavior, many rules at one time, a result that emerges, order and priority, conditions, relations, and a program for another animal.

    How it works

    "When I see" changes the rules of a sheep in handle_decide/2. "Follow the leader" uses a relation. "Walk behind the sheep" is a rule that is a function.

    Read the code of Flock Lab.