Mathias Polligkeit
  • Dev
  • Impro
  • Sheet Music
  • Contact
Aug 5, 2017 (last updated: Jul 6, 2020)

Live Coding: Swarm Behaviour in Elm

To simulate a basic swarm behaviour, you only have to implement three rules:

  1. If my closest neighbour is too far away, move toward him.
  2. If my closest neighbour is too near, move away from him.
  3. Otherwise, move in the same direction as my closest neighbour.

I implemented these rules in Elm during a live coding session. You can find the result on Github.

  • elm

See Also

  • Life in Weeks
  • Running Pace Calculator
  • Handling Single, Double, Triple, Quadruple Clicks in Elm
  • privacy policy