Once when browsing the Web, I ran into a Java applet simulating the fleeting / flocking behaviour of animals guided by a few simple directives. I was eager to make a version of my own, and since I knew no other "decent" programming languages, I made it in Turbo Pascal. Now, some years later, I decided to convert it to Java for the sake of exercise (thus sort of re-inventing the wheel, as similar applets exist already). Here it is anyway for anyone who considers a screensaver to be an epic mini-series.
The creatures (which i called "tads" short for tadpoles) move according to these rules:
If you wish to copy the applet, you may do so, as long as you attribute its author. Just copy the files TFlock.class and Tad.class in this directory and place the following code in your HTML-file:
<applet code="TFlock.class width=(width) height=(height)"> <param name="Amount" value="(Number of beasts)"></applet>
The param-tag is optional, if it is omitted or if the value if inadequate, 20 creatures will be created.
Obviously, there's no point in cramming the creatures in a very small applet, they'll just end up swimming about in circles.
I was planning to vary the applet by adding "predators", which the "prey" creatues would avoid, but since such applets already exist, I might not go through the trouble. Just search with any search engine using the terms e.g. fleeting or flocking and applet(s).