Thursday, 25 December 2014
Monday, 20 October 2014
A Murmuration of Arrows
Flocks of birds are an interesting example of complex dynamics arising from individual agents interacting without a central controller. Computer models of flocks begin with boids and get more and more complicated. Here I made a program to run a simple model called the Viscek Model. The rules are that every bird (drawn as an arrow) tries to fly in the average direction that all his neighbours are flying. There is a certain radius that each bird can see and a certain amount of randomness in the steering.
I also added a different kind of bird species that the birds do their best to avoid, drawn as dots, call them planes. If a bird is approaching a plane it tries to steer away from it, while also staying in the flock. The closer a bird is to a plane the more the plane affects the direction of the bird. Click the screen to make a plane appear. Notice that the flocks get denser with the planes flying around, similarly to predators chasing real herds, or dogs rounding up goats.
Saturday, 21 June 2014
Pong (Expert Mode)
Since pong was invented, games have become a lot more difficult. If you have mastered the 70s version try this. More points for the smaller ones, colour is irrelevant except yellows sometimes explode and don't give any points.
Tuesday, 17 June 2014
Tuesday, 15 April 2014
Almond Bread
The Mandlebrot set is a (very important) fractal. A fractal is basically a shape containing smaller copies of itself ad infinitum, usually generated by repeating some simple rule. For the Mandlebrot set the rule is: for every complex number $c$ repeat the operation \[z_{n+1} = z_n^2 + c\] if the size of $z_n$ doesn't tend to infinity then $c$ is in the set, otherwise it isn't. Of course if we ask a computer to do the iterations we can only ask it to do a finite number. We colour the point differently depending on how many iterations it takes to discover if the number is in the set or not up to some number $N$. If we reach $N$ without diverging then we colour the point black and say, to the best of our knowledge, the point is in the set.
There is a lot of fancy maths in this area, but I think that people mainly like making cool pictures, me included. So here is a Mandlebrot set for you to zoom in on. Try and find something nice by clicking on the picture and dragging the red box, look at the edges for interesting swirls. This will go very slowly for a large number of iterations $N$, so be careful you don't put it too high and crash your browser.