From c5de1ed5aa60fd9879727b3ab86130f58552da8e Mon Sep 17 00:00:00 2001 From: Neil Smith Date: Wed, 6 Dec 2017 22:27:41 +0000 Subject: [PATCH] Added some problem specifications --- problems/{day1.html => day01.html} | 0 problems/{day2.html => day02.html} | 0 problems/day03.html | 164 +++++++++++++++++++++++++++++ problems/day04.html | 149 ++++++++++++++++++++++++++ problems/day05.html | 154 +++++++++++++++++++++++++++ problems/day06.html | 148 ++++++++++++++++++++++++++ 6 files changed, 615 insertions(+) rename problems/{day1.html => day01.html} (100%) rename problems/{day2.html => day02.html} (100%) create mode 100644 problems/day03.html create mode 100644 problems/day04.html create mode 100644 problems/day05.html create mode 100644 problems/day06.html diff --git a/problems/day1.html b/problems/day01.html similarity index 100% rename from problems/day1.html rename to problems/day01.html diff --git a/problems/day2.html b/problems/day02.html similarity index 100% rename from problems/day2.html rename to problems/day02.html diff --git a/problems/day03.html b/problems/day03.html new file mode 100644 index 0000000..1fbb03a --- /dev/null +++ b/problems/day03.html @@ -0,0 +1,164 @@ + + + + +Day 3 - Advent of Code 2017 + + + + + + +

Advent of Code

Neil Smith (AoC++) 12*

   sub y{2017}

+ + + +
+

--- Day 3: Spiral Memory ---

You come across an experimental new kind of memory stored on an infinite two-dimensional grid.

+

Each square on the grid is allocated in a spiral pattern starting at a location marked 1 and then counting up while spiraling outward. For example, the first few squares are allocated like this:

+
17  16  15  14  13
+18   5   4   3  12
+19   6   1   2  11
+20   7   8   9  10
+21  22  23---> ...
+
+

While this is very space-efficient (no squares are skipped), requested data must be carried back to square 1 (the location of the only access port for this memory system) by programs that can only move up, down, left, or right. They always take the shortest path: the Manhattan Distance between the location of the data and square 1.

+

For example:

+
    +
  • Data from square 1 is carried 0 steps, since it's at the access port.
  • +
  • Data from square 12 is carried 3 steps, such as: down, left, left.
  • +
  • Data from square 23 is carried only 2 steps: up twice.
  • +
  • Data from square 1024 must be carried 31 steps.
  • +
+

How many steps are required to carry the data from the square identified in your puzzle input all the way to the access port?

+
+

Your puzzle answer was 480.

--- Part Two ---

As a stress test on the system, the programs here clear the grid and then store the value 1 in square 1. Then, in the same allocation order as shown above, they store the sum of the values in all adjacent squares, including diagonals.

+

So, the first few squares' values are chosen as follows:

+
    +
  • Square 1 starts with the value 1.
  • +
  • Square 2 has only one adjacent filled square (with value 1), so it also stores 1.
  • +
  • Square 3 has both of the above squares as neighbors and stores the sum of their values, 2.
  • +
  • Square 4 has all three of the aforementioned squares as neighbors and stores the sum of their values, 4.
  • +
  • Square 5 only has the first and fourth squares as neighbors, so it gets the value 5.
  • +
+

Once a square is written, its value does not change. Therefore, the first few squares would receive the following values:

+
147  142  133  122   59
+304    5    4    2   57
+330   10    1    1   54
+351   11   23   25   26
+362  747  806--->   ...
+
+

What is the first value written that is larger than your puzzle input?

+
+

Your puzzle answer was 349975.

Both parts of this puzzle are complete! They provide two gold stars: **

+

At this point, you should return to your advent calendar and try another puzzle.

+

Your puzzle input was 347991.

+

You can also this puzzle.

+
+ + + + + + \ No newline at end of file diff --git a/problems/day04.html b/problems/day04.html new file mode 100644 index 0000000..51f286e --- /dev/null +++ b/problems/day04.html @@ -0,0 +1,149 @@ + + + + +Day 4 - Advent of Code 2017 + + + + + + +

Advent of Code

Neil Smith (AoC++) 12*

       Î»y.2017

+ + + +
+

--- Day 4: High-Entropy Passphrases ---

A new system policy has been put in place that requires all accounts to use a passphrase instead of simply a password. A passphrase consists of a series of words (lowercase letters) separated by spaces.

+

To ensure security, a valid passphrase must contain no duplicate words.

+

For example:

+
    +
  • aa bb cc dd ee is valid.
  • +
  • aa bb cc dd aa is not valid - the word aa appears more than once.
  • +
  • aa bb cc dd aaa is valid - aa and aaa count as different words.
  • +
+

The system's full passphrase list is available as your puzzle input. How many passphrases are valid?

+
+

Your puzzle answer was 383.

--- Part Two ---

For added security, yet another system policy has been put in place. Now, a valid passphrase must contain no two words that are anagrams of each other - that is, a passphrase is invalid if any word's letters can be rearranged to form any other word in the passphrase.

+

For example:

+
    +
  • abcde fghij is a valid passphrase.
  • +
  • abcde xyz ecdab is not valid - the letters from the third word can be rearranged to form the first word.
  • +
  • a ab abc abd abf abj is a valid passphrase, because all letters need to be used when forming another word.
  • +
  • iiii oiii ooii oooi oooo is valid.
  • +
  • oiii ioii iioi iiio is not valid - any of these words can be rearranged to form any other word.
  • +
+

Under this new system policy, how many passphrases are valid?

+
+

Your puzzle answer was 265.

Both parts of this puzzle are complete! They provide two gold stars: **

+

At this point, you should return to your advent calendar and try another puzzle.

+

If you still want to see it, you can get your puzzle input.

+

You can also this puzzle.

+
+ + + + + + \ No newline at end of file diff --git a/problems/day05.html b/problems/day05.html new file mode 100644 index 0000000..a9cccd2 --- /dev/null +++ b/problems/day05.html @@ -0,0 +1,154 @@ + + + + +Day 5 - Advent of Code 2017 + + + + + + +

Advent of Code

Neil Smith (AoC++) 12*

   $year=2017;

+ + + +
+

--- Day 5: A Maze of Twisty Trampolines, All Alike ---

An urgent interrupt arrives from the CPU: it's trapped in a maze of jump instructions, and it would like assistance from any programs with spare cycles to help find the exit.

+

The message includes a list of the offsets for each jump. Jumps are relative: -1 moves to the previous instruction, and 2 skips the next one. Start at the first instruction in the list. The goal is to follow the jumps until one leads outside the list.

+

In addition, these instructions are a little strange; after each jump, the offset of that instruction increases by 1. So, if you come across an offset of 3, you would move three instructions forward, but change it to a 4 for the next time it is encountered.

+

For example, consider the following list of jump offsets:

+
0
+3
+0
+1
+-3
+
+

Positive jumps ("forward") move downward; negative jumps move upward. For legibility in this example, these offset values will be written all on one line, with the current instruction marked in parentheses. The following steps would be taken before an exit is found:

