## Have we already seen this number? (deja vu again)

8th April 2016

I had a phone interview for a Python job the other day. It started out really well, he was very impressed with my CV and called me a ‘rocket scientist’. But then we got down to the technical questions and my brain decided to go out to lunch, and (yet again) I managed to snatch defeat […]

## Drawing Fractals with Lindenmayer Systems

17th June 2015

Lindenmayer systems, or L-systems, provide a very powerful way to construct fractals. Lindenmayer used L-systems to describe the behaviour of plant cells and to model the growth processes of plant development. An L-system is a rewriting system and a type of formal grammar. It consists of an alphabet of symbols that can be used to make […]

## Tweetable Python Code Golf

9th June 2015

Code Golf is the amusement of writing as short as possible a program to perform a given task. So for example, if the task is to compute the average of a list of numbers (which could be changed at any moment), you might do this: 140 characters (just by coincidence!), or this: 42 characters. In […]

## Fast Mandelbrot Set by QuadTree

27th May 2015

Most Mandelbrot Set programs proceed along the display area, pixel by pixel horizontally, row by row from top to bottom. This one doesn’t. It divides up the screen into 6 horizontal squares in 2 rows, then for each one, checks the value of the escape time for the pixel at each corner. If they’re all the […]

## Sierpinski Triangle, drawn by a Turtle

18th April 2015

This is a classic fractal drawn with a recursion algorithm and Turtle graphics. The Sierpinski Triangle’s sides are bisected and the triangle they form is removed. The procedure is then applied to the 3 remaining triangles, and to them recursively or until the Universe ends. Note that the use of recursion allows the code to […]

## Naive Mandelbrot Set

17th April 2015

This is your basic Mandelbrot Set plotter. Very little effort made to speed it up, except for plotting top & bottom pixels together as they’re mirrored across the x-axis. Later I’ll show you some much faster programs! The heart of this program is the iteration of z2+c where c is a point in the complex […]

## Fractal Tree

17th April 2015

This program draws a ‘tree’ by drawing a trunk (initially; later it’s a branch) and appending a tree, recursively. Uses Pillow.