When it's run on my iPad mini the Pythonista app crashes after around 100 seconds every time. My plan is to cut away as much as possible of the code and still keep the crash, then maybe Ole can identify the problem. But since I just ran out of weekend I appreciate all the help I can get from you guys. Either I'm doing something weird or there is a bug somewhere. My bet at the moment is that there is a memory leak somewhere.

Up to 12 boids can swarm around the screen in 60 fps (on my iPad mini). If you touch the screen their flocking behaviour is reversed so they want to "fly solo". If I knew how to include a screenshot of the boids and obstacles it would be here :-) :