## Regular Expression Fractals

Oops, turns out I haven't had a post in a good long while. Before it gets even longer, I figure that I should take one off my backlog and just write it up, even if it is a little on the shorter side.

Today's post was inspired by this post on /r/dailyprogrammer a month ago today: Challenge #178 [Hard] Regular Expression Fractals. The basic idea is that you are going to take a rectangular region and divide it into four quadrants, again and again, recording the path as you go (images from that post):

## Invader Fractals

First we had Procedural Invaders. Then we used them fill up space with Fractal Invaders. But we're not

*quite*done yet! This time, let's mix things up a bit and make Invader Fractals.## Fractal Invaders

Today's post is a follow up to Sunday's post Procedural Invaders. This time around, we're going to work through two different space filling algorithms in order to eventually generate something like this:

## Look and Say

Random quick post today

^{[1]}. Basically, we want to write code to generate what's known as Look and Say sequence:To generate a member of the sequence from the previous member, read off the digits of the previous member, counting the number of digits in groups of the same digit. For example:

- 1 is read off as "one 1" or 11.
- 11 is read off as "two 1s" or 21.
- 21 is read off as "one 2, then one 1" or 1211.
- 1211 is read off as "one 1, then one 2, then two 1s" or 111221.
- 111221 is read off as "three 1s, then two 2s, then one 1" or 312211.

## Procedural Invaders

Today's post comes from a long line of 'inspired by posts' all pretty much leading back (so far as I can tell) to this post by j.tarbell: invader.procedural from 2003.

The basic idea is that we want to generate 'invaders' in the style of space invaders. Except we don't want 10 or 20, we want tens of thousands. So how do we do it? Well, take a look at this: