Java Flies Flies is now in JavaScript, link to the code is on the main page. Java flies was my first Java program, as Flies 1.0 was my first C program. It works by having each fly accelerate towards it's two nearest neighbours, which are identified by comparing the distance to the present nearest neighbours with the distance to the nearest neighbours of the nearest neighbours, and randomising a bit to help find new neighbours. Java source. I'm sure it could be optimised by a more proficient java programmer than I, but it appears to be a better implementation of the algorithm than my C version. (Jeff Cragg gave me the idea for the algorithm). It's behaviour can be modified by giving it parameters to replace the default values (via HTML) , as is done for NF (the number of flies) in the html on my homepage. The other parameters are -
<applet code=flies3d.class width=250 height=250>
PS - download flies3d.class for the class file. |