+
    +
  • (0) 3  0  1  -3  - before we have taken any steps.
  • +
  • (1) 3  0  1  -3  - jump with offset 0 (that is, don't jump at all). Fortunately, the instruction is then incremented to 1.
  • +
  •  2 (3) 0  1  -3  - step forward because of the instruction we just modified. The first instruction is incremented again, now to 2.
  • +
  •  2  4  0  1 (-3) - jump all the way to the end; leave a 4 behind.
  • +
  •  2 (4) 0  1  -2  - go back to where we just were; increment -3 to -2.
  • +
  •  2  5  0  1  -2  - jump 4 steps forward, escaping the maze.
  • +
+

In this example, the exit is reached in 5 steps.

+

How many steps does it take to reach the exit?

+
+

Your puzzle answer was 315613.

--- Part Two ---

Now, the jumps are even stranger: after each jump, if the offset was three or more, instead decrease it by 1. Otherwise, increase it by 1 as before.

+

Using this rule with the above example, the process now takes 10 steps, and the offset values after finding the exit are left as 2 3 2 3 -1.

+

How many steps does it now take to reach the exit?

+
+

Your puzzle answer was 22570529.

Both parts of this puzzle are complete! They provide two gold stars: **

+

At this point, you should return to your advent calendar and try another puzzle.

+

If you still want to see it, you can get your puzzle input.

+

You can also this puzzle.

+
+ + + + + + \ No newline at end of file diff --git a/problems/day06.html b/problems/day06.html new file mode 100644 index 0000000..2faeff7 --- /dev/null +++ b/problems/day06.html @@ -0,0 +1,148 @@ + + + + +Day 6 - Advent of Code 2017 + + + + + + +

Advent of Code

Neil Smith (AoC++) 12*

   $year=2017;

+ + + +
+

--- Day 6: Memory Reallocation ---

A debugger program here is having an issue: it is trying to repair a memory reallocation routine, but it keeps getting stuck in an infinite loop.

+

In this area, there are sixteen memory banks; each memory bank can hold any number of blocks. The goal of the reallocation routine is to balance the blocks between the memory banks.

+

The reallocation routine operates in cycles. In each cycle, it finds the memory bank with the most blocks (ties won by the lowest-numbered memory bank) and redistributes those blocks among the banks. To do this, it removes all of the blocks from the selected bank, then moves to the next (by index) memory bank and inserts one of the blocks. It continues doing this until it runs out of blocks; if it reaches the last memory bank, it wraps around to the first one.

+

The debugger would like to know how many redistributions can be done before a blocks-in-banks configuration is produced that has been seen before.

+

For example, imagine a scenario with only four memory banks:

+
    +
  • The banks start with 0, 2, 7, and 0 blocks. The third bank has the most blocks, so it is chosen for redistribution.
  • +
  • Starting with the next bank (the fourth bank) and then continuing to the first bank, the second bank, and so on, the 7 blocks are spread out over the memory banks. The fourth, first, and second banks get two blocks each, and the third bank gets one back. The final result looks like this: 2 4 1 2.
  • +
  • Next, the second bank is chosen because it contains the most blocks (four). Because there are four memory banks, each gets one block. The result is: 3 1 2 3.
  • +
  • Now, there is a tie between the first and fourth memory banks, both of which have three blocks. The first bank wins the tie, and its three blocks are distributed evenly over the other three banks, leaving it with none: 0 2 3 4.
  • +
  • The fourth bank is chosen, and its four blocks are distributed such that each of the four banks receives one: 1 3 4 1.
  • +
  • The third bank is chosen, and the same thing happens: 2 4 1 2.
  • +
+

At this point, we've reached a state we've seen before: 2 4 1 2 was already seen. The infinite loop is detected after the fifth block redistribution cycle, and so the answer in this example is 5.

+

Given the initial block counts in your puzzle input, how many redistribution cycles must be completed before a configuration is produced that has been seen before?

+
+

Your puzzle answer was 7864.

--- Part Two ---

Out of curiosity, the debugger would also like to know the size of the loop: starting from a state that has already been seen, how many block redistribution cycles must be performed before that same state is seen again?

+

In the example above, 2 4 1 2 is seen again after four cycles, and so the answer in that example would be 4.

+

How many cycles are in the infinite loop that arises from the configuration in your puzzle input?

+
+

Your puzzle answer was 1695.

Both parts of this puzzle are complete! They provide two gold stars: **

+

At this point, you should return to your advent calendar and try another puzzle.

+

If you still want to see it, you can get your puzzle input.

+

You can also this puzzle.

+
+ + + + + + \ No newline at end of file -- 2.34.1