Generating Fractal Images with Python and ChatGPT Was Fun

A few weeks ago when I was talking with some friends the topics of fractals and ChatGPT came up (along with some other things). A few days later when I was going for a run I thought it might be neat to see if I could have ChatGPT write some Python code to draw images of fractals.

I’ll have to admit that I’ve been a terminal jockey for most of my life. I’ve never written any GUI code that isn’t a web app. Based on that I decided to go with a simple Click application to handle selecting the different fractals.

This was an interesting experience. Most of the code works great, except that the Mandelbrodt set code stops drawing after a few minutes. The program never actually crashes, it just stops doing anything. The code it generates is pretty damned ugly too. Pylint scores pretty much all if it at 0. I have a branch created to clean it up, and I’ll probably work on it when I have some free time.

Right now, at least for generating code, I’d call ChatGPT “fancy autocomplete” for lack of a better term. I can see it being useful for generating boilerplate code and things along those lines, but although it could theoretically be used to generate some complicated code I really wouldn’t trust it with something I didn’t understand.

Regardless, you can take a look at the code and take a look for yourself.

Related Posts