# AoC 2017 Day 21: Fractal Expander

### Source: Fractal Art

Part 1: Start with an input image made of . and # pixels. For n iterations, break the image into blocks:

• If the current size is even, break the image into 2x2 chunks and replace each with a 3x3 chunk
• If the current size is odd, break the image into 3x3 chunks and replace each with a 4x4 chunk

The replacement rules will be specified in the following format (example is a 3x3 -> 4x4 rule):

.#./..#/### => #..#/..../..../#..#


In that example, replace this:

.#.
..#
###


With this:

#..#
....
....
#..#


Any rotation or reflection of a chunk can be used to match the input of a replacement rule.

After n = 18 iterations, how many # pixels are there?

# AoC 2016 Day 17: Md5 Maze

### Source: Two Steps Forward

Part 1: Create a 4x4 grid of rooms with doors Up, Down, Left, and Right from each location. To determine if a door is currently open:

• Calculate MD5(salt + sequence) where sequence is a string containing any combination of UDLR depending on how you got to this room
• The first four hex values represent the doors Up, Down, Left, and Right respectively: bcdef means open; anything else is closed

Find the shortest path from (0, 0) to (3, 3).

# AoC 2016 Day 16: Dragon Data

### Source: Dragon Checksum

Part 1: Generate noise using a modified dragon curve:

• Start with data a
• Create a copy of the data b, reverse and invert it (0 <-> 1)
• Create the string a0b

Repeat until you have enough data, truncate at the end if needed.

From this string calculate a checksum as follows:

• xor each pair of bits, concatenate the results
• If the resulting string has an even length, repeat; if it’s odd, stop

Calculate the checksum of a given initial state expanded to 272 bits.

# AoC 2016 Day 13: Noisy Puzzle

### Source: A Maze of Twisty Little Cubicles1

Part 1: Generate a procedurally generated maze using the following equation:

• x^2 + 3x + 2xy + y + y^2 + c

x and y are the coordinates of a point and c is a constant.

Count the number of bits for each point. Even is open spaces, odd is walls.

What is the shortest route from (0, 0) to (31, 39)?

# Let it snow!

♫ Oh the weather outside is frightful1… ♫

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.

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:

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:

# Langton's ant

Here’s another post from /r/DailyProgrammer: Advanced Langton’s Ant. I’m a bit behind the times (see tomorrow’s post), but it’s still an interesting enough exercise, so let’s go for it!