Shittiest code ever. The maths are interesting but my code is utter shit