although it gains very few upvotes, and no comments. More evidence that getting noticed is largely chance, or gaming.
Or chaotic flocking behavior. :)
If this wasn't re-posted I wouldn't be able to read it as I missed the first submission. Maybe a suggestion would be having an additional link of 'resumitted' ie: http://news.ycombinator.com/resub Then you can catchup on interesting articles previously submitted.
As for gaming - submissions has always been flakey. A simple check in the submission code could against previous submissions. Rejecting slight differences in a url.
But yeah, as ever, not enough people monitor /new (or there's not enough incentive to do so).
I actually took this code as challenge to learn how to put together idiomatic, fast Clojure code that read better than the original Java on which it is based.
Of course, nearly a year later since I wrote this version, I can see ways to make it even faster (nearly on par with Java and faster when parallel), cleaner and more elegant.
Here's an implementation I wrote last month for fun: http://breefield.com/lab/flock.
It doesn't have much bias in terms of direction (there's no wind, or patterns to follow), so there's generally one large swarm. Click-drag to create repellers, boids follow mouse.
The white center of each boid shrinks at it's velocity increases, and the inverse happens to it's red direction line. Purple specks indicate perceived center of nearby flock. The rest is just aesthetic.
It's always super interesting to see other implementations in action, so please share more in your comments, if you have them. I'd certainly love to see them.
It kind of worked, there were issues with stragglers and making it look organic that I couldn't fix in time. If ships got too far outside the formation sometimes they would only try aligning with the leader instead of catching up first. Also, when they did get in formation, they were eerily good at matching the leader's alignment: all ships would turn in unison and kind of ruin the organic feel of the pure flocking algorithm.
Cool sounding use case though!
At a research company I worked at we used swarming concepts for controlling swarms of sensors, robots, and UAVs. We also used ant colony optimization techniques mixed with genetic algorithms to do predictive intelligence. Really powerful stuff.
(Java applet warning!)
The source code is here:
Such a simple algorithm w/ such a cool result.
Thank you, everyone in the comments who submitted source code or demos. You never know when something you upload will really brighten someone's day (even if it's written in java).
For anyone interested, here is the Craig Reynolds page that describes the flocking behavior http://www.red3d.com/cwr/boids/