AoC 2016 Day 21: Scrambler

Source: Scrambled Letters and Hash

Part 1: Another virtual machine, of sorts. Start with the string abcdefgh and apply a sequence of the following commands to it:

  • swap position X with position Y = swap two positions
  • swap letter X with letter Y = swap to letters, no matter where they are
  • rotate (left|right) X steps = rotate forward or backward
  • rotate based on position of letter X = find X, rotate right based on its position; if the original position was >= 4, rotate one more1
  • reverse positions X through Y = reverse a subset of the string
  • move position X to position Y = take a character at a position out of the string and put it somewhere else specific

read more...


AoC 2016 Day 18: Its A Trap

Source: Like a Rogue

Part 1: Starting with a sequence of . and ^, generate additional rows using the rules based on the three characters above the new position.

  • ^^. -> ^
  • .^^ -> ^
  • ^.. -> ^
  • ..^ -> ^
  • Otherwise -> .

How many safe tiles (.) are there after 40 generations?

read more...


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).

read more...


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.

read more...


AoC 2016 Day 14: Bad One Time Pads

Source: One-Time Pad

Part 1: Calculate a series of MD5 hashes (the same as Day 5). A hash is considered valid if it contains a triple (three characters in a row) and somewhere in the next 1000 hashes there is a quintuple of that same character.

What index produces the 64th key?

read more...