# Cody M. Lewis

## Playing with Fractals

### The Structure

I messed around with generating fractals using the python turtle library.

Fractal generation is formed using a L-system, these systems can be interpreted as a regular grammar, so drawing can be implemented using a recursive algorithm with only a few rules defined.

I defined two rules, the first being the initial and general shape of the fractal, and the second being the recursive shape defined in it.

### Triangle Fractals

For triangle fractals the first step was defined to draw forward, turn 120 degrees, draw forward, turn 120 degrees, draw forward. This generates an equilateral triangle. I next tried two different secondary, recursive rules at 4 levels of recursion. They both used the following rule, only with differing angles, ω → ω - ω + ω - ω - ω + ω + ω ω. Where, omega is the recursive rule, - means turn right, and + means turn left.

I first with 60 degree turns, here is the result, I next tried with 90 degree turns, which results in, With triangles, I seemed to be able to create interesting shuriken shapes, however, my next thought was to try to create a fractals with a dodecagon start.

### Dodecagon Fractals

I modified the first rule to be forward then turn 30 degrees 12 times to draw a dodecagon.

These seem to form wheel or cog shapes fractals, here is what 4 recursions with 90 degree turns looks like, I tried drawing a fractal using the Koch curve rule, ω → ω + ω - ω - ω + ω, this yet again resulted in another cog shape, ### Closure

You can draw some interesting fractals using 2 rule context free grammars, and even base them off of shapes through the definition of the first rule. It could be quite fun to find what can be created using this approach. ⬆ Back to top