diff --git a/.editorconfig b/.editorconfig
deleted file mode 100644
index 72d51b560..000000000
--- a/.editorconfig
+++ /dev/null
@@ -1,126 +0,0 @@
-###############################
-# Core EditorConfig Options #
-###############################
-root = true
-# All files
-[*]
-indent_style = space
-
-# XML project files
-[*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,projitems,shproj}]
-indent_size = 2
-
-# XML config files
-[*.{props,targets,ruleset,config,nuspec,resx,vsixmanifest,vsct}]
-indent_size = 2
-
-# Code files
-[*.{cs,csx,vb,vbx}]
-indent_size = 4
-insert_final_newline = true
-charset = utf-8-bom
-###############################
-# .NET Coding Conventions #
-###############################
-[*.{cs,vb}]
-# Organize usings
-dotnet_sort_system_directives_first = true
-# this. preferences
-dotnet_style_qualification_for_field = false:silent
-dotnet_style_qualification_for_property = false:silent
-dotnet_style_qualification_for_method = false:silent
-dotnet_style_qualification_for_event = false:silent
-# Language keywords vs BCL types preferences
-dotnet_style_predefined_type_for_locals_parameters_members = true:silent
-dotnet_style_predefined_type_for_member_access = true:silent
-# Parentheses preferences
-dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:silent
-dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:silent
-dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:silent
-dotnet_style_parentheses_in_other_operators = never_if_unnecessary:silent
-# Modifier preferences
-dotnet_style_require_accessibility_modifiers = for_non_interface_members:silent
-dotnet_style_readonly_field = true:suggestion
-# Expression-level preferences
-dotnet_style_object_initializer = true:suggestion
-dotnet_style_collection_initializer = true:suggestion
-dotnet_style_explicit_tuple_names = true:suggestion
-dotnet_style_null_propagation = true:suggestion
-dotnet_style_coalesce_expression = true:suggestion
-dotnet_style_prefer_is_null_check_over_reference_equality_method = true:silent
-dotnet_style_prefer_inferred_tuple_names = true:suggestion
-dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion
-dotnet_style_prefer_auto_properties = true:silent
-dotnet_style_prefer_conditional_expression_over_assignment = true:silent
-dotnet_style_prefer_conditional_expression_over_return = true:silent
-###############################
-# Naming Conventions #
-###############################
-# Style Definitions
-dotnet_naming_style.pascal_case_style.capitalization = pascal_case
-# Use PascalCase for constant fields
-dotnet_naming_rule.constant_fields_should_be_pascal_case.severity = suggestion
-dotnet_naming_rule.constant_fields_should_be_pascal_case.symbols = constant_fields
-dotnet_naming_rule.constant_fields_should_be_pascal_case.style = pascal_case_style
-dotnet_naming_symbols.constant_fields.applicable_kinds = field
-dotnet_naming_symbols.constant_fields.applicable_accessibilities = *
-dotnet_naming_symbols.constant_fields.required_modifiers = const
-###############################
-# C# Coding Conventions #
-###############################
-[*.cs]
-# var preferences
-csharp_style_var_for_built_in_types = true:silent
-csharp_style_var_when_type_is_apparent = true:silent
-csharp_style_var_elsewhere = true:silent
-# Expression-bodied members
-csharp_style_expression_bodied_methods = false:silent
-csharp_style_expression_bodied_constructors = false:silent
-csharp_style_expression_bodied_operators = false:silent
-csharp_style_expression_bodied_properties = true:silent
-csharp_style_expression_bodied_indexers = true:silent
-csharp_style_expression_bodied_accessors = true:silent
-# Pattern matching preferences
-csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
-csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
-# Null-checking preferences
-csharp_style_throw_expression = true:suggestion
-csharp_style_conditional_delegate_call = true:suggestion
-# Modifier preferences
-csharp_preferred_modifier_order = public,private,protected,internal,file,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,required,volatile,async:suggestion
-# Expression-level preferences
-csharp_prefer_braces = true:silent
-csharp_style_deconstructed_variable_declaration = true:suggestion
-csharp_prefer_simple_default_expression = true:suggestion
-csharp_style_prefer_local_over_anonymous_function = true:suggestion
-csharp_style_inlined_variable_declaration = true:suggestion
-###############################
-# C# Formatting Rules #
-###############################
-# New line preferences
-csharp_new_line_before_open_brace = false
-csharp_new_line_before_else = false
-csharp_new_line_before_catch = false
-csharp_new_line_before_finally = false
-csharp_new_line_before_members_in_object_initializers = false
-csharp_new_line_before_members_in_anonymous_types = false
-csharp_new_line_between_query_expression_clauses = false
-# Indentation preferences
-csharp_indent_case_contents = true
-csharp_indent_switch_labels = true
-csharp_indent_labels = flush_left
-# Space preferences
-csharp_space_after_cast = false
-csharp_space_after_keywords_in_control_flow_statements = true
-csharp_space_between_method_call_parameter_list_parentheses = false
-csharp_space_between_method_declaration_parameter_list_parentheses = false
-csharp_space_between_parentheses = false
-csharp_space_before_colon_in_inheritance_clause = true
-csharp_space_after_colon_in_inheritance_clause = true
-csharp_space_around_binary_operators = before_and_after
-csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
-csharp_space_between_method_call_name_and_opening_parenthesis = false
-csharp_space_between_method_call_empty_parameter_list_parentheses = false
-# Wrapping preferences
-csharp_preserve_single_line_statements = true
-csharp_preserve_single_line_blocks = true
\ No newline at end of file
diff --git a/.gitattributes b/.gitattributes
deleted file mode 100644
index 989d37c12..000000000
--- a/.gitattributes
+++ /dev/null
@@ -1 +0,0 @@
-**/input.in filter=git-crypt diff=git-crypt
diff --git a/.github/workflows/update-docs.yaml b/.github/workflows/update-docs.yaml
deleted file mode 100644
index 62acdb9ae..000000000
--- a/.github/workflows/update-docs.yaml
+++ /dev/null
@@ -1,53 +0,0 @@
-name: Update Docs
-
-on:
- push:
- branches:
- - master
-
-jobs:
- update-docs:
- runs-on: ubuntu-latest
-
- permissions:
- # Give the default GITHUB_TOKEN write permission to commit and push the
- # added or changed files to the repository.
- contents: write
-
- steps:
- - name: Checkout repository
- uses: actions/checkout@v3
-
- - name: Configure Git
- run: |
- # Configure Git
- git config --global user.name "github-actions[bot]"
- git config --global user.email "github-actions[bot]@users.noreply.github.com"
-
- - name: Set up Node.js
- uses: actions/setup-node@v3
- with:
- node-version: '16' # Update based on your project's requirements
-
- - name: Build
- run: |
- cd docs;
- npm install
- cd ..
- ls -la
- node docs/build.js
-
-
- - name: Checkout docs repository
- uses: actions/checkout@v3
- with:
- path: distr
- ref: docs
-
- - name: Deploy docs
- run: |
- rsync -av --exclude='.git/' --del build/ distr/
- cd distr
- git add .
- git commit -m "Update docs on $(date)"
- git push --force origin docs
diff --git a/.gitignore b/.gitignore
index f96db2252..30143d296 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,5 +1,4 @@
bin
obj
-aoc-crypt.key
-docs/node_modules
-build
+session.txt
+.vs/*
diff --git a/.vs/adventofcode/v17/TestStore/0/000.testlog b/.vs/adventofcode/v17/TestStore/0/000.testlog
new file mode 100644
index 000000000..6bbf10ed8
Binary files /dev/null and b/.vs/adventofcode/v17/TestStore/0/000.testlog differ
diff --git a/.vs/adventofcode/v17/TestStore/0/testlog.manifest b/.vs/adventofcode/v17/TestStore/0/testlog.manifest
new file mode 100644
index 000000000..e92ede29d
Binary files /dev/null and b/.vs/adventofcode/v17/TestStore/0/testlog.manifest differ
diff --git a/.vscode/launch.json b/.vscode/launch.json
index 86b12f55e..75419e564 100644
--- a/.vscode/launch.json
+++ b/.vscode/launch.json
@@ -11,7 +11,7 @@
"request": "launch",
"preLaunchTask": "build",
// If you have changed target frameworks, make sure to update the program path.
- "program": "${workspaceFolder}/bin/Debug/net9.0/adventofcode.dll",
+ "program": "${workspaceFolder}/bin/Debug/net8.0/adventofcode.dll",
"args": ["${relativeFileDirname}"],
"cwd": "${workspaceFolder}",
// For more information about the 'console' field, see https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md#console-terminal-window
diff --git a/2015/Day01/README.md b/2015/Day01/README.md
deleted file mode 100644
index e6654b029..000000000
--- a/2015/Day01/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-## --- Day 1: Not Quite Lisp ---
-Santa was hoping for a white Christmas, but his weather machine's "snow" function is powered by stars, and he's fresh out! To save Christmas, he needs you to collect fifty stars by December 25th.
-
-Collect stars by helping Santa solve puzzles. Two puzzles will be made available on each day in the Advent calendar; the second puzzle is unlocked when you complete the first. Each puzzle grants one star. Good luck!
-
-_Visit the website for the full story and [full puzzle](https://adventofcode.com/2015/day/1) description._
diff --git a/2015/Day01/Solution.cs b/2015/Day01/Solution.cs
deleted file mode 100644
index 48673bec0..000000000
--- a/2015/Day01/Solution.cs
+++ /dev/null
@@ -1,20 +0,0 @@
-using System.Collections.Generic;
-using System.Linq;
-
-namespace AdventOfCode.Y2015.Day01;
-
-[ProblemName("Not Quite Lisp")]
-class Solution : Solver {
-
- public object PartOne(string input) => Levels(input).Last().level;
-
- public object PartTwo(string input) => Levels(input).First(p => p.level == -1).idx;
-
- IEnumerable<(int idx, int level)> Levels(string input){
- var level = 0;
- for (var i = 0; i < input.Length; i++) {
- level += input[i] == '(' ? 1 : -1;
- yield return (i+1, level);
- }
- }
-}
diff --git a/2015/Day01/illustration.jpeg b/2015/Day01/illustration.jpeg
deleted file mode 100644
index 999d41141..000000000
Binary files a/2015/Day01/illustration.jpeg and /dev/null differ
diff --git a/2015/Day01/input.in b/2015/Day01/input.in
deleted file mode 100644
index efdae0d4d..000000000
Binary files a/2015/Day01/input.in and /dev/null differ
diff --git a/2015/Day01/input.refout b/2015/Day01/input.refout
deleted file mode 100644
index a0be33c18..000000000
--- a/2015/Day01/input.refout
+++ /dev/null
@@ -1,2 +0,0 @@
-280
-1797
\ No newline at end of file
diff --git a/2015/Day02/README.md b/2015/Day02/README.md
deleted file mode 100644
index 91b468e7c..000000000
--- a/2015/Day02/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-## --- Day 2: I Was Told There Would Be No Math ---
-The elves are running low on wrapping paper, and so they need to submit an order for more. They have a list of the dimensions (length `l`, width `w`, and height `h`) of each present, and only want to order exactly as much as they need.
-
-Fortunately, every present is a box (a perfect [right rectangular prism](https://en.wikipedia.org/wiki/Cuboid#Rectangular_cuboid)), which makes calculating the required wrapping paper for each gift a little easier: find the surface area of the box, which is `2*l*w + 2*w*h + 2*h*l`. The elves also need a little extra paper for each present: the area of the smallest side.
-
-Read the [full puzzle](https://adventofcode.com/2015/day/2).
\ No newline at end of file
diff --git a/2015/Day02/Solution.cs b/2015/Day02/Solution.cs
deleted file mode 100644
index 1b2260082..000000000
--- a/2015/Day02/Solution.cs
+++ /dev/null
@@ -1,25 +0,0 @@
-using System.Collections.Generic;
-using System.Linq;
-
-namespace AdventOfCode.Y2015.Day02;
-
-[ProblemName("I Was Told There Would Be No Math")]
-class Solution : Solver {
-
- public object PartOne(string input) => (
- from nums in Parse(input)
- select 2 * (nums[0] * nums[1] + nums[1] * nums[2] + nums[0] * nums[2]) + nums[0] * nums[1]
- ).Sum();
-
- public object PartTwo(string input) => (
- from nums in Parse(input)
- select nums[0] * nums[1] * nums[2] + 2 * (nums[0] + nums[1])
- ).Sum();
-
- IEnumerable Parse(string input) {
- return (from line in input.Split('\n')
- let parts = line.Split('x')
- let nums = parts.Select(int.Parse).OrderBy(x => x).ToArray()
- select nums);
- }
-}
diff --git a/2015/Day02/illustration.jpeg b/2015/Day02/illustration.jpeg
deleted file mode 100644
index 23432437a..000000000
Binary files a/2015/Day02/illustration.jpeg and /dev/null differ
diff --git a/2015/Day02/input.in b/2015/Day02/input.in
deleted file mode 100644
index ee590c717..000000000
Binary files a/2015/Day02/input.in and /dev/null differ
diff --git a/2015/Day02/input.refout b/2015/Day02/input.refout
deleted file mode 100644
index f3d21caef..000000000
--- a/2015/Day02/input.refout
+++ /dev/null
@@ -1,2 +0,0 @@
-1606483
-3842356
diff --git a/2015/Day03/README.md b/2015/Day03/README.md
deleted file mode 100644
index 06678a506..000000000
--- a/2015/Day03/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-## --- Day 3: Perfectly Spherical Houses in a Vacuum ---
-Santa is delivering presents to an infinite two-dimensional grid of houses.
-
-He begins by delivering a present to the house at his starting location, and then an elf at the North Pole calls him via radio and tells him where to move next. Moves are always exactly one house to the north (`^`), south (`v`), east (`>`), or west (`<`). After each move, he delivers another present to the house at his new location.
-
-Read the [full puzzle](https://adventofcode.com/2015/day/3).
\ No newline at end of file
diff --git a/2015/Day03/Solution.cs b/2015/Day03/Solution.cs
deleted file mode 100644
index 4e381e1b5..000000000
--- a/2015/Day03/Solution.cs
+++ /dev/null
@@ -1,35 +0,0 @@
-using System.Collections.Generic;
-using System.Linq;
-
-namespace AdventOfCode.Y2015.Day03;
-
-[ProblemName("Perfectly Spherical Houses in a Vacuum")]
-class Solution : Solver {
-
- public object PartOne(string input) => Run(input, 1);
-
- public object PartTwo(string input) => Run(input, 2);
-
- int Run(string input, int actors) {
-
- var seen = new HashSet<(int, int)>();
- var pos = new(int irow, int icol)[actors];
- for (var i = 0; i < actors; i++) {
- pos[i] = (0, 0);
- }
- seen.Add((0,0));
-
- var actor = 0;
- foreach (var ch in input) {
- switch (ch) {
- case 'v': pos[actor].irow++; break;
- case '<': pos[actor].icol--; break;
- case '>': pos[actor].icol++; break;
- case '^': pos[actor].irow--; break;
- }
- seen.Add(pos[actor]);
- actor = (actor + 1) % actors;
- }
- return seen.Count();
- }
-}
diff --git a/2015/Day03/illustration.jpeg b/2015/Day03/illustration.jpeg
deleted file mode 100644
index 60cacbd93..000000000
Binary files a/2015/Day03/illustration.jpeg and /dev/null differ
diff --git a/2015/Day03/input.in b/2015/Day03/input.in
deleted file mode 100644
index 065d2f825..000000000
Binary files a/2015/Day03/input.in and /dev/null differ
diff --git a/2015/Day03/input.refout b/2015/Day03/input.refout
deleted file mode 100644
index 8c7d2c327..000000000
--- a/2015/Day03/input.refout
+++ /dev/null
@@ -1,2 +0,0 @@
-2572
-2631
diff --git a/2015/Day04/README.md b/2015/Day04/README.md
deleted file mode 100644
index a52193422..000000000
--- a/2015/Day04/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-## --- Day 4: The Ideal Stocking Stuffer ---
-Santa needs help [mining](https://en.wikipedia.org/wiki/Bitcoin#Mining) some AdventCoins (very similar to [bitcoins](https://en.wikipedia.org/wiki/Bitcoin)) to use as gifts for all the economically forward-thinking little girls and boys.
-
-To do this, he needs to find [MD5](https://en.wikipedia.org/wiki/MD5) hashes which, in [hexadecimal](https://en.wikipedia.org/wiki/Hexadecimal), start with at least *five zeroes*. The input to the MD5 hash is some secret key (your puzzle input, given below) followed by a number in decimal. To mine AdventCoins, you must find Santa the lowest positive number (no leading zeroes: `1`, `2`, `3`, ...) that produces such a hash.
-
-Read the [full puzzle](https://adventofcode.com/2015/day/4).
\ No newline at end of file
diff --git a/2015/Day04/Solution.cs b/2015/Day04/Solution.cs
deleted file mode 100644
index a487524e2..000000000
--- a/2015/Day04/Solution.cs
+++ /dev/null
@@ -1,42 +0,0 @@
-using System.Collections.Concurrent;
-using System.Linq;
-using System.Collections.Generic;
-using System.Security.Cryptography;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace AdventOfCode.Y2015.Day04;
-
-[ProblemName("The Ideal Stocking Stuffer")]
-class Solution : Solver {
-
- public object PartOne(string input) => ParallelFind(input, "00000");
- public object PartTwo(string input) => ParallelFind(input, "000000");
-
- int ParallelFind(string input, string prefix) {
- var q = new ConcurrentQueue();
-
- Parallel.ForEach(
- Numbers(),
- () => MD5.Create(),
- (i, state, md5) => {
- var hashBytes = md5.ComputeHash(Encoding.ASCII.GetBytes(input + i));
- var hash = string.Join("", hashBytes.Select(b => b.ToString("x2")));
-
- if (hash.StartsWith(prefix)) {
- q.Enqueue(i);
- state.Stop();
- }
- return md5;
- },
- (_) => {}
- );
- return q.Min();
- }
-
- IEnumerable Numbers() {
- for (int i=0; ;i++) {
- yield return i;
- }
- }
-}
diff --git a/2015/Day04/illustration.jpeg b/2015/Day04/illustration.jpeg
deleted file mode 100644
index 243d89a1b..000000000
Binary files a/2015/Day04/illustration.jpeg and /dev/null differ
diff --git a/2015/Day04/input.in b/2015/Day04/input.in
deleted file mode 100644
index 7f2ce7a96..000000000
Binary files a/2015/Day04/input.in and /dev/null differ
diff --git a/2015/Day04/input.refout b/2015/Day04/input.refout
deleted file mode 100644
index f26b6b1be..000000000
--- a/2015/Day04/input.refout
+++ /dev/null
@@ -1,2 +0,0 @@
-282749
-9962624
diff --git a/2015/Day05/README.md b/2015/Day05/README.md
deleted file mode 100644
index 0c3382404..000000000
--- a/2015/Day05/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-## --- Day 5: Doesn't He Have Intern-Elves For This? ---
-Santa needs help figuring out which strings in his text file are naughty or nice.
-
-A *nice string* is one with all of the following properties:
-
-Read the [full puzzle](https://adventofcode.com/2015/day/5).
\ No newline at end of file
diff --git a/2015/Day05/Solution.cs b/2015/Day05/Solution.cs
deleted file mode 100644
index e82c867ed..000000000
--- a/2015/Day05/Solution.cs
+++ /dev/null
@@ -1,22 +0,0 @@
-using System.Linq;
-
-namespace AdventOfCode.Y2015.Day05;
-
-[ProblemName("Doesn't He Have Intern-Elves For This?")]
-class Solution : Solver {
-
- public object PartOne(string input) =>
- input.Split('\n').Count(line => {
- var threeVowels = line.Count(ch => "aeiou".Contains(ch)) >= 3;
- var duplicate = Enumerable.Range(0, line.Length - 1).Any(i => line[i] == line[i + 1]);
- var reserved = "ab,cd,pq,xy".Split(',').Any(line.Contains);
- return threeVowels && duplicate && !reserved;
- });
-
- public object PartTwo(string input) =>
- input.Split('\n').Count(line => {
- var appearsTwice = Enumerable.Range(0, line.Length - 1).Any(i => line.IndexOf(line.Substring(i, 2), i+2) >= 0);
- var repeats = Enumerable.Range(0, line.Length - 2).Any(i => line[i] == line[i + 2]);
- return appearsTwice && repeats;
- });
-}
diff --git a/2015/Day05/illustration.jpeg b/2015/Day05/illustration.jpeg
deleted file mode 100644
index 8ba151e3c..000000000
Binary files a/2015/Day05/illustration.jpeg and /dev/null differ
diff --git a/2015/Day05/input.in b/2015/Day05/input.in
deleted file mode 100644
index 78609b050..000000000
Binary files a/2015/Day05/input.in and /dev/null differ
diff --git a/2015/Day05/input.refout b/2015/Day05/input.refout
deleted file mode 100644
index a0f7914c7..000000000
--- a/2015/Day05/input.refout
+++ /dev/null
@@ -1,2 +0,0 @@
-255
-55
diff --git a/2015/Day06/README.md b/2015/Day06/README.md
deleted file mode 100644
index bc54a864c..000000000
--- a/2015/Day06/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-## --- Day 6: Probably a Fire Hazard ---
-Because your neighbors keep defeating you in the holiday house decorating contest year after year, you've decided to deploy one million lights in a 1000x1000 grid.
-
-Furthermore, because you've been especially nice this year, Santa has mailed you instructions on how to display the ideal lighting configuration.
-
-Read the [full puzzle](https://adventofcode.com/2015/day/6).
\ No newline at end of file
diff --git a/2015/Day06/Solution.cs b/2015/Day06/Solution.cs
deleted file mode 100644
index 945c9dd95..000000000
--- a/2015/Day06/Solution.cs
+++ /dev/null
@@ -1,36 +0,0 @@
-using System;
-using System.Linq;
-using System.Text.RegularExpressions;
-
-namespace AdventOfCode.Y2015.Day06;
-
-[ProblemName("Probably a Fire Hazard")]
-class Solution : Solver {
-
- public object PartOne(string input) => Run(input, _ => 1, _ => 0, v => 1 - v);
- public object PartTwo(string input) => Run(input, v => v + 1, v => v > 0 ? v - 1 : 0, v => v + 2);
-
- int Run(string input, Func turnOn, Func turnOff, Func toggle) {
- int[] apply(int[] grid, string line, string pattern, Func dg) {
- var match = Regex.Match(line, pattern);
- if (match.Success) {
- var rect = match.Groups.Cast().Skip(1).Select(g => int.Parse(g.Value)).ToArray();
- for (int irow = rect[0]; irow <= rect[2]; irow++) {
- for (int icol = rect[1]; icol <= rect[3]; icol++) {
- grid[irow * 1000 + icol] = dg(grid[irow * 1000 + icol]);
- }
- }
- return grid;
- } else {
- return null;
- }
- }
- return input.Split('\n')
- .Aggregate(new int[1000 * 1000], (grid, line) =>
- apply(grid, line, @"turn on (\d+),(\d+) through (\d+),(\d+)", turnOn) ??
- apply(grid, line, @"turn off (\d+),(\d+) through (\d+),(\d+)", turnOff) ??
- apply(grid, line, @"toggle (\d+),(\d+) through (\d+),(\d+)", toggle) ??
- throw new Exception(line))
- .Sum();
- }
-}
diff --git a/2015/Day06/illustration.jpeg b/2015/Day06/illustration.jpeg
deleted file mode 100644
index 3b62f677b..000000000
Binary files a/2015/Day06/illustration.jpeg and /dev/null differ
diff --git a/2015/Day06/input.in b/2015/Day06/input.in
deleted file mode 100644
index be73cadf4..000000000
Binary files a/2015/Day06/input.in and /dev/null differ
diff --git a/2015/Day06/input.refout b/2015/Day06/input.refout
deleted file mode 100644
index 5bd6465cd..000000000
--- a/2015/Day06/input.refout
+++ /dev/null
@@ -1,2 +0,0 @@
-569999
-17836115
diff --git a/2015/Day07/README.md b/2015/Day07/README.md
deleted file mode 100644
index 7a4b1c9a3..000000000
--- a/2015/Day07/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-## --- Day 7: Some Assembly Required ---
-This year, Santa brought little Bobby Tables a set of wires and [bitwise logic gates](https://en.wikipedia.org/wiki/Bitwise_operation)! Unfortunately, little Bobby is a little under the recommended age range, and he needs help assembling the circuit.
-
-Each wire has an identifier (some lowercase letters) and can carry a [16-bit](https://en.wikipedia.org/wiki/16-bit) signal (a number from `0` to `65535`). A signal is provided to each wire by a gate, another wire, or some specific value. Each wire can only get a signal from one source, but can provide its signal to multiple destinations. A gate provides no signal until all of its inputs have a signal.
-
-Read the [full puzzle](https://adventofcode.com/2015/day/7).
\ No newline at end of file
diff --git a/2015/Day07/Solution.cs b/2015/Day07/Solution.cs
deleted file mode 100644
index 7a1ad6788..000000000
--- a/2015/Day07/Solution.cs
+++ /dev/null
@@ -1,50 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text.RegularExpressions;
-
-namespace AdventOfCode.Y2015.Day07;
-
-[ProblemName("Some Assembly Required")]
-class Solution : Solver {
-
- class State : Dictionary { }
- class Calc : Dictionary> { }
-
-
- public object PartOne(string input) => Parse(input)["a"](new State());
-
- public object PartTwo(string input) {
- var calc = Parse(input);
- return calc["a"](new State() { ["b"] = calc["a"](new State()) });
- }
-
- Calc Parse(string input) =>
- input.Split('\n').Aggregate(new Calc(), (calc, line) =>
- Gate(calc, line, @"(\w+) AND (\w+) -> (\w+)", pin => pin[0] & pin[1]) ??
- Gate(calc, line, @"(\w+) OR (\w+) -> (\w+)", pin => pin[0] | pin[1]) ??
- Gate(calc, line, @"(\w+) RSHIFT (\w+) -> (\w+)", pin => pin[0] >> pin[1]) ??
- Gate(calc, line, @"(\w+) LSHIFT (\w+) -> (\w+)", pin => pin[0] << pin[1]) ??
- Gate(calc, line, @"NOT (\w+) -> (\w+)", pin => ~pin[0]) ??
- Gate(calc, line, @"(\w+) -> (\w+)", pin => pin[0]) ??
- throw new Exception(line)
- );
-
- Calc Gate(Calc calc, string line, string pattern, Func op) {
- var match = Regex.Match(line, pattern);
- if (!match.Success) {
- return null;
- }
- var parts = match.Groups.Cast().Skip(1).Select(g => g.Value).ToArray();
- var pinOut = parts.Last();
- var pins = parts.Take(parts.Length - 1).ToArray();
- calc[pinOut] = (state) => {
- if (!state.ContainsKey(pinOut)) {
- var args = pins.Select(pin => int.TryParse(pin, out var i) ? i : calc[pin](state)).ToArray();
- state[pinOut] = op(args);
- }
- return state[pinOut];
- };
- return calc;
- }
-}
diff --git a/2015/Day07/input.in b/2015/Day07/input.in
deleted file mode 100644
index 21197948f..000000000
Binary files a/2015/Day07/input.in and /dev/null differ
diff --git a/2015/Day07/input.refout b/2015/Day07/input.refout
deleted file mode 100644
index 6c659d484..000000000
--- a/2015/Day07/input.refout
+++ /dev/null
@@ -1,2 +0,0 @@
-46065
-14134
diff --git a/2015/Day08/README.md b/2015/Day08/README.md
deleted file mode 100644
index acd31d5fc..000000000
--- a/2015/Day08/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-## --- Day 8: Matchsticks ---
-Space on the sleigh is limited this year, and so Santa will be bringing his list as a digital copy. He needs to know how much space it will take up when stored.
-
-It is common in many programming languages to provide a way to escape special characters in strings. For example, [C](https://en.wikipedia.org/wiki/Escape_sequences_in_C), [JavaScript](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String), [Perl](http://perldoc.perl.org/perlop.html#Quote-and-Quote-like-Operators), [Python](https://docs.python.org/2.0/ref/strings.html), and even [PHP](http://php.net/manual/en/language.types.string.php#language.types.string.syntax.double) handle special characters in very similar ways.
-
-Read the [full puzzle](https://adventofcode.com/2015/day/8).
\ No newline at end of file
diff --git a/2015/Day08/Solution.cs b/2015/Day08/Solution.cs
deleted file mode 100644
index b9ce2d39c..000000000
--- a/2015/Day08/Solution.cs
+++ /dev/null
@@ -1,20 +0,0 @@
-using System.Linq;
-using System.Text.RegularExpressions;
-
-namespace AdventOfCode.Y2015.Day08;
-
-[ProblemName("Matchsticks")]
-class Solution : Solver {
-
- public object PartOne(string input) =>
- (from line in input.Split('\n')
- let u = Regex.Unescape(line.Substring(1, line.Length - 2))
- select line.Length - u.Length).Sum();
-
-
- public object PartTwo(string input) =>
- (from line in input.Split('\n')
- let u = "\"" + line.Replace("\\", "\\\\").Replace("\"", "\\\"") + "\""
- select u.Length - line.Length).Sum();
-
-}
diff --git a/2015/Day08/input.in b/2015/Day08/input.in
deleted file mode 100644
index a37076b5a..000000000
Binary files a/2015/Day08/input.in and /dev/null differ
diff --git a/2015/Day08/input.refout b/2015/Day08/input.refout
deleted file mode 100644
index 16f9530e1..000000000
--- a/2015/Day08/input.refout
+++ /dev/null
@@ -1,2 +0,0 @@
-1371
-2117
diff --git a/2015/Day09/README.md b/2015/Day09/README.md
deleted file mode 100644
index 9ea9bfada..000000000
--- a/2015/Day09/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-## --- Day 9: All in a Single Night ---
-Every year, Santa manages to deliver all of his presents in a single night.
-
-This year, however, he has some new locations to visit; his elves have provided him the distances between every pair of locations. He can start and end at any two (different) locations he wants, but he must visit each location exactly once. What is the *shortest distance* he can travel to achieve this?
-
-Read the [full puzzle](https://adventofcode.com/2015/day/9).
\ No newline at end of file
diff --git a/2015/Day09/Solution.cs b/2015/Day09/Solution.cs
deleted file mode 100644
index d0f622e6d..000000000
--- a/2015/Day09/Solution.cs
+++ /dev/null
@@ -1,47 +0,0 @@
-using System.Collections.Generic;
-using System.Linq;
-using System.Text.RegularExpressions;
-
-namespace AdventOfCode.Y2015.Day09;
-
-[ProblemName("All in a Single Night")]
-class Solution : Solver {
-
- public object PartOne(string input) => Routes(input).Min();
- public object PartTwo(string input) => Routes(input).Max();
-
- IEnumerable Routes(string input) {
- var distances = input.Split('\n').SelectMany(line => {
- var m = Regex.Match(line, @"(.*) to (.*) = (.*)");
- var (a, b) = (m.Groups[1].Value, m.Groups[2].Value);
- var d = int.Parse(m.Groups[3].Value);
- return new[] {
- (k: (a, b), d),
- (k: (b, a), d)
- };
- }).ToDictionary(p => p.k, p => p.d);
-
- var cities = distances.Keys.Select(k => k.Item1).Distinct().ToArray();
- return Permutations(cities).Select(route =>
- route.Zip(route.Skip(1), (a, b) => distances[(a, b)]).Sum()
- );
- }
-
- IEnumerable Permutations(T[] rgt) {
- IEnumerable PermutationsRec(int i) {
- if (i == rgt.Length) {
- yield return rgt.ToArray();
- }
-
- for (var j = i; j < rgt.Length; j++) {
- (rgt[i], rgt[j]) = (rgt[j], rgt[i]);
- foreach (var perm in PermutationsRec(i + 1)) {
- yield return perm;
- }
- (rgt[i], rgt[j]) = (rgt[j], rgt[i]);
- }
- }
-
- return PermutationsRec(0);
- }
-}
diff --git a/2015/Day09/input.in b/2015/Day09/input.in
deleted file mode 100644
index 9873e3051..000000000
Binary files a/2015/Day09/input.in and /dev/null differ
diff --git a/2015/Day09/input.refout b/2015/Day09/input.refout
deleted file mode 100644
index f6426cb51..000000000
--- a/2015/Day09/input.refout
+++ /dev/null
@@ -1,2 +0,0 @@
-141
-736
diff --git a/2015/Day10/README.md b/2015/Day10/README.md
deleted file mode 100644
index e09b557f0..000000000
--- a/2015/Day10/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-## --- Day 10: Elves Look, Elves Say ---
-Today, the Elves are playing a game called [look-and-say](https://en.wikipedia.org/wiki/Look-and-say_sequence). They take turns making sequences by reading aloud the previous sequence and using that reading as the next sequence. For example, `211` is read as "one two, two ones", which becomes `1221` (`1` `2`, `2` `1`s).
-
-Look-and-say sequences are generated iteratively, using the previous value as input for the next step. For each step, take the previous value, and replace each run of digits (like `111`) with the number of digits (`3`) followed by the digit itself (`1`).
-
-Read the [full puzzle](https://adventofcode.com/2015/day/10).
\ No newline at end of file
diff --git a/2015/Day10/Solution.cs b/2015/Day10/Solution.cs
deleted file mode 100644
index 6e4060069..000000000
--- a/2015/Day10/Solution.cs
+++ /dev/null
@@ -1,36 +0,0 @@
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-
-namespace AdventOfCode.Y2015.Day10;
-
-[ProblemName("Elves Look, Elves Say")]
-class Solution : Solver {
-
- public object PartOne(string input) => LookAndSay(input).Skip(39).First().Length;
- public object PartTwo(string input) => LookAndSay(input).Skip(49).First().Length;
-
- IEnumerable LookAndSay(string input) {
- while (true) {
- var sb = new StringBuilder();
- var ich = 0;
- while (ich < input.Length) {
- if (ich < input.Length - 2 && input[ich] == input[ich + 1] && input[ich] == input[ich + 2]) {
- sb.Append("3");
- sb.Append(input[ich]);
- ich += 3;
- } else if (ich < input.Length - 1 && input[ich] == input[ich + 1]) {
- sb.Append("2");
- sb.Append(input[ich]);
- ich += 2;
- } else {
- sb.Append("1");
- sb.Append(input[ich]);
- ich += 1;
- }
- }
- input = sb.ToString();
- yield return input;
- }
- }
-}
diff --git a/2015/Day10/input.in b/2015/Day10/input.in
deleted file mode 100644
index 33556dd98..000000000
Binary files a/2015/Day10/input.in and /dev/null differ
diff --git a/2015/Day10/input.refout b/2015/Day10/input.refout
deleted file mode 100644
index 9864dc870..000000000
--- a/2015/Day10/input.refout
+++ /dev/null
@@ -1,2 +0,0 @@
-492982
-6989950
diff --git a/2015/Day11/README.md b/2015/Day11/README.md
deleted file mode 100644
index f2d68ae2a..000000000
--- a/2015/Day11/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-## --- Day 11: Corporate Policy ---
-Santa's previous password expired, and he needs help choosing a new one.
-
-To help him remember his new password after the old one expires, Santa has devised a method of coming up with a password based on the previous one. Corporate policy dictates that passwords must be exactly eight lowercase letters (for security reasons), so he finds his new password by *incrementing* his old password string repeatedly until it is valid.
-
-Read the [full puzzle](https://adventofcode.com/2015/day/11).
\ No newline at end of file
diff --git a/2015/Day11/Solution.cs b/2015/Day11/Solution.cs
deleted file mode 100644
index 561441ea8..000000000
--- a/2015/Day11/Solution.cs
+++ /dev/null
@@ -1,39 +0,0 @@
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-
-namespace AdventOfCode.Y2015.Day11;
-
-[ProblemName("Corporate Policy")]
-class Solution : Solver {
-
- public object PartOne(string input) => Passwords(input).First();
- public object PartTwo(string input) => Passwords(input).Skip(1).First();
-
- IEnumerable Passwords(string pwd) =>
- from word in Words(pwd)
- let straigth = Enumerable.Range(0, word.Length - 2).Any(i => word[i] == word[i + 1] - 1 && word[i] == word[i + 2] - 2)
- let reserved = "iol".Any(ch => word.Contains(ch))
- let pairs = Enumerable.Range(0, word.Length - 1).Select(i => word.Substring(i, 2)).Where(sword => sword[0] == sword[1]).Distinct()
- where straigth && !reserved && pairs.Count() > 1
- select word;
-
- IEnumerable Words(string word) {
- while (true) {
- var sb = new StringBuilder();
- for (var i = word.Length - 1; i >= 0; i--) {
- var ch = word[i] + 1;
- if (ch > 'z') {
- ch = 'a';
- sb.Insert(0, (char)ch);
- } else {
- sb.Insert(0, (char)ch);
- sb.Insert(0, word.Substring(0, i));
- i = 0;
- }
- }
- word = sb.ToString();
- yield return word;
- }
- }
-}
diff --git a/2015/Day11/input.in b/2015/Day11/input.in
deleted file mode 100644
index cf3823d95..000000000
Binary files a/2015/Day11/input.in and /dev/null differ
diff --git a/2015/Day11/input.refout b/2015/Day11/input.refout
deleted file mode 100644
index 440db0b25..000000000
--- a/2015/Day11/input.refout
+++ /dev/null
@@ -1,2 +0,0 @@
-cqjxxyzz
-cqkaabcc
diff --git a/2015/Day12/README.md b/2015/Day12/README.md
deleted file mode 100644
index 45ad4b14e..000000000
--- a/2015/Day12/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-## --- Day 12: JSAbacusFramework.io ---
-Santa's Accounting-Elves need help balancing the books after a recent order. Unfortunately, their accounting software uses a peculiar storage format. That's where you come in.
-
-They have a [JSON](http://json.org/) document which contains a variety of things: arrays (`[1,2,3]`), objects (`{"a":1, "b":2}`), numbers, and strings. Your first job is to simply find all of the *numbers* throughout the document and add them together.
-
-Read the [full puzzle](https://adventofcode.com/2015/day/12).
\ No newline at end of file
diff --git a/2015/Day12/Solution.cs b/2015/Day12/Solution.cs
deleted file mode 100644
index 93df6ae3b..000000000
--- a/2015/Day12/Solution.cs
+++ /dev/null
@@ -1,27 +0,0 @@
-using System.Linq;
-using System.Text.Json;
-
-namespace AdventOfCode.Y2015.Day12;
-
-[ProblemName("JSAbacusFramework.io")]
-class Solution : Solver {
-
- public object PartOne(string input) => Solve(input, false);
- public object PartTwo(string input) => Solve(input, true);
-
- int Solve(string input, bool skipRed) {
- int Traverse(JsonElement t) {
- return t.ValueKind switch
- {
- JsonValueKind.Object when skipRed && t.EnumerateObject().Any(
- p => p.Value.ValueKind == JsonValueKind.String && p.Value.GetString() == "red") => 0,
- JsonValueKind.Object => t.EnumerateObject().Select(p => Traverse(p.Value)).Sum(),
- JsonValueKind.Array => t.EnumerateArray().Select(Traverse).Sum(),
- JsonValueKind.Number => t.GetInt32(),
- _ => 0
- };
- }
-
- return Traverse(JsonDocument.Parse(input).RootElement);
- }
-}
diff --git a/2015/Day12/input.in b/2015/Day12/input.in
deleted file mode 100644
index 6bce44176..000000000
Binary files a/2015/Day12/input.in and /dev/null differ
diff --git a/2015/Day12/input.refout b/2015/Day12/input.refout
deleted file mode 100644
index dbc02f05e..000000000
--- a/2015/Day12/input.refout
+++ /dev/null
@@ -1,2 +0,0 @@
-119433
-68466
diff --git a/2015/Day13/README.md b/2015/Day13/README.md
deleted file mode 100644
index c126f8ae3..000000000
--- a/2015/Day13/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-## --- Day 13: Knights of the Dinner Table ---
-In years past, the holiday feast with your family hasn't gone so well. Not everyone gets along! This year, you resolve, will be different. You're going to find the *optimal seating arrangement* and avoid all those awkward conversations.
-
-You start by writing up a list of everyone invited and the amount their happiness would increase or decrease if they were to find themselves sitting next to each other person. You have a circular table that will be just big enough to fit everyone comfortably, and so each person will have exactly two neighbors.
-
-Read the [full puzzle](https://adventofcode.com/2015/day/13).
\ No newline at end of file
diff --git a/2015/Day13/Solution.cs b/2015/Day13/Solution.cs
deleted file mode 100644
index 8872115ed..000000000
--- a/2015/Day13/Solution.cs
+++ /dev/null
@@ -1,55 +0,0 @@
-using System.Collections.Generic;
-using System.Linq;
-using System.Text.RegularExpressions;
-
-namespace AdventOfCode.Y2015.Day13;
-
-[ProblemName("Knights of the Dinner Table")]
-class Solution : Solver {
-
- public object PartOne(string input) => Happiness(input, false).Max();
- public object PartTwo(string input) => Happiness(input, true).Max();
-
- IEnumerable Happiness(string input, bool includeMe) {
- var dh = new Dictionary<(string, string), int>();
- foreach (var line in input.Split('\n')) {
- var m = Regex.Match(line, @"(.*) would (.*) (.*) happiness units by sitting next to (.*).");
- var a = m.Groups[1].Value;
- var b = m.Groups[4].Value;
- var happiness = int.Parse(m.Groups[3].Value) * (m.Groups[2].Value == "gain" ? 1 : -1);
- if (!dh.ContainsKey((a, b))) {
- dh[(a, b)] = 0;
- dh[(b, a)] = 0;
- }
- dh[(a, b)] += happiness;
- dh[(b, a)] += happiness;
- }
-
- var people = dh.Keys.Select(k => k.Item1).Distinct().ToList();
- if (includeMe) {
- people.Add("me");
- }
- return Permutations(people.ToArray()).Select(order =>
- order.Zip(order.Skip(1).Append(order[0]), (a, b) => dh.TryGetValue((a, b), out var v) ? v : 0).Sum()
- );
- }
-
- IEnumerable Permutations(T[] rgt) {
-
- IEnumerable PermutationsRec(int i) {
- if (i == rgt.Length) {
- yield return rgt.ToArray();
- }
-
- for (var j = i; j < rgt.Length; j++) {
- (rgt[i], rgt[j]) = (rgt[j], rgt[i]);
- foreach (var perm in PermutationsRec(i + 1)) {
- yield return perm;
- }
- (rgt[i], rgt[j]) = (rgt[j], rgt[i]);
- }
- }
-
- return PermutationsRec(0);
- }
-}
diff --git a/2015/Day13/input.in b/2015/Day13/input.in
deleted file mode 100644
index 67565872d..000000000
Binary files a/2015/Day13/input.in and /dev/null differ
diff --git a/2015/Day13/input.refout b/2015/Day13/input.refout
deleted file mode 100644
index ae343b96d..000000000
--- a/2015/Day13/input.refout
+++ /dev/null
@@ -1,2 +0,0 @@
-709
-668
diff --git a/2015/Day14/README.md b/2015/Day14/README.md
deleted file mode 100644
index c731da059..000000000
--- a/2015/Day14/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-## --- Day 14: Reindeer Olympics ---
-This year is the Reindeer Olympics! Reindeer can fly at high speeds, but must rest occasionally to recover their energy. Santa would like to know which of his reindeer is fastest, and so he has them race.
-
-Reindeer can only either be *flying* (always at their top speed) or *resting* (not moving at all), and always spend whole seconds in either state.
-
-Read the [full puzzle](https://adventofcode.com/2015/day/14).
\ No newline at end of file
diff --git a/2015/Day14/Solution.cs b/2015/Day14/Solution.cs
deleted file mode 100644
index 9383366a1..000000000
--- a/2015/Day14/Solution.cs
+++ /dev/null
@@ -1,58 +0,0 @@
-using System.Collections.Generic;
-using System.Linq;
-using System.Text.RegularExpressions;
-
-namespace AdventOfCode.Y2015.Day14;
-
-[ProblemName("Reindeer Olympics")]
-class Solution : Solver {
-
- public object PartOne(string input) => Race(Parse(input)).Skip(2502).First().Max();
- public object PartTwo(string input) => Race2(Parse(input)).Skip(2502).First().Max();
-
- IEnumerable[] Parse(string input) => input.Split('\n').Select(Reindeer).ToArray();
-
- IEnumerable Race(IEnumerable[] reindeers) {
- var res = new int[reindeers.Length];
- var enumarators = reindeers.Select(r => r.GetEnumerator()).ToArray();
- while (true) {
- yield return (from en in enumarators
- let _ = en.MoveNext()
- select en.Current).ToArray();
- }
- }
-
- IEnumerable Race2(IEnumerable[] reindeers) {
- var points = new int[reindeers.Length];
- foreach (var step in Race(reindeers)) {
- var m = step.Max();
- for (var i = 0; i < step.Length; i++) {
- if (step[i] == m) {
- points[i]++;
- }
- }
- yield return points;
- }
- }
-
- IEnumerable Reindeer(string line) {
- var m = Regex.Match(line, @"(.*) can fly (.*) km/s for (.*) seconds, but then must rest for (.*) seconds.");
- var speed = int.Parse(m.Groups[2].Value);
- var flightTime = int.Parse(m.Groups[3].Value);
- var restTime = int.Parse(m.Groups[4].Value);
- var t = 0;
- var dist = 0;
- var flying = true;
- while (true) {
- if (flying) {
- dist += speed;
- }
- t++;
- if ((flying && t == flightTime) || (!flying && t == restTime)) {
- t = 0;
- flying = !flying;
- }
- yield return dist;
- }
- }
-}
diff --git a/2015/Day14/input.in b/2015/Day14/input.in
deleted file mode 100644
index c32701b9d..000000000
Binary files a/2015/Day14/input.in and /dev/null differ
diff --git a/2015/Day14/input.refout b/2015/Day14/input.refout
deleted file mode 100644
index 406063643..000000000
--- a/2015/Day14/input.refout
+++ /dev/null
@@ -1,2 +0,0 @@
-2640
-1102
diff --git a/2015/Day15/README.md b/2015/Day15/README.md
deleted file mode 100644
index b6a9deacf..000000000
--- a/2015/Day15/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-## --- Day 15: Science for Hungry People ---
-Today, you set out on the task of perfecting your milk-dunking cookie recipe. All you have to do is find the right balance of ingredients.
-
-Your recipe leaves room for exactly 100
teaspoons of ingredients. You make a list of the remaining ingredients you could use to finish the recipe (your puzzle input) and their properties per teaspoon:
-
-Read the [full puzzle](https://adventofcode.com/2015/day/15).
\ No newline at end of file
diff --git a/2015/Day15/Solution.cs b/2015/Day15/Solution.cs
deleted file mode 100644
index e9bb51047..000000000
--- a/2015/Day15/Solution.cs
+++ /dev/null
@@ -1,51 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text.RegularExpressions;
-
-namespace AdventOfCode.Y2015.Day15;
-
-[ProblemName("Science for Hungry People")]
-class Solution : Solver {
-
- public object PartOne(string input) => Solve(input, null);
- public object PartTwo(string input) => Solve(input, 500);
-
- long Solve(string input, int? calories) {
- var ingredients = Parse(input);
- var propsCount = ingredients[0].Length;
-
- var maxValue = 0L;
- foreach (var amounts in Partition(100, ingredients.Length)) {
- var props = new int[propsCount];
- for (int ingredient = 0; ingredient < ingredients.Length; ingredient++) {
- for (int prop = 0; prop < 5; prop++) {
- props[prop] += ingredients[ingredient][prop] * amounts[ingredient];
- }
- }
- if (!calories.HasValue || calories.Value == props.Last()) {
- var value = props.Take(propsCount - 1).Aggregate(1L, (acc, p) => acc * Math.Max(0, p));
- maxValue = Math.Max(maxValue, value);
- }
- }
- return maxValue;
- }
-
- int[][] Parse(string input) =>
- (from line in input.Split('\n')
- let m = Regex.Match(line, @".*: capacity (.*), durability (.*), flavor (.*), texture (.*), calories (.*)")
- let nums = m.Groups.Cast().Skip(1).Select(g => int.Parse(g.Value)).ToArray()
- select nums).ToArray();
-
- IEnumerable Partition(int n, int k) {
- if (k == 1) {
- yield return new int[] { n };
- } else {
- for (var i = 0; i <= n; i++) {
- foreach (var rest in Partition(n - i, k - 1)) {
- yield return rest.Select(x => x).Append(i).ToArray();
- }
- }
- }
- }
-}
diff --git a/2015/Day15/input.in b/2015/Day15/input.in
deleted file mode 100644
index 2a15a4bdf..000000000
Binary files a/2015/Day15/input.in and /dev/null differ
diff --git a/2015/Day15/input.refout b/2015/Day15/input.refout
deleted file mode 100644
index 849708d4f..000000000
--- a/2015/Day15/input.refout
+++ /dev/null
@@ -1,2 +0,0 @@
-13882464
-11171160
\ No newline at end of file
diff --git a/2015/Day16/README.md b/2015/Day16/README.md
deleted file mode 100644
index 2af56e4cf..000000000
--- a/2015/Day16/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-## --- Day 16: Aunt Sue ---
-Your Aunt Sue has given you a wonderful gift, and you'd like to send her a thank you card. However, there's a small problem: she signed it "From, Aunt Sue".
-
-You have 500 Aunts named "Sue".
-
-Read the [full puzzle](https://adventofcode.com/2015/day/16).
\ No newline at end of file
diff --git a/2015/Day16/Solution.cs b/2015/Day16/Solution.cs
deleted file mode 100644
index 88fa21e40..000000000
--- a/2015/Day16/Solution.cs
+++ /dev/null
@@ -1,44 +0,0 @@
-using System.Collections.Generic;
-using System.Linq;
-using System.Text.RegularExpressions;
-
-namespace AdventOfCode.Y2015.Day16;
-
-[ProblemName("Aunt Sue")]
-class Solution : Solver {
-
- private Dictionary target = new Dictionary {
- ["children"] = 3,
- ["cats"] = 7,
- ["samoyeds"] = 2,
- ["pomeranians"] = 3,
- ["akitas"] = 0,
- ["vizslas"] = 0,
- ["goldfish"] = 5,
- ["trees"] = 3,
- ["cars"] = 2,
- ["perfumes"] = 1,
- };
-
- public object PartOne(string input) =>
- Parse(input).FindIndex(p => p.Keys.All(k => p[k] == target[k])) + 1;
-
- public object PartTwo(string input) =>
- Parse(input).FindIndex(p => p.Keys.All(k => {
- if (k == "cats" || k == "trees") {
- return p[k] > target[k];
- } else if (k == "pomeranians" || k == "goldfish") {
- return p[k] < target[k];
- } else {
- return p[k] == target[k];
- }
- })) + 1;
-
- List> Parse(string input) => (
- from line in input.Split('\n')
- let parts = Regex.Matches(line, @"(\w+): (\d+)")
- select parts.ToDictionary(
- part => part.Groups[1].Value,
- part => int.Parse(part.Groups[2].Value))
- ).ToList();
-}
diff --git a/2015/Day16/input.in b/2015/Day16/input.in
deleted file mode 100644
index 88299f18a..000000000
Binary files a/2015/Day16/input.in and /dev/null differ
diff --git a/2015/Day16/input.refout b/2015/Day16/input.refout
deleted file mode 100644
index cfcb52c27..000000000
--- a/2015/Day16/input.refout
+++ /dev/null
@@ -1,2 +0,0 @@
-373
-260
diff --git a/2015/Day17/README.md b/2015/Day17/README.md
deleted file mode 100644
index b38b90141..000000000
--- a/2015/Day17/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-## --- Day 17: No Such Thing as Too Much ---
-The elves bought too much eggnog again - `150` liters this time. To fit it all into your refrigerator, you'll need to move it into smaller containers. You take an inventory of the capacities of the available containers.
-
-For example, suppose you have containers of size `20`, `15`, `10`, `5`, and `5` liters. If you need to store `25` liters, there are four ways to do it:
-
-Read the [full puzzle](https://adventofcode.com/2015/day/17).
\ No newline at end of file
diff --git a/2015/Day17/Solution.cs b/2015/Day17/Solution.cs
deleted file mode 100644
index 154d6486d..000000000
--- a/2015/Day17/Solution.cs
+++ /dev/null
@@ -1,40 +0,0 @@
-using System.Collections.Generic;
-using System.Collections.Immutable;
-using System.Linq;
-
-namespace AdventOfCode.Y2015.Day17;
-
-[ProblemName("No Such Thing as Too Much")]
-class Solution : Solver {
-
- public object PartOne(string input) => Fill(Parse(input)).Count();
- public object PartTwo(string input) {
- var combinations = Fill(Parse(input)).ToArray();
- var shortest = combinations.Select(combination => combination.Count()).Min();
- return combinations.Count(combination => combination.Count() == shortest);
- }
-
- int[] Parse(string input) => input.Split('\n').Select(int.Parse).ToArray();
-
- IEnumerable> Fill(int[] containers) {
- IEnumerable> FillRecursive(int i, int amount) {
- if (i == containers.Length) {
- yield break;
- } else {
- if (amount == containers[i]) {
- yield return ImmutableList.Create(i);
- }
- if (amount >= containers[i]) {
- foreach (var v in FillRecursive(i + 1, amount - containers[i])) {
- yield return v.Add(i);
- }
- }
- foreach (var v in FillRecursive(i + 1, amount)) {
- yield return v;
- }
- }
- }
-
- return FillRecursive(0, 150);
- }
-}
diff --git a/2015/Day17/input.in b/2015/Day17/input.in
deleted file mode 100644
index ebbf7e7ad..000000000
Binary files a/2015/Day17/input.in and /dev/null differ
diff --git a/2015/Day17/input.refout b/2015/Day17/input.refout
deleted file mode 100644
index 7d01df13d..000000000
--- a/2015/Day17/input.refout
+++ /dev/null
@@ -1,2 +0,0 @@
-1638
-17
diff --git a/2015/Day18/README.md b/2015/Day18/README.md
deleted file mode 100644
index 05f646e0c..000000000
--- a/2015/Day18/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-## --- Day 18: Like a GIF For Your Yard ---
-After the [million lights incident](6), the fire code has gotten stricter: now, at most ten thousand lights are allowed. You arrange them in a 100x100 grid.
-
-Never one to let you down, Santa again mails you instructions on the ideal lighting configuration. With so few lights, he says, you'll have to resort to *animation*.
-
-Read the [full puzzle](https://adventofcode.com/2015/day/18).
\ No newline at end of file
diff --git a/2015/Day18/Solution.cs b/2015/Day18/Solution.cs
deleted file mode 100644
index c2ab8a765..000000000
--- a/2015/Day18/Solution.cs
+++ /dev/null
@@ -1,58 +0,0 @@
-using System.Collections.Generic;
-using System.Linq;
-
-namespace AdventOfCode.Y2015.Day18;
-
-[ProblemName("Like a GIF For Your Yard")]
-class Solution : Solver {
-
- public object PartOne(string input) =>
- Enumerable.Range(0, 100).Aggregate(Parse(input), (acc, _) => Step(acc, false)).Select(row => row.Sum()).Sum();
-
- public object PartTwo(string input) =>
- Enumerable.Range(0, 100).Aggregate(Parse(input), (acc, _) => Step(acc, true)).Select(row => row.Sum()).Sum();
-
- int[][] Step(int[][] input, bool stuck) {
-
- var res = new List();
- var (crow, ccol) = (input.Length, input[0].Length);
-
- if (stuck) {
- input[0][0] = 1;
- input[crow - 1][0] = 1;
- input[0][ccol - 1] = 1;
- input[crow - 1][ccol - 1] = 1;
- }
- for (var irow = 0; irow < crow; irow++) {
- var row = new List();
- for (var icol = 0; icol < ccol; icol++) {
- if (stuck &&
- ((icol == 0 && irow == 0) || (icol == ccol - 1 && irow == 0) ||
- (icol == 0 && irow == crow - 1) || (icol == ccol - 1 && irow == crow - 1))
- ) {
- row.Add(1);
- } else {
- var neighbours =
- (from d in new(int row, int col)[] { (-1, -1), (0, -1), (1, -1), (-1, 0), (1, 0), (-1, 1), (0, 1), (1, 1) }
- let irowT = irow + d.row
- let icolT = icol + d.col
- where irowT >= 0 && irowT < crow && icolT >= 0 && icolT < ccol && input[irowT][icolT] == 1
- select 1).Sum();
- if (input[irow][icol] == 1) {
- row.Add(new[] { 0, 0, 1, 1, 0, 0, 0, 0, 0, 0 }[neighbours]);
- } else {
- row.Add(new[] { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0 }[neighbours]);
- }
- }
- }
- res.Add(row.ToArray());
- }
- return res.ToArray();
- }
-
- int[][] Parse(string input) =>(
- from line in input.Split('\n')
- select
- (from ch in line select ch == '#' ? 1 : 0).ToArray()
- ).ToArray();
-}
diff --git a/2015/Day18/input.in b/2015/Day18/input.in
deleted file mode 100644
index 9c8fa75ed..000000000
Binary files a/2015/Day18/input.in and /dev/null differ
diff --git a/2015/Day18/input.refout b/2015/Day18/input.refout
deleted file mode 100644
index e2ce4ee17..000000000
--- a/2015/Day18/input.refout
+++ /dev/null
@@ -1,2 +0,0 @@
-821
-886
diff --git a/2015/Day19/README.md b/2015/Day19/README.md
deleted file mode 100644
index 143c9b75b..000000000
--- a/2015/Day19/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-## --- Day 19: Medicine for Rudolph ---
-Rudolph the Red-Nosed Reindeer is sick! His nose isn't shining very brightly, and he needs medicine.
-
-Red-Nosed Reindeer biology isn't similar to regular reindeer biology; Rudolph is going to need custom-made medicine. Unfortunately, Red-Nosed Reindeer chemistry isn't similar to regular reindeer chemistry, either.
-
-Read the [full puzzle](https://adventofcode.com/2015/day/19).
\ No newline at end of file
diff --git a/2015/Day19/Solution.cs b/2015/Day19/Solution.cs
deleted file mode 100644
index 8a9e6c922..000000000
--- a/2015/Day19/Solution.cs
+++ /dev/null
@@ -1,75 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-
-namespace AdventOfCode.Y2015.Day19;
-
-[ProblemName("Medicine for Rudolph")]
-class Solution : Solver {
-
- public object PartOne(string input) {
- var (rules, m) = Parse(input);
- return ReplaceAll(rules, m).ToHashSet().Count;
- }
-
- public object PartTwo(string input) {
- var (rules, m) = Parse(input);
- Random r = new Random();
- var st = m;
- var depth = 0;
- var i = 0;
- while (st != "e") {
- i++;
- var replacements = Replacements(rules, st, false).ToArray();
- if (replacements.Length == 0) {
- st = m;
- depth = 0;
- continue;
- }
- var replacement = replacements[r.Next(replacements.Length)];
- st = Replace(st, replacement.from, replacement.to, replacement.length);
- depth++;
- }
- return depth;
- }
-
- IEnumerable ReplaceAll((string from, string to)[] rules, string m) {
- foreach (var (from, length, to) in Replacements(rules, m, true)) {
- yield return Replace(m, from, to, length);
- }
- }
-
- string Replace(string m, int from, string to, int length) => m.Substring(0, from) + to + m.Substring(from + length);
-
- IEnumerable<(int from, int length, string to)> Replacements((string from, string to)[] rules, string m, bool forward) {
- var ich = 0;
- while (ich < m.Length) {
- foreach (var (a, b) in rules) {
- var (from, to) = forward ? (a, b) : (b, a);
- if (ich + from.Length <= m.Length) {
- var i = 0;
- while (i < from.Length) {
- if (m[ich + i] != from[i]) {
- break;
- }
- i++;
- }
- if (i == from.Length) {
- yield return (ich, from.Length, to);
- }
- }
- }
- ich++;
- }
- }
-
- ((string from, string to)[] rules, string m) Parse(string input) {
- var rules =
- (from line in input.Split('\n').TakeWhile(line => line.Contains("=>"))
- let parts = line.Split(" => ")
- select (parts[0], parts[1]))
- .ToArray();
- var m = input.Split('\n').Last();
- return (rules, m);
- }
-}
diff --git a/2015/Day19/input.in b/2015/Day19/input.in
deleted file mode 100644
index e9fd053f8..000000000
Binary files a/2015/Day19/input.in and /dev/null differ
diff --git a/2015/Day19/input.refout b/2015/Day19/input.refout
deleted file mode 100644
index 3199c5365..000000000
--- a/2015/Day19/input.refout
+++ /dev/null
@@ -1,2 +0,0 @@
-518
-200
diff --git a/2015/Day20/README.md b/2015/Day20/README.md
deleted file mode 100644
index 7948d8a4b..000000000
--- a/2015/Day20/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-## --- Day 20: Infinite Elves and Infinite Houses ---
-To keep the Elves busy, Santa has them deliver some presents by hand, door-to-door. He sends them down a street with infinite houses numbered sequentially: `1`, `2`, `3`, `4`, `5`, and so on.
-
-Each Elf is assigned a number, too, and delivers presents to houses based on that number:
-
-Read the [full puzzle](https://adventofcode.com/2015/day/20).
\ No newline at end of file
diff --git a/2015/Day20/Solution.cs b/2015/Day20/Solution.cs
deleted file mode 100644
index c3373106a..000000000
--- a/2015/Day20/Solution.cs
+++ /dev/null
@@ -1,36 +0,0 @@
-namespace AdventOfCode.Y2015.Day20;
-
-[ProblemName("Infinite Elves and Infinite Houses")]
-class Solution : Solver {
-
- public object PartOne(string input) {
- var l = int.Parse(input);
- return PresentsByHouse(1000000, 10, l);
- }
-
- public object PartTwo(string input) {
- var l = int.Parse(input);
- return PresentsByHouse(50, 11, l);
- }
-
- int PresentsByHouse(int steps, int mul, int l) {
- var presents = new int[1000000];
- for (var i = 1; i < presents.Length; i++) {
- var j = i;
- var step = 0;
- while (j < presents.Length && step < steps) {
- presents[j] += mul * i;
- j += i;
- step++;
- }
- }
-
- for (var i = 0; i < presents.Length; i++) {
- if (presents[i] >= l) {
- return i;
- }
- }
- return -1;
-
- }
-}
diff --git a/2015/Day20/input.in b/2015/Day20/input.in
deleted file mode 100644
index 70de3846e..000000000
Binary files a/2015/Day20/input.in and /dev/null differ
diff --git a/2015/Day20/input.refout b/2015/Day20/input.refout
deleted file mode 100644
index 4f317373c..000000000
--- a/2015/Day20/input.refout
+++ /dev/null
@@ -1,2 +0,0 @@
-831600
-884520
diff --git a/2015/Day21/README.md b/2015/Day21/README.md
deleted file mode 100644
index b35a9cffb..000000000
--- a/2015/Day21/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-## --- Day 21: RPG Simulator 20XX ---
-Little Henry Case got a new video game for Christmas. It's an [RPG](https://en.wikipedia.org/wiki/Role-playing_video_game), and he's stuck on a boss. He needs to know what equipment to buy at the shop. He hands you the [controller](https://en.wikipedia.org/wiki/Game_controller).
-
-In this game, the player (you) and the enemy (the boss) take turns attacking. The player always goes first. Each attack reduces the opponent's hit points by at least `1`. The first character at or below `0` hit points loses.
-
-Read the [full puzzle](https://adventofcode.com/2015/day/21).
\ No newline at end of file
diff --git a/2015/Day21/Solution.cs b/2015/Day21/Solution.cs
deleted file mode 100644
index 98e5b1fcb..000000000
--- a/2015/Day21/Solution.cs
+++ /dev/null
@@ -1,84 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-
-namespace AdventOfCode.Y2015.Day21;
-
-[ProblemName("RPG Simulator 20XX")]
-class Solution : Solver {
-
- public object PartOne(string input) {
- var boss = Parse(input);
- var minGold = int.MaxValue;
- foreach (var c in Buy()) {
- if (DefeatsBoss((c.damage, c.armor, 100), boss)) {
- minGold = Math.Min(c.gold, minGold);
- }
- }
- return minGold;
- }
-
- public object PartTwo(string input) {
- var boss = Parse(input);
- var maxGold = 0;
- foreach (var c in Buy()) {
- if (!DefeatsBoss((c.damage, c.armor, 100), boss)) {
- maxGold = Math.Max(c.gold, maxGold);
- }
- }
- return maxGold;
- }
-
- (int damage, int armor, int hp) Parse(string input) {
- var lines = input.Split("\n");
- var hp = int.Parse(lines[0].Split(": ")[1]);
- var damage = int.Parse(lines[1].Split(": ")[1]);
- var armor = int.Parse(lines[2].Split(": ")[1]);
- return (damage, armor, hp);
- }
-
- bool DefeatsBoss((int damage, int armor, int hp) player, (int damage, int armor, int hp) boss) {
- while (true) {
- boss.hp -= Math.Max(player.damage - boss.armor, 1);
- if (boss.hp <= 0) {
- return true;
- }
-
- player.hp -= Math.Max(boss.damage - player.armor, 1);
- if (player.hp <= 0) {
- return false;
- }
- }
- }
-
- IEnumerable<(int gold, int damage, int armor)> Buy() {
- return
- from weapon in Buy(1, 1, new[] { (8, 4, 0), (10, 5, 0), (25, 6, 0), (40, 7, 0), (74, 8, 0) })
- from armor in Buy(0, 1, new[] { (13, 0, 1), (31, 0, 2), (53, 0, 3), (75, 0, 4), (102, 0, 5) })
- from ring in Buy(1, 2, new[] { (25, 1, 0), (50, 2, 0), (100, 3, 0), (20, 0, 1), (40, 0, 2), (80, 0, 3) })
- select Sum(weapon, armor, ring);
- }
-
- IEnumerable<(int gold, int damage, int armor)> Buy(int min, int max, (int gold, int damage, int armor)[] items) {
- if (min == 0) {
- yield return (0, 0, 0);
- }
-
- foreach (var item in items) {
- yield return item;
- }
-
- if (max == 2) {
- for (int i = 0; i < items.Length; i++) {
- for (int j = i + 1; j < items.Length; j++) {
- yield return Sum(items[i], items[j]);
- }
- }
- }
- }
-
- (int gold, int damage, int armor) Sum(params (int gold, int damage, int armor)[] items) {
- return (items.Select(item => item.gold).Sum(), items.Select(item => item.damage).Sum(), items.Select(item => item.armor).Sum());
- }
-
-}
diff --git a/2015/Day21/input.in b/2015/Day21/input.in
deleted file mode 100644
index 86a205cfd..000000000
Binary files a/2015/Day21/input.in and /dev/null differ
diff --git a/2015/Day21/input.refout b/2015/Day21/input.refout
deleted file mode 100644
index acfccc904..000000000
--- a/2015/Day21/input.refout
+++ /dev/null
@@ -1,2 +0,0 @@
-121
-201
diff --git a/2015/Day22/README.md b/2015/Day22/README.md
deleted file mode 100644
index 26a245daa..000000000
--- a/2015/Day22/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-## --- Day 22: Wizard Simulator 20XX ---
-Little Henry Case decides that defeating bosses with [swords and stuff](21) is boring. Now he's playing the game with a wizard. Of course, he gets stuck on another boss and needs your help again.
-
-In this version, combat still proceeds with the player and the boss taking alternating turns. The player still goes first. Now, however, you don't get any equipment; instead, you must choose one of your spells to cast. The first character at or below `0` hit points loses.
-
-Read the [full puzzle](https://adventofcode.com/2015/day/22).
\ No newline at end of file
diff --git a/2015/Day22/Solution.cs b/2015/Day22/Solution.cs
deleted file mode 100644
index 7580320d7..000000000
--- a/2015/Day22/Solution.cs
+++ /dev/null
@@ -1,186 +0,0 @@
-using System;
-using System.Collections.Generic;
-
-namespace AdventOfCode.Y2015.Day22;
-
-[ProblemName("Wizard Simulator 20XX")]
-class Solution : Solver {
-
- public object PartOne(string input) {
- var state0 = Parse(input);
- return BinarySearch(mana => TrySolve(state0.WithManaLimit(mana), false));
- }
-
- public object PartTwo(string input) {
- var state0 = Parse(input);
- return BinarySearch(mana => TrySolve(state0.WithManaLimit(mana), true));
- }
-
- int BinarySearch(Func f) {
- var hi = 1;
- while (!f(hi)) {
- hi *= 2;
- }
- var lo = hi / 2;
- var first = false;
- while (hi - lo > 1) {
- var m = (hi + lo) / 2;
- if (!first && f(m)) {
- hi = m;
- } else {
- lo = m;
- }
- first = false;
- }
- return hi;
- }
-
- bool TrySolve(State state, bool hard) {
- if (hard) {
- state = state.Damage(1);
- }
- state = state.ApplyEffects();
- foreach (var stateT in state.PlayerSteps()) {
- state = stateT.ApplyEffects();
- state = state.BossStep();
- if (state.bossHp <= 0 || state.playerHp > 0 && TrySolve(state, hard)) {
- return true;
- }
- }
- return false;
- }
-
- State Parse(string input){
- var lines = input.Split("\n");
- return new State {
- playerHp = 50,
- playerMana = 500,
- bossHp = int.Parse(lines[0].Split(": ")[1]),
- bossDamage = int.Parse(lines[1].Split(": ")[1])
- };
- }
-}
-
-
-class State {
- const int missileMana = 53;
- const int drainMana = 73;
- const int shieldMana = 113;
- const int poisonMana = 173;
- const int rechargeMana = 229;
-
- public int shield;
- public int poison;
- public int recharge;
- public int playerHp;
- public int bossHp;
- public int playerMana;
- public int bossDamage;
- public int usedMana;
- public int playerArmor;
- public int manaLimit;
-
- public State Dup() {
- return this.MemberwiseClone() as State;
- }
-
- public State WithManaLimit(int manaLimit) {
- var newState = Dup();
- newState.manaLimit = manaLimit;
- return newState;
- }
-
- public State ApplyEffects() {
- if (playerHp <= 0 || bossHp <= 0) {
- return this;
- }
-
- var newState = Dup();
- if (newState.poison > 0) {
- newState.bossHp -= 3;
- newState.poison--;
- }
-
- if (newState.recharge > 0) {
- newState.playerMana += 101;
- newState.recharge--;
- }
-
- if (newState.shield > 0) {
- newState.shield--;
- newState.playerArmor = 7;
- } else {
- newState.playerArmor = 0;
- }
- return newState;
- }
-
- public State Damage(int damage) {
- if (playerHp <= 0 || bossHp <= 0) {
- return this;
- }
-
- var step = Dup();
- step.playerHp -= damage;
- return step;
- }
-
- public State BossStep(){
- if (playerHp <= 0 || bossHp <= 0) {
- return this;
- }
-
- var step = Dup();
- step.playerHp -= Math.Max(1, step.bossDamage - step.playerArmor);
- return step;
- }
-
- public IEnumerable PlayerSteps() {
-
- if (playerHp <= 0 || bossHp <= 0) {
- yield return this;
- yield break;
- }
-
- if (playerMana >= missileMana && missileMana + usedMana <= manaLimit) {
- var c = Dup();
- c.playerMana -= missileMana;
- c.usedMana += missileMana;
- c.bossHp -= 4;
- yield return c;
- }
-
- if (playerMana >= drainMana && drainMana + usedMana <= manaLimit) {
- var c = Dup();
- c.playerMana -= drainMana;
- c.usedMana += drainMana;
- c.bossHp -= 2;
- c.playerHp += 2;
- yield return c;
- }
-
- if (playerMana >= shieldMana && shield == 0 && shieldMana + usedMana <= manaLimit) {
- var c = Dup();
- c.playerMana -= shieldMana;
- c.usedMana += shieldMana;
- c.shield = 6;
- yield return c;
- }
-
- if (playerMana >= poisonMana && poison == 0 && poisonMana + usedMana <= manaLimit) {
- var c = Dup();
- c.playerMana -= poisonMana;
- c.usedMana += poisonMana;
- c.poison = 6;
- yield return c;
- }
-
- if (playerMana >= rechargeMana && recharge == 0 && rechargeMana + usedMana <= manaLimit) {
- var c = Dup();
- c.playerMana -= rechargeMana;
- c.usedMana += rechargeMana;
- c.recharge = 5;
- yield return c;
- }
- }
-}
diff --git a/2015/Day22/input.in b/2015/Day22/input.in
deleted file mode 100644
index c3d03ea5f..000000000
Binary files a/2015/Day22/input.in and /dev/null differ
diff --git a/2015/Day22/input.refout b/2015/Day22/input.refout
deleted file mode 100644
index d72d09e9a..000000000
--- a/2015/Day22/input.refout
+++ /dev/null
@@ -1,2 +0,0 @@
-1824
-1937
diff --git a/2015/Day23/README.md b/2015/Day23/README.md
deleted file mode 100644
index 03c6983b0..000000000
--- a/2015/Day23/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-## --- Day 23: Opening the Turing Lock ---
-Little Jane Marie just got her very first computer for Christmas from some unknown benefactor. It comes with instructions and an example program, but the computer itself seems to be malfunctioning. She's curious what the program does, and would like you to help her run it.
-
-The manual explains that the computer supports two [registers](https://en.wikipedia.org/wiki/Processor_register) and six [instructions](https://en.wikipedia.org/wiki/Instruction_set) (truly, it goes on to remind the reader, a state-of-the-art technology). The registers are named `a` and `b`, can hold any [non-negative integer](https://en.wikipedia.org/wiki/Natural_number), and begin with a value of `0`. The instructions are as follows:
-
-Read the [full puzzle](https://adventofcode.com/2015/day/23).
\ No newline at end of file
diff --git a/2015/Day23/Solution.cs b/2015/Day23/Solution.cs
deleted file mode 100644
index 98e74bd2f..000000000
--- a/2015/Day23/Solution.cs
+++ /dev/null
@@ -1,56 +0,0 @@
-using System;
-using System.Collections.Generic;
-
-namespace AdventOfCode.Y2015.Day23;
-
-[ProblemName("Opening the Turing Lock")]
-class Solution : Solver {
-
- public object PartOne(string input) => Solve(input, 0);
- public object PartTwo(string input) => Solve(input, 1);
-
- long Solve(string input, long a) {
- var regs = new Dictionary();
- var ip = 0L;
- long getReg(string reg) {
- return long.TryParse(reg, out var n) ? n
- : regs.ContainsKey(reg) ? regs[reg]
- : 0;
- }
- void setReg(string reg, long value) {
- regs[reg] = value;
- }
-
- setReg("a", a);
- var prog = input.Split('\n');
- while (ip >= 0 && ip < prog.Length) {
- var line = prog[ip];
- var parts = line.Replace(",", "").Split(" ");
- switch (parts[0]) {
- case "hlf":
- setReg(parts[1], getReg(parts[1]) / 2);
- ip++;
- break;
- case "tpl":
- setReg(parts[1], getReg(parts[1]) * 3);
- ip++;
- break;
- case "inc":
- setReg(parts[1], getReg(parts[1]) + 1);
- ip++;
- break;
- case "jmp":
- ip += getReg(parts[1]);
- break;
- case "jie":
- ip += getReg(parts[1]) % 2 == 0 ? getReg(parts[2]) : 1;
- break;
- case "jio":
- ip += getReg(parts[1]) == 1 ? getReg(parts[2]) : 1;
- break;
- default: throw new Exception("Cannot parse " + line);
- }
- }
- return getReg("b");
- }
-}
diff --git a/2015/Day23/input.in b/2015/Day23/input.in
deleted file mode 100644
index a34fa99f1..000000000
Binary files a/2015/Day23/input.in and /dev/null differ
diff --git a/2015/Day23/input.refout b/2015/Day23/input.refout
deleted file mode 100644
index 6064a4e8b..000000000
--- a/2015/Day23/input.refout
+++ /dev/null
@@ -1,2 +0,0 @@
-170
-247
diff --git a/2015/Day24/README.md b/2015/Day24/README.md
deleted file mode 100644
index c00ce7cf2..000000000
--- a/2015/Day24/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-## --- Day 24: It Hangs in the Balance ---
-It's Christmas Eve, and Santa is loading up the sleigh for this year's deliveries. However, there's one small problem: he can't get the sleigh to balance. If it isn't balanced, he can't defy physics, and nobody gets presents this year.
-
-No pressure.
-
-Read the [full puzzle](https://adventofcode.com/2015/day/24).
\ No newline at end of file
diff --git a/2015/Day24/Solution.cs b/2015/Day24/Solution.cs
deleted file mode 100644
index 154e425f5..000000000
--- a/2015/Day24/Solution.cs
+++ /dev/null
@@ -1,50 +0,0 @@
-using System;
-using System.Collections.Immutable;
-using System.Collections.Generic;
-using System.Linq;
-
-namespace AdventOfCode.Y2015.Day24;
-
-[ProblemName("It Hangs in the Balance")]
-class Solution : Solver {
-
- public object PartOne(string input) => Solve(Parse(input), 3);
-
- public object PartTwo(string input) => Solve(Parse(input), 4);
-
- int[] Parse(string input) =>
- input.Split("\n").Select(int.Parse).ToArray();
-
- long Solve(int[] nums, int groups) {
- var mul = (ImmutableList l) => l.Aggregate(1L, (m, x) => m*x);
-
- for(var i =0;i> Pick(int[] nums, int count, int i, int sum) {
- if (sum == 0) {
- yield return ImmutableList.Create();
- yield break;
- }
-
- if (count < 0 || sum < 0 || i >= nums.Length) {
- yield break;
- }
-
- if (nums[i] <= sum) {
- foreach (var x in Pick(nums, count-1, i + 1, sum - nums[i])) {
- yield return x.Add(nums[i]);
- }
- }
-
- foreach (var x in Pick(nums, count, i + 1, sum)) {
- yield return x;
- }
- }
-}
diff --git a/2015/Day24/input.in b/2015/Day24/input.in
deleted file mode 100644
index 3d36932f3..000000000
Binary files a/2015/Day24/input.in and /dev/null differ
diff --git a/2015/Day24/input.refout b/2015/Day24/input.refout
deleted file mode 100644
index 319f8bda5..000000000
--- a/2015/Day24/input.refout
+++ /dev/null
@@ -1,2 +0,0 @@
-10723906903
-74850409
diff --git a/2015/Day25/README.md b/2015/Day25/README.md
deleted file mode 100644
index 9107dfdd5..000000000
--- a/2015/Day25/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-## --- Day 25: Let It Snow ---
-Merry Christmas! Santa is booting up his weather machine; looks like you might get a [white Christmas](1) after all.
-
-The weather machine beeps! On the console of the machine is a copy protection message asking you to [enter a code from the instruction manual](https://en.wikipedia.org/wiki/Copy_protection#Early_video_games). Apparently, it refuses to run unless you give it that code. No problem; you'll just look up the code in the--
-
-Read the [full puzzle](https://adventofcode.com/2015/day/25).
\ No newline at end of file
diff --git a/2015/Day25/Solution.cs b/2015/Day25/Solution.cs
deleted file mode 100644
index efc643128..000000000
--- a/2015/Day25/Solution.cs
+++ /dev/null
@@ -1,28 +0,0 @@
-using System.Text.RegularExpressions;
-
-namespace AdventOfCode.Y2015.Day25;
-
-[ProblemName("Let It Snow")]
-class Solution : Solver {
-
- public object PartOne(string input) {
- var m = 20151125L;
- var (irow, icol) = (1, 1);
- var (irowDst, icolDst) = Parse(input);
- while (irow != irowDst || icol != icolDst) {
- irow--;
- icol++;
- if (irow == 0) {
- irow = icol;
- icol = 1;
- }
- m = (m * 252533L) % 33554393L;
- }
- return m;
- }
-
- (int irowDst, int icolDst) Parse(string input){
- var m = Regex.Match(input, @"To continue, please consult the code grid in the manual. Enter the code at row (\d+), column (\d+).");
- return (int.Parse(m.Groups[1].Value), int.Parse(m.Groups[2].Value));
- }
-}
diff --git a/2015/Day25/input.in b/2015/Day25/input.in
deleted file mode 100644
index d4c53d3dd..000000000
Binary files a/2015/Day25/input.in and /dev/null differ
diff --git a/2015/Day25/input.refout b/2015/Day25/input.refout
deleted file mode 100644
index 3d80891c5..000000000
--- a/2015/Day25/input.refout
+++ /dev/null
@@ -1 +0,0 @@
-2650453
diff --git a/2015/README.md b/2015/README.md
deleted file mode 100644
index a98cc6d87..000000000
--- a/2015/README.md
+++ /dev/null
@@ -1,4 +0,0 @@
-# Advent of Code (2015)
-Check out https://adventofcode.com/2015.
-
-
diff --git a/2015/SplashScreen.cs b/2015/SplashScreen.cs
deleted file mode 100644
index 64c664e9c..000000000
--- a/2015/SplashScreen.cs
+++ /dev/null
@@ -1,514 +0,0 @@
-using System;
-
-namespace AdventOfCode.Y2015;
-
-class SplashScreenImpl : SplashScreen {
-
- public void Show() {
-
- var color = Console.ForegroundColor;
- Write(0xcc00, false, " ▄█▄ ▄▄█ ▄ ▄ ▄▄▄ ▄▄ ▄█▄ ▄▄▄ ▄█ ▄▄ ▄▄▄ ▄▄█ ▄▄▄\n █▄█ █ █ █ █ █▄█ █ █ █ █ █ █▄ ");
- Write(0xcc00, false, " █ █ █ █ █ █▄█\n █ █ █▄█ ▀▄▀ █▄▄ █ █ █▄ █▄█ █ █▄ █▄█ █▄█ █▄▄ {:year 2015}\n ");
- Write(0xcc00, false, "\n ");
- Write(0xffff66, true, "| \n \\|/ ");
- Write(0xffff66, true, "\n --*-- ");
- Write(0xcccccc, true, "25 ");
- Write(0xffff66, true, "**\n ");
- Write(0x9900, false, " >");
- Write(0xff9900, true, "o");
- Write(0x9900, false, "< ");
- Write(0xcccccc, false, "24 ");
- Write(0xffff66, false, "**\n ");
- Write(0x9900, false, " >>");
- Write(0x66ff, true, "O");
- Write(0x9900, false, "<< ");
- Write(0xcccccc, false, "23 ");
- Write(0xffff66, false, "**\n ");
- Write(0x9900, false, " >");
- Write(0xff9900, true, "o");
- Write(0x9900, false, ">>>");
- Write(0xff0000, true, "@");
- Write(0x9900, false, "< ");
- Write(0xcccccc, false, "22 ");
- Write(0xffff66, false, "**\n ");
- Write(0x9900, false, " >");
- Write(0xff0000, true, "@");
- Write(0x9900, false, "<<");
- Write(0xffff66, true, "*");
- Write(0x9900, false, "<");
- Write(0x66ff, true, "O");
- Write(0x9900, false, "<< ");
- Write(0xcccccc, false, "21 ");
- Write(0xffff66, false, "**\n ");
- Write(0x9900, false, " >>");
- Write(0xff9900, true, "o");
- Write(0x9900, false, ">>");
- Write(0x66ff, true, "O");
- Write(0x9900, false, ">");
- Write(0xff0000, true, "@");
- Write(0x9900, false, "<<< ");
- Write(0xcccccc, false, "20 ");
- Write(0xffff66, false, "**\n ");
- Write(0x9900, false, " >");
- Write(0xff9900, true, "o");
- Write(0x9900, false, ">");
- Write(0xff9900, true, "o");
- Write(0x9900, false, ">");
- Write(0x66ff, true, "O");
- Write(0x9900, false, ">>");
- Write(0xff0000, true, "@");
- Write(0x9900, false, "<<<< ");
- Write(0xcccccc, false, "19 ");
- Write(0xffff66, false, "**\n ");
- Write(0x9900, false, " >>");
- Write(0xff9900, true, "o");
- Write(0x9900, false, "<<<");
- Write(0x66ff, true, "O");
- Write(0x9900, false, "<");
- Write(0xff9900, true, "o");
- Write(0x9900, false, ">");
- Write(0xffff66, true, "*");
- Write(0x9900, false, "<");
- Write(0xffff66, true, "*");
- Write(0x9900, false, "<< ");
- Write(0xcccccc, false, "18 ");
- Write(0xffff66, false, "**\n ");
- Write(0x9900, false, " >");
- Write(0xff0000, true, "@");
- Write(0x9900, false, ">>>");
- Write(0xff9900, true, "o");
- Write(0x9900, false, ">>>");
- Write(0xff0000, true, "@");
- Write(0x9900, false, ">");
- Write(0xff9900, true, "o");
- Write(0x9900, false, "<<");
- Write(0x66ff, true, "O");
- Write(0x9900, false, "<< ");
- Write(0xcccccc, false, "17 ");
- Write(0xffff66, false, "**\n ");
- Write(0x9900, false, " >>");
- Write(0xffff66, true, "*");
- Write(0x9900, false, ">>");
- Write(0x66ff, true, "O");
- Write(0x9900, false, ">");
- Write(0xff0000, true, "@");
- Write(0x9900, false, ">>>");
- Write(0xffff66, true, "*");
- Write(0x9900, false, "<<<");
- Write(0xff9900, true, "o");
- Write(0x9900, false, ">");
- Write(0x66ff, true, "O");
- Write(0x9900, false, "< ");
- Write(0xcccccc, false, "16 ");
- Write(0xffff66, false, "**\n ");
- Write(0x9900, false, " >>");
- Write(0xff0000, true, "@");
- Write(0x9900, false, ">>");
- Write(0xff9900, true, "o");
- Write(0x9900, false, ">");
- Write(0xffff66, true, "*");
- Write(0x9900, false, ">>>");
- Write(0xff0000, true, "@");
- Write(0x9900, false, "<<<");
- Write(0x66ff, true, "O");
- Write(0x9900, false, "<");
- Write(0x66ff, true, "O");
- Write(0x9900, false, "<<< ");
- Write(0xcccccc, false, "15 ");
- Write(0xffff66, false, "**\n ");
- Write(0x9900, false, " >>");
- Write(0xff0000, true, "@");
- Write(0x9900, false, "<<");
- Write(0xff9900, true, "o");
- Write(0x9900, false, "<<<");
- Write(0xff0000, true, "@");
- Write(0x9900, false, ">>");
- Write(0xffff66, true, "*");
- Write(0x9900, false, "<<");
- Write(0xff0000, true, "@");
- Write(0x9900, false, ">");
- Write(0xff0000, true, "@");
- Write(0x9900, false, ">");
- Write(0xff0000, true, "@");
- Write(0x9900, false, ">");
- Write(0x66ff, true, "O");
- Write(0x9900, false, "< ");
- Write(0xcccccc, false, "14 ");
- Write(0xffff66, false, "**\n ");
- Write(0x9900, false, " >");
- Write(0xffff66, true, "*");
- Write(0x9900, false, "<<");
- Write(0x66ff, true, "O");
- Write(0x9900, false, ">>>");
- Write(0xffff66, true, "*");
- Write(0x9900, false, "<<");
- Write(0xffff66, true, "*");
- Write(0x9900, false, "<");
- Write(0xff0000, true, "@");
- Write(0x9900, false, "<");
- Write(0x66ff, true, "O");
- Write(0x9900, false, "<<<");
- Write(0x66ff, true, "O");
- Write(0x9900, false, "<<");
- Write(0x66ff, true, "O");
- Write(0x9900, false, "<< ");
- Write(0xcccccc, false, "13 ");
- Write(0xffff66, false, "**\n ");
- Write(0x9900, false, " >");
- Write(0xff0000, true, "@");
- Write(0x9900, false, ">>>");
- Write(0xff9900, true, "o");
- Write(0x9900, false, ">>>");
- Write(0xff0000, true, "@");
- Write(0x9900, false, "<");
- Write(0xff9900, true, "o");
- Write(0x9900, false, ">>");
- Write(0xff0000, true, "@");
- Write(0x9900, false, "<<");
- Write(0x66ff, true, "O");
- Write(0x9900, false, ">>>");
- Write(0x66ff, true, "O");
- Write(0x9900, false, "<<<");
- Write(0xff9900, true, "o");
- Write(0x9900, false, "< ");
- Write(0xcccccc, false, "12 ");
- Write(0xffff66, false, "**\n ");
- Write(0x9900, false, " >");
- Write(0xff9900, true, "o");
- Write(0x9900, false, ">");
- Write(0x66ff, true, "O");
- Write(0x9900, false, "<");
- Write(0xff0000, true, "@");
- Write(0x9900, false, "<<<");
- Write(0xff9900, true, "o");
- Write(0x9900, false, "<");
- Write(0xffff66, true, "*");
- Write(0x9900, false, ">");
- Write(0xff0000, true, "@");
- Write(0x9900, false, "<<");
- Write(0x66ff, true, "O");
- Write(0x9900, false, "<<<");
- Write(0x66ff, true, "O");
- Write(0x9900, false, ">>>");
- Write(0xffff66, true, "*");
- Write(0x9900, false, ">");
- Write(0x66ff, true, "O");
- Write(0x9900, false, "<< ");
- Write(0xcccccc, false, "11 ");
- Write(0xffff66, false, "**\n ");
- Write(0x9900, false, " >");
- Write(0xff0000, true, "@");
- Write(0x9900, false, ">");
- Write(0xffff66, true, "*");
- Write(0x9900, false, ">>>");
- Write(0xff9900, true, "o");
- Write(0x9900, false, ">>");
- Write(0xff0000, true, "@");
- Write(0x9900, false, "<");
- Write(0x66ff, true, "O");
- Write(0x9900, false, ">");
- Write(0xff9900, true, "o");
- Write(0x9900, false, ">");
- Write(0xff0000, true, "@");
- Write(0x9900, false, "<");
- Write(0x66ff, true, "O");
- Write(0x9900, false, ">>>");
- Write(0xff0000, true, "@");
- Write(0x9900, false, ">");
- Write(0xffff66, true, "*");
- Write(0x9900, false, ">");
- Write(0xff9900, true, "o");
- Write(0x9900, false, "<<");
- Write(0x66ff, true, "O");
- Write(0x9900, false, "< ");
- Write(0xcccccc, false, "10 ");
- Write(0xffff66, false, "**\n ");
- Write(0x9900, false, " >>");
- Write(0xff0000, true, "@");
- Write(0x9900, false, ">>>");
- Write(0xffff66, true, "*");
- Write(0x9900, false, ">>");
- Write(0xff9900, true, "o");
- Write(0x9900, false, "<");
- Write(0x66ff, true, "O");
- Write(0x9900, false, ">>>");
- Write(0xff9900, true, "o");
- Write(0x9900, false, ">");
- Write(0xff9900, true, "o");
- Write(0x9900, false, ">>");
- Write(0xff9900, true, "o");
- Write(0x9900, false, ">");
- Write(0x66ff, true, "O");
- Write(0x9900, false, "<<<");
- Write(0xffff66, true, "*");
- Write(0x9900, false, "<<<");
- Write(0x66ff, true, "O");
- Write(0x9900, false, "<< ");
- Write(0xcccccc, false, " 9 ");
- Write(0xffff66, false, "**\n ");
- Write(0x9900, false, " >>");
- Write(0xff0000, true, "@");
- Write(0x9900, false, "<");
- Write(0xff9900, true, "o");
- Write(0x9900, false, ">>");
- Write(0x66ff, true, "O");
- Write(0x9900, false, ">");
- Write(0x66ff, true, "O");
- Write(0x9900, false, "<");
- Write(0xffff66, true, "*");
- Write(0x9900, false, "<<");
- Write(0x66ff, true, "O");
- Write(0x9900, false, ">");
- Write(0x66ff, true, "O");
- Write(0x9900, false, ">>");
- Write(0xffff66, true, "*");
- Write(0x9900, false, "<");
- Write(0xffff66, true, "*");
- Write(0x9900, false, "<");
- Write(0xff9900, true, "o");
- Write(0x9900, false, "<<<");
- Write(0xffff66, true, "*");
- Write(0x9900, false, ">");
- Write(0xffff66, true, "*");
- Write(0x9900, false, "<");
- Write(0xff9900, true, "o");
- Write(0x9900, false, ">");
- Write(0xff9900, true, "o");
- Write(0x9900, false, "< ");
- Write(0xcccccc, false, " 8 ");
- Write(0xffff66, false, "**\n ");
- Write(0x9900, false, " >>");
- Write(0x66ff, true, "O");
- Write(0x9900, false, "<");
- Write(0x66ff, true, "O");
- Write(0x9900, false, "<");
- Write(0xff9900, true, "o");
- Write(0x9900, false, "<<");
- Write(0xff9900, true, "o");
- Write(0x9900, false, ">>");
- Write(0xff0000, true, "@");
- Write(0x9900, false, ">>");
- Write(0xff9900, true, "o");
- Write(0x9900, false, "<<");
- Write(0xffff66, true, "*");
- Write(0x9900, false, "<<<");
- Write(0xff9900, true, "o");
- Write(0x9900, false, ">>>");
- Write(0x66ff, true, "O");
- Write(0x9900, false, "<");
- Write(0xff9900, true, "o");
- Write(0x9900, false, "<<");
- Write(0xff9900, true, "o");
- Write(0x9900, false, ">");
- Write(0xffff66, true, "*");
- Write(0x9900, false, "<");
- Write(0xff0000, true, "@");
- Write(0x9900, false, "< ");
- Write(0xcccccc, false, " 7 ");
- Write(0xffff66, false, "**\n ");
- Write(0x9900, false, " >>");
- Write(0xff0000, true, "@");
- Write(0x9900, false, "<");
- Write(0xff9900, true, "o");
- Write(0x9900, false, ">>>");
- Write(0x66ff, true, "O");
- Write(0x9900, false, ">");
- Write(0x66ff, true, "O");
- Write(0x9900, false, "<");
- Write(0xff9900, true, "o");
- Write(0x9900, false, ">>");
- Write(0x66ff, true, "O");
- Write(0x9900, false, "<<<");
- Write(0xffff66, true, "*");
- Write(0x9900, false, "<");
- Write(0xff9900, true, "o");
- Write(0x9900, false, "<<");
- Write(0xff9900, true, "o");
- Write(0x9900, false, "<<");
- Write(0xffff66, true, "*");
- Write(0x9900, false, "<<");
- Write(0x66ff, true, "O");
- Write(0x9900, false, "<<");
- Write(0xff0000, true, "@");
- Write(0x9900, false, ">>>");
- Write(0xff9900, true, "o");
- Write(0x9900, false, "< ");
- Write(0xcccccc, false, " 6 ");
- Write(0xffff66, false, "**\n ");
- Write(0x9900, false, " >>");
- Write(0xff0000, true, "@");
- Write(0x9900, false, ">>>");
- Write(0x66ff, true, "O");
- Write(0x9900, false, ">");
- Write(0xff0000, true, "@");
- Write(0x9900, false, ">");
- Write(0xffff66, true, "*");
- Write(0x9900, false, "<<<");
- Write(0xff9900, true, "o");
- Write(0x9900, false, ">");
- Write(0xffff66, true, "*");
- Write(0x9900, false, ">");
- Write(0xff9900, true, "o");
- Write(0x9900, false, "<");
- Write(0xff9900, true, "o");
- Write(0x9900, false, ">>");
- Write(0xff0000, true, "@");
- Write(0x9900, false, "<<<");
- Write(0xff0000, true, "@");
- Write(0x9900, false, "<<");
- Write(0xffff66, true, "*");
- Write(0x9900, false, ">>");
- Write(0xff0000, true, "@");
- Write(0x9900, false, "<");
- Write(0x66ff, true, "O");
- Write(0x9900, false, "<<");
- Write(0xffff66, true, "*");
- Write(0x9900, false, "<< ");
- Write(0xcccccc, false, " 5 ");
- Write(0xffff66, false, "**\n ");
- Write(0x9900, false, " >>");
- Write(0x66ff, true, "O");
- Write(0x9900, false, "<<");
- Write(0x66ff, true, "O");
- Write(0x9900, false, "<<<");
- Write(0xffff66, true, "*");
- Write(0x9900, false, "<");
- Write(0xffff66, true, "*");
- Write(0x9900, false, "<<<");
- Write(0xffff66, true, "*");
- Write(0x9900, false, "<<");
- Write(0x66ff, true, "O");
- Write(0x9900, false, "<<");
- Write(0xff0000, true, "@");
- Write(0x9900, false, "<<");
- Write(0xff9900, true, "o");
- Write(0x9900, false, ">>");
- Write(0xffff66, true, "*");
- Write(0x9900, false, ">>");
- Write(0xff0000, true, "@");
- Write(0x9900, false, "<");
- Write(0x66ff, true, "O");
- Write(0x9900, false, "<<");
- Write(0xff9900, true, "o");
- Write(0x9900, false, "<<");
- Write(0xff0000, true, "@");
- Write(0x9900, false, "<<<< ");
- Write(0xcccccc, false, " 4 ");
- Write(0xffff66, false, "**\n ");
- Write(0x9900, false, " >");
- Write(0xff0000, true, "@");
- Write(0x9900, false, "<<");
- Write(0x66ff, true, "O");
- Write(0x9900, false, "<");
- Write(0xff0000, true, "@");
- Write(0x9900, false, ">>");
- Write(0x66ff, true, "O");
- Write(0x9900, false, ">>>");
- Write(0xffff66, true, "*");
- Write(0x9900, false, "<<");
- Write(0xff9900, true, "o");
- Write(0x9900, false, ">>>");
- Write(0xffff66, true, "*");
- Write(0x9900, false, ">");
- Write(0xff0000, true, "@");
- Write(0x9900, false, "<<");
- Write(0x66ff, true, "O");
- Write(0x9900, false, ">");
- Write(0x66ff, true, "O");
- Write(0x9900, false, ">");
- Write(0xffff66, true, "*");
- Write(0x9900, false, "<");
- Write(0x66ff, true, "O");
- Write(0x9900, false, ">>>");
- Write(0x66ff, true, "O");
- Write(0x9900, false, ">>");
- Write(0xff9900, true, "o");
- Write(0x9900, false, ">>>");
- Write(0xff0000, true, "@");
- Write(0x9900, false, "<< ");
- Write(0xcccccc, false, " 3 ");
- Write(0xffff66, false, "**\n ");
- Write(0x9900, false, " >>");
- Write(0xff0000, true, "@");
- Write(0x9900, false, "<");
- Write(0xff0000, true, "@");
- Write(0x9900, false, ">");
- Write(0xff9900, true, "o");
- Write(0x9900, false, "<<");
- Write(0xff9900, true, "o");
- Write(0x9900, false, "<<<");
- Write(0xff9900, true, "o");
- Write(0x9900, false, ">>>");
- Write(0x66ff, true, "O");
- Write(0x9900, false, "<");
- Write(0xff0000, true, "@");
- Write(0x9900, false, "<<");
- Write(0xffff66, true, "*");
- Write(0x9900, false, ">");
- Write(0xffff66, true, "*");
- Write(0x9900, false, ">>>");
- Write(0xffff66, true, "*");
- Write(0x9900, false, "<");
- Write(0xff0000, true, "@");
- Write(0x9900, false, "<");
- Write(0xff0000, true, "@");
- Write(0x9900, false, ">>>");
- Write(0xffff66, true, "*");
- Write(0x9900, false, "<");
- Write(0xffff66, true, "*");
- Write(0x9900, false, ">");
- Write(0x66ff, true, "O");
- Write(0x9900, false, "<");
- Write(0xff0000, true, "@");
- Write(0x9900, false, ">>");
- Write(0x66ff, true, "O");
- Write(0x9900, false, "< ");
- Write(0xcccccc, false, " 2 ");
- Write(0xffff66, false, "**\n ");
- Write(0x9900, false, ">>");
- Write(0xffff66, true, "*");
- Write(0x9900, false, ">>");
- Write(0xff0000, true, "@");
- Write(0x9900, false, ">");
- Write(0xffff66, true, "*");
- Write(0x9900, false, "<<<");
- Write(0xffff66, true, "*");
- Write(0x9900, false, "<<");
- Write(0xff0000, true, "@");
- Write(0x9900, false, ">>");
- Write(0x66ff, true, "O");
- Write(0x9900, false, "<");
- Write(0xffff66, true, "*");
- Write(0x9900, false, "<<");
- Write(0xffff66, true, "*");
- Write(0x9900, false, "<<");
- Write(0xffff66, true, "*");
- Write(0x9900, false, ">>>");
- Write(0xff9900, true, "o");
- Write(0x9900, false, ">>>");
- Write(0xff0000, true, "@");
- Write(0x9900, false, "<<");
- Write(0x66ff, true, "O");
- Write(0x9900, false, "<");
- Write(0xffff66, true, "*");
- Write(0x9900, false, "<");
- Write(0xffff66, true, "*");
- Write(0x9900, false, ">>");
- Write(0xffff66, true, "*");
- Write(0x9900, false, "<<");
- Write(0xff9900, true, "o");
- Write(0x9900, false, "<< ");
- Write(0xcccccc, false, " 1 ");
- Write(0xffff66, false, "**\n ");
- Write(0xcccccc, false, " | | \n | | ");
- Write(0xcccccc, false, " \n _ _ __ ___|___|___ __ _ _ \n ");
- Write(0xcccccc, false, " \n");
-
- Console.ForegroundColor = color;
- Console.WriteLine();
- }
-
- private static void Write(int rgb, bool bold, string text){
- Console.Write($"\u001b[38;2;{(rgb>>16)&255};{(rgb>>8)&255};{rgb&255}{(bold ? ";1" : "")}m{text}");
- }
-}
\ No newline at end of file
diff --git a/2015/calendar.svg b/2015/calendar.svg
deleted file mode 100644
index 40356baaa..000000000
--- a/2015/calendar.svg
+++ /dev/null
@@ -1,51 +0,0 @@
-
\ No newline at end of file
diff --git a/2016/Day01/README.md b/2016/Day01/README.md
deleted file mode 100644
index 4c302f2ce..000000000
--- a/2016/Day01/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-## --- Day 1: No Time for a Taxicab ---
-Santa's sleigh uses a very high-precision clock to guide its movements, and the clock's oscillator is regulated by stars. Unfortunately, the stars have been stolen... by the Easter Bunny. To save Christmas, Santa needs you to retrieve all fifty stars by December 25th.
-
-Collect stars by solving puzzles. Two puzzles will be made available on each day in the Advent calendar; the second puzzle is unlocked when you complete the first. Each puzzle grants one star. Good luck!
-
-_Visit the website for the full story and [full puzzle](https://adventofcode.com/2016/day/1) description._
diff --git a/2016/Day01/Solution.cs b/2016/Day01/Solution.cs
deleted file mode 100644
index c182debd9..000000000
--- a/2016/Day01/Solution.cs
+++ /dev/null
@@ -1,47 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text.RegularExpressions;
-
-namespace AdventOfCode.Y2016.Day01;
-
-[ProblemName("No Time for a Taxicab")]
-class Solution : Solver {
-
- public object PartOne(string input) {
- var (irow, icol) = Travel(input).Last();
- return irow + icol;
- }
-
- public object PartTwo(string input) {
- var seen = new HashSet<(int, int)>();
- foreach (var pos in Travel(input)) {
- if (seen.Contains(pos)) {
- return (pos.icol + pos.irow);
- }
- seen.Add(pos);
- }
- throw new Exception();
- }
-
- IEnumerable<(int irow, int icol)> Travel(string input) {
- var (irow, icol) = (0, 0);
- var (drow, dcol) = (-1, 0);
- yield return (irow, icol);
-
- foreach (var stm in Regex.Split(input, ", ")) {
- var d = int.Parse(stm.Substring(1));
-
- (drow, dcol) = stm[0] switch {
- 'R' => (dcol, -drow),
- 'L' => (-dcol, drow),
- _ => throw new ArgumentException()
- };
-
- for (int i = 0; i < d; i++) {
- (irow, icol) = (irow + drow, icol + dcol);
- yield return (irow, icol);
- }
- }
- }
-}
diff --git a/2016/Day01/input.in b/2016/Day01/input.in
deleted file mode 100644
index 687ec0109..000000000
Binary files a/2016/Day01/input.in and /dev/null differ
diff --git a/2016/Day01/input.refout b/2016/Day01/input.refout
deleted file mode 100644
index c721c8776..000000000
--- a/2016/Day01/input.refout
+++ /dev/null
@@ -1,2 +0,0 @@
-241
-116
\ No newline at end of file
diff --git a/2016/Day02/README.md b/2016/Day02/README.md
deleted file mode 100644
index 345a8b762..000000000
--- a/2016/Day02/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-## --- Day 2: Bathroom Security ---
-You arrive at *Easter Bunny Headquarters* under cover of darkness. However, you left in such a rush that you forgot to use the bathroom! Fancy office buildings like this one usually have keypad locks on their bathrooms, so you search the front desk for the code.
-
-"In order to improve security," the document you find says, "bathroom codes will no longer be written down. Instead, please memorize and follow the procedure below to access the bathrooms."
-
-Read the [full puzzle](https://adventofcode.com/2016/day/2).
\ No newline at end of file
diff --git a/2016/Day02/Solution.cs b/2016/Day02/Solution.cs
deleted file mode 100644
index ed6093e9a..000000000
--- a/2016/Day02/Solution.cs
+++ /dev/null
@@ -1,35 +0,0 @@
-using System;
-
-namespace AdventOfCode.Y2016.Day02;
-
-[ProblemName("Bathroom Security")]
-class Solution : Solver {
-
- public object PartOne(string input) => Solve(input, "123\n456\n789");
- public object PartTwo(string input) => Solve(input, " 1 \n 234 \n56789\n ABC \n D ");
-
- string Solve(string input, string keypad) {
- var res = "";
- var lines = keypad.Split('\n');
- var (crow, ccol) = (lines.Length, lines[0].Length);
- var (irow, icol) = (crow / 2, ccol / 2);
- foreach (var line in input.Split('\n')) {
- foreach (var ch in line) {
- var (drow, dcol) = ch switch {
- 'U' => (-1, 0),
- 'D' => (1, 0),
- 'L' => (0, -1),
- 'R' => (0, 1),
- _ => throw new ArgumentException()
- };
-
- var (irowT, icolT) = (irow + drow, icol + dcol);
- if (irowT >= 0 && irowT < crow && icolT >= 0 && icolT < ccol && lines[irowT][icolT] != ' ') {
- (irow, icol) = (irowT, icolT);
- }
- }
- res += lines[irow][icol];
- }
- return res;
- }
-}
diff --git a/2016/Day02/input.in b/2016/Day02/input.in
deleted file mode 100644
index df0dff54a..000000000
Binary files a/2016/Day02/input.in and /dev/null differ
diff --git a/2016/Day02/input.refout b/2016/Day02/input.refout
deleted file mode 100644
index e4ea5d438..000000000
--- a/2016/Day02/input.refout
+++ /dev/null
@@ -1,2 +0,0 @@
-18843
-67BB9
diff --git a/2016/Day03/README.md b/2016/Day03/README.md
deleted file mode 100644
index cd2bf19f7..000000000
--- a/2016/Day03/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-## --- Day 3: Squares With Three Sides ---
-Now that you can think clearly, you move deeper into the labyrinth of hallways and office furniture that makes up this part of Easter Bunny HQ. This must be a graphic design department; the walls are covered in specifications for triangles.
-
-Or are they?
-
-Read the [full puzzle](https://adventofcode.com/2016/day/3).
\ No newline at end of file
diff --git a/2016/Day03/Solution.cs b/2016/Day03/Solution.cs
deleted file mode 100644
index d2aae2804..000000000
--- a/2016/Day03/Solution.cs
+++ /dev/null
@@ -1,49 +0,0 @@
-using System.Collections.Generic;
-using System.Linq;
-using System.Text.RegularExpressions;
-
-namespace AdventOfCode.Y2016.Day03;
-
-[ProblemName("Squares With Three Sides")]
-class Solution : Solver {
-
- public object PartOne(string input) => ValidTriangles(Parse(input));
-
- public object PartTwo(string input) {
- var tripplets = new List>();
-
- foreach (var lineT in Transpose(Parse(input))) {
- IEnumerable line = lineT;
- while (line.Any()) {
- tripplets.Add(line.Take(3));
- line = line.Skip(3);
- }
- }
-
- return ValidTriangles(tripplets);
- }
-
- int[][] Parse(string input) => (
- from line in input.Split('\n')
- select Regex.Matches(line, @"\d+").Select(m => int.Parse(m.Value)).ToArray()
- ).ToArray();
-
- int ValidTriangles(IEnumerable> tripplets) =>
- tripplets.Count(tripplet => {
- var nums = tripplet.OrderBy(x => x).ToArray();
- return nums[0] + nums[1] > nums[2];
- });
-
- int[][] Transpose(int[][] src) {
- var crowDst = src[0].Length;
- var ccolDst = src.Length;
- int[][] dst = new int[crowDst][];
- for (int irowDst = 0; irowDst < crowDst; irowDst++) {
- dst[irowDst] = new int[ccolDst];
- for (int icolDst = 0; icolDst < ccolDst; icolDst++) {
- dst[irowDst][icolDst] = src[icolDst][irowDst];
- }
- }
- return dst;
- }
-}
diff --git a/2016/Day03/input.in b/2016/Day03/input.in
deleted file mode 100644
index 84fc5ad53..000000000
Binary files a/2016/Day03/input.in and /dev/null differ
diff --git a/2016/Day03/input.refout b/2016/Day03/input.refout
deleted file mode 100644
index db37dd155..000000000
--- a/2016/Day03/input.refout
+++ /dev/null
@@ -1,2 +0,0 @@
-982
-1826
diff --git a/2016/Day04/README.md b/2016/Day04/README.md
deleted file mode 100644
index 39105dd2f..000000000
--- a/2016/Day04/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-## --- Day 4: Security Through Obscurity ---
-Finally, you come across an information kiosk with a list of rooms. Of course, the list is encrypted and full of decoy data, but the instructions to decode the list are barely hidden nearby. Better remove the decoy data first.
-
-Each room consists of an encrypted name (lowercase letters separated by dashes) followed by a dash, a sector ID, and a checksum in square brackets.
-
-Read the [full puzzle](https://adventofcode.com/2016/day/4).
\ No newline at end of file
diff --git a/2016/Day04/Solution.cs b/2016/Day04/Solution.cs
deleted file mode 100644
index 1f849f1e0..000000000
--- a/2016/Day04/Solution.cs
+++ /dev/null
@@ -1,33 +0,0 @@
-using System.Collections.Generic;
-using System.Linq;
-using System.Text.RegularExpressions;
-
-namespace AdventOfCode.Y2016.Day04;
-
-[ProblemName("Security Through Obscurity")]
-class Solution : Solver {
-
- public object PartOne(string input) => (
- from i in Parse(input)
- let name = i.name.Replace("-", "")
- let computedChecksum = string.Join("", (from ch in name group ch by ch into g orderby -g.Count(), g.Key select g.Key).Take(5))
- where computedChecksum == i.checksum
- select i.sectorid
- ).Sum();
-
- public object PartTwo(string input) => (
- from i in Parse(input)
- let name = string.Join("", from ch in i.name select ch == '-' ? ' ' : (char)('a' + (ch - 'a' + i.sectorid) % 26))
- where name.Contains("northpole")
- select i.sectorid
- ).Single();
-
- IEnumerable<(string name, int sectorid, string checksum)> Parse(string input){
- var rx = new Regex(@"([^\d]+)\-(\d+)\[(.*)\]");
-
- return from line in input.Split('\n')
- let m = rx.Match(line)
- select (m.Groups[1].Value, int.Parse(m.Groups[2].Value), m.Groups[3].Value);
-
- }
-}
diff --git a/2016/Day04/input.in b/2016/Day04/input.in
deleted file mode 100644
index c951db70c..000000000
Binary files a/2016/Day04/input.in and /dev/null differ
diff --git a/2016/Day04/input.refout b/2016/Day04/input.refout
deleted file mode 100644
index af0c1afc2..000000000
--- a/2016/Day04/input.refout
+++ /dev/null
@@ -1,2 +0,0 @@
-361724
-482
diff --git a/2016/Day05/README.md b/2016/Day05/README.md
deleted file mode 100644
index e510a6e67..000000000
--- a/2016/Day05/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-## --- Day 5: How About a Nice Game of Chess? ---
-You are faced with a security door designed by Easter Bunny engineers that seem to have acquired most of their security knowledge by watching [hacking](https://en.wikipedia.org/wiki/Hackers_(film)) [movies](https://en.wikipedia.org/wiki/WarGames).
-
-The *eight-character password* for the door is generated one character at a time by finding the [MD5](https://en.wikipedia.org/wiki/MD5) hash of some Door ID (your puzzle input) and an increasing integer index (starting with `0`).
-
-Read the [full puzzle](https://adventofcode.com/2016/day/5).
\ No newline at end of file
diff --git a/2016/Day05/Solution.cs b/2016/Day05/Solution.cs
deleted file mode 100644
index d050541bd..000000000
--- a/2016/Day05/Solution.cs
+++ /dev/null
@@ -1,75 +0,0 @@
-using System;
-using System.Collections.Concurrent;
-using System.Collections.Generic;
-using System.Globalization;
-using System.Linq;
-using System.Security.Cryptography;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace AdventOfCode.Y2016.Day05;
-
-[ProblemName("How About a Nice Game of Chess?")]
-class Solution : Solver
-{
-
- public object PartOne(string input)
- {
- return string.Join("", Hashes(input).Select(hash => hash[5]).Take(8));
- }
-
- public object PartTwo(string input)
- {
- var res = new char[8];
- var found = 0;
- foreach (var hash in Hashes(input))
- {
- var idx = hash[5] - '0';
- if (0 <= idx && idx < 8 && res[idx] == 0)
- {
- res[idx] = hash[6];
- found++;
- if (found == 8) {
- break;
- }
- }
-
- }
- return string.Join("", res);
- }
-
- public IEnumerable Hashes(string input)
- {
-
- for (var i = 0; i < int.MaxValue; i++)
- {
- var q = new ConcurrentQueue<(int i, string hash)>();
-
- Parallel.ForEach(
- NumbersFrom(i),
- () => MD5.Create(),
- (i, state, md5) =>
- {
- var hash = md5.ComputeHash(Encoding.ASCII.GetBytes(input + i));
- var hashString = string.Join("", hash.Select(x => x.ToString("x2")));
-
- if (hashString.StartsWith("00000"))
- {
- q.Enqueue((i, hashString));
- state.Stop();
- }
- return md5;
- },
- (_) => { }
- );
- var item = q.OrderBy(x => x.i).First();
- i = item.i;
- yield return item.hash;
- }
- }
-
- IEnumerable NumbersFrom(int i)
- {
- for (;;) yield return i++;
- }
-}
diff --git a/2016/Day05/input.in b/2016/Day05/input.in
deleted file mode 100644
index b5738f5d8..000000000
Binary files a/2016/Day05/input.in and /dev/null differ
diff --git a/2016/Day05/input.refout b/2016/Day05/input.refout
deleted file mode 100644
index 4af3e6497..000000000
--- a/2016/Day05/input.refout
+++ /dev/null
@@ -1,2 +0,0 @@
-f97c354d
-863dde27
diff --git a/2016/Day06/README.md b/2016/Day06/README.md
deleted file mode 100644
index d93688e72..000000000
--- a/2016/Day06/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-## --- Day 6: Signals and Noise ---
-Something is jamming your communications with Santa. Fortunately, your signal is only partially jammed, and protocol in situations like this is to switch to a simple [repetition code](https://en.wikipedia.org/wiki/Repetition_code) to get the message through.
-
-In this model, the same message is sent repeatedly. You've recorded the repeating message signal (your puzzle input), but the data seems quite corrupted - almost too badly to recover. *Almost*.
-
-Read the [full puzzle](https://adventofcode.com/2016/day/6).
\ No newline at end of file
diff --git a/2016/Day06/Solution.cs b/2016/Day06/Solution.cs
deleted file mode 100644
index 34c51528d..000000000
--- a/2016/Day06/Solution.cs
+++ /dev/null
@@ -1,22 +0,0 @@
-using System.Linq;
-
-namespace AdventOfCode.Y2016.Day06;
-
-[ProblemName("Signals and Noise")]
-class Solution : Solver {
-
- public object PartOne(string input) => Decode(input).mostFrequent;
- public object PartTwo(string input) => Decode(input).leastFrequent;
-
- (string mostFrequent, string leastFrequent) Decode(string input) {
- var lines = input.Split('\n');
- string mostFrequent = "";
- string leastFrequent = "";
- for (int i = 0; i < lines[0].Length; i++) {
- var items = (from line in lines group line by line[i] into g orderby g.Count() select g.Key);
- mostFrequent += items.Last();
- leastFrequent += items.First();
- }
- return (mostFrequent: mostFrequent, leastFrequent: leastFrequent);
- }
-}
diff --git a/2016/Day06/input.in b/2016/Day06/input.in
deleted file mode 100644
index 9873339f3..000000000
Binary files a/2016/Day06/input.in and /dev/null differ
diff --git a/2016/Day06/input.refout b/2016/Day06/input.refout
deleted file mode 100644
index 770f21cac..000000000
--- a/2016/Day06/input.refout
+++ /dev/null
@@ -1,2 +0,0 @@
-afwlyyyq
-bhkzekao
diff --git a/2016/Day07/README.md b/2016/Day07/README.md
deleted file mode 100644
index 089886307..000000000
--- a/2016/Day07/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-## --- Day 7: Internet Protocol Version 7 ---
-While snooping around the local network of EBHQ, you compile a list of [IP addresses](https://en.wikipedia.org/wiki/IP_address) (they're IPv7, of course; [IPv6](https://en.wikipedia.org/wiki/IPv6) is much too limited). You'd like to figure out which IPs support *TLS* (transport-layer snooping).
-
-An IP supports TLS if it has an Autonomous Bridge Bypass Annotation, or *ABBA*. An ABBA is any four-character sequence which consists of a pair of two different characters followed by the reverse of that pair, such as `xyyx` or `abba`. However, the IP also must not have an ABBA within any hypernet sequences, which are contained by *square brackets*.
-
-Read the [full puzzle](https://adventofcode.com/2016/day/7).
\ No newline at end of file
diff --git a/2016/Day07/Solution.cs b/2016/Day07/Solution.cs
deleted file mode 100644
index 799aac943..000000000
--- a/2016/Day07/Solution.cs
+++ /dev/null
@@ -1,61 +0,0 @@
-using System.Collections.Generic;
-using System.Linq;
-
-namespace AdventOfCode.Y2016.Day07;
-
-[ProblemName("Internet Protocol Version 7")]
-class Solution : Solver {
-
- public object PartOne(string input) =>
- input.Split('\n').Count(TLS);
-
- public object PartTwo(string input) =>
- input.Split('\n').Count(SSL);
-
-
- bool TLS(string st) =>
- Classify(st).Any(c => !c.f && Abba(c.st).Any()) &&
- Classify(st).All(c => !c.f || !Abba(c.st).Any());
-
- bool SSL(string st) => (
- from c1 in Classify(st)
- from c2 in Classify(st)
- where !c1.f && c2.f
- from aba in Aba(c1.st)
- let bab = $"{aba[1]}{aba[0]}{aba[1]}"
- where c2.st.Contains(bab)
- select true
- ).Any();
-
- IEnumerable<(string st, bool f)> Classify(string st) {
- var part = "";
- for (var i = 0; i < st.Length; i++) {
- var ch = st[i];
- if (ch == '[') {
- yield return (part, false);
- part = "";
- } else if (ch == ']') {
- yield return (part, true);
- part = "";
- } else {
- part += ch;
- }
- }
- if (part != "")
- yield return (part, false);
- }
-
- IEnumerable Abba(string st) {
- for (var i = 0; i < st.Length - 3; i++) {
- if(st[i + 2] == st[i + 1] && st[i] == st[i + 3] && st[i] != st[i + 2])
- yield return st.Substring(i, 4);
- }
- }
-
- IEnumerable Aba(string st) {
- for (var i = 0; i < st.Length -2; i++) {
- if(st[i] == st[i + 2] && st[i] != st[i + 1])
- yield return st.Substring(i, 3);
- }
- }
-}
diff --git a/2016/Day07/input.in b/2016/Day07/input.in
deleted file mode 100644
index ec26a4f10..000000000
Binary files a/2016/Day07/input.in and /dev/null differ
diff --git a/2016/Day07/input.refout b/2016/Day07/input.refout
deleted file mode 100644
index 91e64be76..000000000
--- a/2016/Day07/input.refout
+++ /dev/null
@@ -1,2 +0,0 @@
-118
-260
diff --git a/2016/Day08/README.md b/2016/Day08/README.md
deleted file mode 100644
index 6f22b40ab..000000000
--- a/2016/Day08/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-## --- Day 8: Two-Factor Authentication ---
-You come across a door implementing what you can only assume is an implementation of [two-factor authentication](https://en.wikipedia.org/wiki/Multi-factor_authentication) after a long game of [requirements](https://en.wikipedia.org/wiki/Requirement) [telephone](https://en.wikipedia.org/wiki/Chinese_whispers).
-
-To get past the door, you first swipe a keycard (no problem; there was one on a nearby desk). Then, it displays a code on a [little screen](https://www.google.com/search?q=tiny+lcd&tbm=isch), and you type that code on a keypad. Then, presumably, the door unlocks.
-
-Read the [full puzzle](https://adventofcode.com/2016/day/8).
\ No newline at end of file
diff --git a/2016/Day08/Solution.cs b/2016/Day08/Solution.cs
deleted file mode 100644
index df27c2622..000000000
--- a/2016/Day08/Solution.cs
+++ /dev/null
@@ -1,76 +0,0 @@
-using System.Collections.Generic;
-using System.Linq;
-using System.Text.RegularExpressions;
-
-namespace AdventOfCode.Y2016.Day08;
-
-[ProblemName("Two-Factor Authentication")]
-class Solution : Solver {
-
- public object PartOne(string input) {
- var mtx = Execute(input);
- return (
- from irow in Enumerable.Range(0, mtx.GetLength(0))
- from icol in Enumerable.Range(0, mtx.GetLength(1))
- where mtx[irow, icol]
- select 1
- ).Count();
- }
-
- public object PartTwo(string input) {
- var mtx = Execute(input);
- var res = "";
- foreach (var irow in Enumerable.Range(0, mtx.GetLength(0))) {
- foreach (var icol in Enumerable.Range(0, mtx.GetLength(1))) {
- res += mtx[irow, icol] ? "#" : " ";
- }
- res += "\n";
- }
- return res.Ocr();
- }
-
- bool[,] Execute(string input) {
- var (crow, ccol) = (6, 50);
- var mtx = new bool[crow, ccol];
- foreach (var line in input.Split('\n')) {
- if (Match(line, @"rect (\d+)x(\d+)", out var m)) {
- var (ccolT, crowT) = (int.Parse(m[0]), int.Parse(m[1]));
- for (var irow = 0; irow < crowT; irow++) {
- for (var icol = 0; icol < ccolT; icol++) {
- mtx[irow, icol] = true;
- }
- }
- } else if (Match(line, @"rotate row y=(\d+) by (\d+)", out m)) {
- var (irow, d) = (int.Parse(m[0]), int.Parse(m[1]));
- for (int i = 0; i < d; i++) {
- var t = mtx[irow, ccol - 1];
- for (var icol = ccol - 1; icol >= 1; icol--) {
- mtx[irow, icol] = mtx[irow, icol - 1];
- }
- mtx[irow, 0] = t;
- }
- } else if (Match(line, @"rotate column x=(\d+) by (\d+)", out m)) {
- var (icol, d) = (int.Parse(m[0]), int.Parse(m[1]));
- for (int i = 0; i < d; i++) {
- var t = mtx[crow - 1, icol];
- for (var irow = crow - 1; irow >= 1; irow--) {
- mtx[irow, icol] = mtx[irow - 1, icol];
- }
- mtx[0, icol] = t;
- }
- }
- }
- return mtx;
- }
-
- bool Match(string stm, string pattern, out string[] m) {
- var match = Regex.Match(stm, pattern);
- m = null;
- if (match.Success) {
- m = match.Groups.Cast().Skip(1).Select(g => g.Value).ToArray();
- return true;
- } else {
- return false;
- }
- }
-}
diff --git a/2016/Day08/input.in b/2016/Day08/input.in
deleted file mode 100644
index 09aee8aee..000000000
Binary files a/2016/Day08/input.in and /dev/null differ
diff --git a/2016/Day08/input.refout b/2016/Day08/input.refout
deleted file mode 100644
index f9ca26155..000000000
--- a/2016/Day08/input.refout
+++ /dev/null
@@ -1,2 +0,0 @@
-110
-ZJHRKCPLYJ
diff --git a/2016/Day09/README.md b/2016/Day09/README.md
deleted file mode 100644
index 594534d99..000000000
--- a/2016/Day09/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-## --- Day 9: Explosives in Cyberspace ---
-Wandering around a secure area, you come across a datalink port to a new part of the network. After briefly scanning it for interesting files, you find one file in particular that catches your attention. It's compressed with an experimental format, but fortunately, the documentation for the format is nearby.
-
-The format compresses a sequence of characters. Whitespace is ignored. To indicate that some sequence should be repeated, a marker is added to the file, like `(10x2)`. To decompress this marker, take the subsequent `10` characters and repeat them `2` times. Then, continue reading the file *after* the repeated data. The marker itself is not included in the decompressed output.
-
-Read the [full puzzle](https://adventofcode.com/2016/day/9).
\ No newline at end of file
diff --git a/2016/Day09/Solution.cs b/2016/Day09/Solution.cs
deleted file mode 100644
index 372ab6d04..000000000
--- a/2016/Day09/Solution.cs
+++ /dev/null
@@ -1,33 +0,0 @@
-using System.Text.RegularExpressions;
-
-namespace AdventOfCode.Y2016.Day09;
-
-[ProblemName("Explosives in Cyberspace")]
-class Solution : Solver {
-
- public object PartOne(string input) {
- return Expand(input, 0, input.Length, false);
- }
-
- public object PartTwo(string input) {
- return Expand(input, 0, input.Length, true);
- }
-
- long Expand(string input, int i, int lim, bool recursive) {
- var res = 0L;
- while (i < lim) {
- if (input[i] == '(') {
- var j = input.IndexOf(')', i + 1);
- var m = Regex.Match(input.Substring(i + 1, j - i - 1), @"(\d+)x(\d+)");
- var length = int.Parse(m.Groups[1].Value);
- var mul = int.Parse(m.Groups[2].Value);
- res += recursive ? Expand(input, j + 1, j + length + 1, recursive) * mul : length * mul;
- i = j + length + 1;
- } else {
- res++;
- i++;
- }
- }
- return res;
- }
-}
diff --git a/2016/Day09/input.in b/2016/Day09/input.in
deleted file mode 100644
index 84798735c..000000000
Binary files a/2016/Day09/input.in and /dev/null differ
diff --git a/2016/Day09/input.refout b/2016/Day09/input.refout
deleted file mode 100644
index 51d073eaf..000000000
--- a/2016/Day09/input.refout
+++ /dev/null
@@ -1,2 +0,0 @@
-123908
-10755693147
diff --git a/2016/Day10/README.md b/2016/Day10/README.md
deleted file mode 100644
index d03015e16..000000000
--- a/2016/Day10/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-## --- Day 10: Balance Bots ---
-You come upon a factory in which many robots are [zooming around](https://www.youtube.com/watch?v=JnkMyfQ5YfY&t=40) handing small microchips to each other.
-
-Upon closer examination, you notice that each bot only proceeds when it has *two* microchips, and once it does, it gives each one to a different bot or puts it in a marked "output" bin. Sometimes, bots take microchips from "input" bins, too.
-
-Read the [full puzzle](https://adventofcode.com/2016/day/10).
\ No newline at end of file
diff --git a/2016/Day10/Solution.cs b/2016/Day10/Solution.cs
deleted file mode 100644
index 43938ec23..000000000
--- a/2016/Day10/Solution.cs
+++ /dev/null
@@ -1,77 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text.RegularExpressions;
-
-namespace AdventOfCode.Y2016.Day10;
-
-[ProblemName("Balance Bots")]
-class Solution : Solver {
-
- public object PartOne(string input) =>
- Execute(Parse(input)).Single(v => v.min == 17 && v.max == 61).id.Split(' ')[1];
-
- public object PartTwo(string input) {
- var m = Execute(Parse(input)).Last().machine;
- return m["output 0"].values.Single() * m["output 1"].values.Single() * m["output 2"].values.Single();
- }
-
- IEnumerable<(Dictionary machine, string id, int min, int max)> Execute(Dictionary machine) {
- var any = true;
- while (any) {
- any = false;
- foreach (var node in machine.Values) {
- if (node.values.Count == 2 && node.outHigh != null) {
- any = true;
- var (min, max) = (node.values.Min(), node.values.Max());
- machine[node.outLow].values.Add(min);
- machine[node.outHigh].values.Add(max);
- node.values.Clear();
- yield return (machine, node.id, min, max);
- }
- }
- }
- }
-
- Dictionary Parse(string input) {
- var res = new Dictionary();
- void ensureNodes(params string[] ids) {
- foreach (var id in ids) {
- if (!res.ContainsKey(id)) {
- res[id] = new Node { id = id };
- }
- }
- }
- foreach (var line in input.Split('\n')) {
- if (Match(line, @"(.+) gives low to (.+) and high to (.+)", out var m)) {
- ensureNodes(m);
- res[m[0]].outLow = m[1];
- res[m[0]].outHigh = m[2];
- } else if (Match(line, @"value (\d+) goes to (.+)", out m)) {
- ensureNodes(m[1]);
- res[m[1]].values.Add(int.Parse(m[0]));
- } else {
- throw new NotImplementedException();
- }
- }
- return res;
- }
-
- bool Match(string stm, string pattern, out string[] m) {
- var match = Regex.Match(stm, pattern);
- m = null;
- if (match.Success) {
- m = match.Groups.Cast().Skip(1).Select(g => g.Value).ToArray();
- return true;
- } else {
- return false;
- }
- }
-}
-
-class Node {
- public string id;
- public List values = new List();
- public string outLow;
- public string outHigh;
-}
diff --git a/2016/Day10/input.in b/2016/Day10/input.in
deleted file mode 100644
index 4c8c4256a..000000000
Binary files a/2016/Day10/input.in and /dev/null differ
diff --git a/2016/Day10/input.refout b/2016/Day10/input.refout
deleted file mode 100644
index c266b20a0..000000000
--- a/2016/Day10/input.refout
+++ /dev/null
@@ -1,2 +0,0 @@
-98
-4042
diff --git a/2016/Day11/README.md b/2016/Day11/README.md
deleted file mode 100644
index eaac04c4a..000000000
--- a/2016/Day11/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-## --- Day 11: Radioisotope Thermoelectric Generators ---
-You come upon a column of four floors that have been entirely sealed off from the rest of the building except for a small dedicated lobby. There are some radiation warnings and a big sign which reads "Radioisotope Testing Facility".
-
-According to the project status board, this facility is currently being used to experiment with [Radioisotope Thermoelectric Generators](https://en.wikipedia.org/wiki/Radioisotope_thermoelectric_generator) (RTGs, or simply "generators") that are designed to be paired with specially-constructed microchips. Basically, an RTG is a highly radioactive rock that generates electricity through heat.
-
-Read the [full puzzle](https://adventofcode.com/2016/day/11).
\ No newline at end of file
diff --git a/2016/Day11/Solution.cs b/2016/Day11/Solution.cs
deleted file mode 100644
index 0b90bb405..000000000
--- a/2016/Day11/Solution.cs
+++ /dev/null
@@ -1,185 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Text.RegularExpressions;
-
-namespace AdventOfCode.Y2016.Day11;
-
-enum Element {
- Thulium = 0b1,
- Plutonium = 0b10,
- Strontium = 0b100,
- Promethium = 0b1000,
- Ruthenium = 0b10000,
- Elerium = 0b100000,
- Dilithium = 0b1000000
-}
-
-[ProblemName("Radioisotope Thermoelectric Generators")]
-class Solution : Solver {
-
- public object PartOne(string input) => Solve(Parse(input));
- public object PartTwo(string input) => Solve(Parse(input)
- .AddGenerator(0, Element.Elerium).AddChip(0, Element.Elerium)
- .AddGenerator(0, Element.Dilithium).AddChip(0, Element.Dilithium)
- );
-
- int Solve(ulong state){
- var steps = 0;
- var seen = new HashSet();
- var q = new Queue<(int steps, ulong state)>();
- q.Enqueue((0, state));
- while (q.Any()) {
- (steps, state) = q.Dequeue();
-
- if (state.Final()) {
- return steps;
- }
-
- foreach(var nextState in state.NextStates()){
- if(!seen.Contains(nextState)){
- q.Enqueue((steps + 1, nextState));
- seen.Add(nextState);
- }
- }
- }
- return 0;
- }
- ulong Parse(string input) {
-
- var nextMask = 1;
- var elementToMask = new Dictionary();
- int mask(string element) {
- if (!elementToMask.ContainsKey(element)) {
- if (elementToMask.Count() == 5) {
- throw new NotImplementedException();
- }
- elementToMask[element] = nextMask;
- nextMask <<= 1;
- }
- return elementToMask[element];
- }
-
- ulong state = 0;
- var floor = 0;
- foreach(var line in input.Split('\n')){
- var chips = (from m in Regex.Matches(line, @"(\w+)-compatible")
- let element = m.Groups[1].Value
- select mask(element)).Sum();
-
- var generators = (from m in Regex.Matches(line, @"(\w+) generator")
- let element = m.Groups[1].Value
- select mask(element)).Sum();
- state = state.SetFloor((ulong)floor, (ulong)chips, (ulong)generators);
- floor++;
- }
- return state;
- }
-}
-
-static class StateExtensions {
- const int elementCount = 7;
- const int elevatorShift = 8 * elementCount;
- const int generatorShift = 0;
-
- static int[] floorShift = new int[] { 0, 2 * elementCount, 4 * elementCount, 6 * elementCount };
-
- const ulong elevatorMask = 0b00111111111111111111111111111111111111111111111111111111;
- const ulong chipMask = 0b00000001111111;
- const ulong generatorMask = 0b11111110000000;
-
- static ulong[] floorMask = new ulong[]{
- 0b1111111111111111111111111111111111111111111100000000000000,
- 0b1111111111111111111111111111110000000000000011111111111111,
- 0b1111111111111111000000000000001111111111111111111111111111,
- 0b1100000000000000111111111111111111111111111111111111111111
- };
-
- public static ulong SetFloor(this ulong state, ulong floor, ulong chips, ulong generators) =>
- (state & floorMask[floor]) |
- (((chips << elementCount) | (generators << generatorShift)) << floorShift[floor]);
-
- public static ulong GetElevator(this ulong state) =>
- (ulong)(state >> elevatorShift);
-
- public static ulong SetElevator(this ulong state, ulong elevator) =>
- (state & elevatorMask) | ((ulong)elevator << elevatorShift);
-
- public static ulong GetChips(this ulong state, ulong floor) =>
- (ulong)(((state & ~floorMask[floor]) >> floorShift[floor]) & ~chipMask) >> elementCount;
-
- public static ulong GetGenerators(this ulong state, ulong floor) =>
- (ulong)(((state & ~floorMask[floor]) >> floorShift[floor]) & ~generatorMask) >> generatorShift;
-
- public static ulong AddChip(this ulong state, ulong floor, Element chip) =>
- state | (((ulong)chip << elementCount) << floorShift[floor]);
-
- public static ulong AddGenerator(this ulong state, ulong floor, Element genetator) =>
- state | (((ulong)genetator << generatorShift) << floorShift[floor]);
-
- public static bool Valid(this ulong state) {
- for (int floor = 3; floor >= 0; floor--) {
- var chips = state.GetChips((ulong)floor);
- var generators = state.GetGenerators((ulong)floor);
- var pairs = chips & generators;
- var unpairedChips = chips & ~pairs;
- if (unpairedChips != 0 && generators != 0) {
- return false;
- }
- }
- return true;
- }
-
- public static IEnumerable NextStates(this ulong state) {
- var floor = state.GetElevator();
- for (ulong i = 1; i < 0b100000000000000; i <<= 1) {
- for (ulong j = 1; j < 0b100000000000000; j <<= 1) {
- var iOnFloor = i << floorShift[floor];
- var jOnFloor = j << floorShift[floor];
- if ((state & iOnFloor) != 0 && (state & jOnFloor) != 0) {
- if (floor > 0) {
- var iOnPrevFloor = i << floorShift[floor - 1];
- var jOnPrevFloor = j << floorShift[floor - 1];
- var elevatorOnPrevFloor = (floor - 1) << elevatorShift;
- var stateNext = (state & ~iOnFloor & ~jOnFloor & elevatorMask) | iOnPrevFloor | jOnPrevFloor | elevatorOnPrevFloor;
- if (stateNext.Valid())
- yield return stateNext;
- }
-
- if (floor < 3) {
- var iOnNextFloor = i << floorShift[floor + 1];
- var jOnNextFloor = j << floorShift[floor + 1];
- var elevatorOnNextFloor = (floor + 1) << elevatorShift;
- var stateNext = (state & ~iOnFloor & ~jOnFloor & elevatorMask) | iOnNextFloor | jOnNextFloor | elevatorOnNextFloor;
- if (stateNext.Valid())
- yield return stateNext;
- }
- }
- }
- }
- }
-
- public static bool Final(this ulong state) =>
- (state & 0b0000000000000000111111111111111111111111111111111111111111) == 0;
-
- public static string Tsto(this ulong state){
- var sb = new StringBuilder();
- for (int floor = 3; floor >= 0; floor --){
- var e = state.GetElevator() == (ulong)floor ? "E" : " ";
- var chips = state.GetChips((ulong)floor);
- var generators =state.GetGenerators((ulong)floor);
-
- sb.Append($"F{(floor + 1)} {e} |");
- for (int i = 0; i < elementCount;i++){
- sb.Append((generators & 1) == 1 ? " #" : " .");
- sb.Append((chips & 1) == 1 ? " #" : " .");
- sb.Append(" |");
- chips >>= 1;
- generators >>= 1;
- }
- sb.AppendLine();
- }
- return sb.ToString();
- }
-}
diff --git a/2016/Day11/input.in b/2016/Day11/input.in
deleted file mode 100644
index 70310eded..000000000
Binary files a/2016/Day11/input.in and /dev/null differ
diff --git a/2016/Day11/input.refout b/2016/Day11/input.refout
deleted file mode 100644
index 279830ba7..000000000
--- a/2016/Day11/input.refout
+++ /dev/null
@@ -1,2 +0,0 @@
-31
-55
diff --git a/2016/Day12/README.md b/2016/Day12/README.md
deleted file mode 100644
index 8783e7dc1..000000000
--- a/2016/Day12/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-## --- Day 12: Leonardo's Monorail ---
-You finally reach the top floor of this building: a garden with a slanted glass ceiling. Looks like there are no more stars to be had.
-
-While sitting on a nearby bench amidst some [tiger lilies](https://www.google.com/search?q=tiger+lilies&tbm=isch), you manage to decrypt some of the files you extracted from the servers downstairs.
-
-Read the [full puzzle](https://adventofcode.com/2016/day/12).
\ No newline at end of file
diff --git a/2016/Day12/Solution.cs b/2016/Day12/Solution.cs
deleted file mode 100644
index cd9d3bd65..000000000
--- a/2016/Day12/Solution.cs
+++ /dev/null
@@ -1,53 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-
-namespace AdventOfCode.Y2016.Day12;
-
-[ProblemName("Leonardo's Monorail")]
-class Solution : Solver {
-
- public object PartOne(string input) => Solve(input, 0);
-
- public object PartTwo(string input) => Solve(input, 1);
-
- int Solve(string input, int c) {
- var regs = new Dictionary();
- int ip = 0;
- int getReg(string reg) {
- return int.TryParse(reg, out var n) ? n
- : regs.ContainsKey(reg) ? regs[reg]
- : 0;
- }
- void setReg(string reg, int value) {
- regs[reg] = value;
- }
-
- setReg("c", c);
-
- var prog = input.Split('\n').ToArray();
- while (ip >= 0 && ip < prog.Length) {
- var line = prog[ip];
- var stm = line.Split(' ');
- switch (stm[0]) {
- case "cpy":
- setReg(stm[2], getReg(stm[1]));
- ip++;
- break;
- case "inc":
- setReg(stm[1], getReg(stm[1]) + 1);
- ip++;
- break;
- case "dec":
- setReg(stm[1], getReg(stm[1]) - 1);
- ip++;
- break;
- case "jnz":
- ip += getReg(stm[1]) != 0 ? getReg(stm[2]) : 1;
- break;
- default: throw new Exception("Cannot parse " + line);
- }
- }
- return getReg("a");
- }
-}
diff --git a/2016/Day12/input.in b/2016/Day12/input.in
deleted file mode 100644
index e4a51aade..000000000
Binary files a/2016/Day12/input.in and /dev/null differ
diff --git a/2016/Day12/input.refout b/2016/Day12/input.refout
deleted file mode 100644
index ffe4fb955..000000000
--- a/2016/Day12/input.refout
+++ /dev/null
@@ -1,2 +0,0 @@
-318003
-9227657
diff --git a/2016/Day13/README.md b/2016/Day13/README.md
deleted file mode 100644
index 37cfc68bf..000000000
--- a/2016/Day13/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-## --- Day 13: A Maze of Twisty Little Cubicles ---
-You arrive at the first floor of this new building to discover a much less welcoming environment than the shiny atrium of the last one. Instead, you are in a maze of twisty little cubicles, all alike.
-
-Every location in this area is addressed by a pair of non-negative integers (`x,y`). Each such coordinate is either a wall or an open space. You can't move diagonally. The cube maze starts at `0,0` and seems to extend infinitely toward *positive* `x` and `y`; negative values are *invalid*, as they represent a location outside the building. You are in a small waiting area at `1,1`.
-
-Read the [full puzzle](https://adventofcode.com/2016/day/13).
\ No newline at end of file
diff --git a/2016/Day13/Solution.cs b/2016/Day13/Solution.cs
deleted file mode 100644
index ea7682293..000000000
--- a/2016/Day13/Solution.cs
+++ /dev/null
@@ -1,51 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-
-namespace AdventOfCode.Y2016.Day13;
-
-[ProblemName("A Maze of Twisty Little Cubicles")]
-class Solution : Solver {
-
- public object PartOne(string input) =>
- Steps(int.Parse(input))
- .First(s => s.icol == 31 && s.irow == 39)
- .steps;
-
- public object PartTwo(string input) =>
- Steps(int.Parse(input))
- .TakeWhile(s => s.steps <= 50)
- .Count();
-
- IEnumerable<(int steps, int irow, int icol)> Steps(int input) {
- var q = new Queue<(int steps, int irow, int icol)>();
- q.Enqueue((0, 1, 1));
- var seen = new HashSet<(int, int)>();
- seen.Add((1, 1));
- var n = (
- from drow in new[] { -1, 0, 1 }
- from dcol in new[] { -1, 0, 1 }
- where Math.Abs(drow) + Math.Abs(dcol) == 1
- select (drow, dcol)
- ).ToArray();
-
- while (q.Any()) {
- var (steps, irow, icol) = q.Dequeue();
-
- yield return (steps, irow, icol);
-
- foreach (var (drow, dcol) in n) {
- var (irowT, icolT) = (irow + drow, icol + dcol);
- if (irowT >= 0 && icolT >= 0) {
- var w = icolT * icolT + 3 * icolT + 2 * icolT * irowT + irowT + irowT * irowT + input;
- if (Convert.ToString(w, 2).Count(ch => ch == '1') % 2 == 0) {
- if (!seen.Contains((irowT, icolT))) {
- q.Enqueue((steps + 1, irowT, icolT));
- seen.Add((irowT, icolT));
- }
- }
- }
- }
- }
- }
-}
diff --git a/2016/Day13/input.in b/2016/Day13/input.in
deleted file mode 100644
index c12c644c8..000000000
Binary files a/2016/Day13/input.in and /dev/null differ
diff --git a/2016/Day13/input.refout b/2016/Day13/input.refout
deleted file mode 100644
index 628a5115f..000000000
--- a/2016/Day13/input.refout
+++ /dev/null
@@ -1,2 +0,0 @@
-92
-124
diff --git a/2016/Day14/README.md b/2016/Day14/README.md
deleted file mode 100644
index 5d0c9057c..000000000
--- a/2016/Day14/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-## --- Day 14: One-Time Pad ---
-In order to communicate securely with Santa while you're on this mission, you've been using a [one-time pad](https://en.wikipedia.org/wiki/One-time_pad) that you [generate](https://en.wikipedia.org/wiki/Security_through_obscurity) using a pre-agreed algorithm. Unfortunately, you've run out of keys in your one-time pad, and so you need to generate some more.
-
-To generate keys, you first get a stream of random data by taking the [MD5](https://en.wikipedia.org/wiki/MD5) of a pre-arranged [salt](https://en.wikipedia.org/wiki/Salt_(cryptography)) (your puzzle input) and an increasing integer index (starting with `0`, and represented in decimal); the resulting MD5 hash should be represented as a string of *lowercase* hexadecimal digits.
-
-Read the [full puzzle](https://adventofcode.com/2016/day/14).
\ No newline at end of file
diff --git a/2016/Day14/Solution.cs b/2016/Day14/Solution.cs
deleted file mode 100644
index 18d77532f..000000000
--- a/2016/Day14/Solution.cs
+++ /dev/null
@@ -1,99 +0,0 @@
-using System;
-using System.Collections.Concurrent;
-using System.Collections.Generic;
-using System.Linq;
-using System.Security.Cryptography;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace AdventOfCode.Y2016.Day14;
-
-[ProblemName("One-Time Pad")]
-class Solution : Solver {
-
- public object PartOne(string input) => Solve(Hashes(input, 0));
- public object PartTwo(string input) => Solve(Hashes(input, 2016));
-
- int Solve(IEnumerable hashes) {
- var found = 0;
- var nextIdx = Enumerable.Range(0, 16).Select(_ => new Queue()).ToArray();
- var res = 0;
- var hashQueue = new Queue();
- var idx = 0;
- var idxEnd = 0;
- foreach (var hashEnd in hashes) {
-
- hashQueue.Enqueue(hashEnd);
-
- for (int i = 0; i < hashEnd.Length - 5; i++) {
- if (hashEnd[i] == hashEnd[i + 1] &&
- hashEnd[i + 1] == hashEnd[i + 2] &&
- hashEnd[i + 2] == hashEnd[i + 3] &&
- hashEnd[i + 3] == hashEnd[i + 4]
- ) {
- var c = hashEnd[i] <= '9' ? hashEnd[i] - '0' : hashEnd[i] - 'a' + 10;
- nextIdx[c].Enqueue(idxEnd);
- }
- }
- idxEnd++;
-
- if (hashQueue.Count() == 1001) {
- var hash = hashQueue.Dequeue();
- for (int i = 0; i < hash.Length - 2; i++) {
- if (hash[i] == hash[i + 1] && hash[i + 2] == hash[i + 1]) {
- var iq = hash[i] <= '9' ? hash[i] - '0' : hash[i] - 'a' + 10;
- var q = nextIdx[iq];
- while (q.Any() && q.First() <= idx) {
- q.Dequeue();
- }
- if (q.Any() && q.First() - idx <= 1000) {
- found++;
- res = idx;
- if (found == 64) {
- return res;
- }
- }
- break;
- }
- }
- idx++;
- }
- }
-
- throw new Exception();
- }
-
- public IEnumerable Hashes(string input, int rehash) {
-
- for (var i = 0; i < int.MaxValue; i++) {
- var q = new ConcurrentQueue<(int i, string hash)>();
-
- Parallel.ForEach(
- Enumerable.Range(i, 1000),
- () => MD5.Create(),
- (i, state, md5) => {
- var newInput = new byte[32];
- var btoh = new[] { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' };
-
- var hash = md5.ComputeHash(Encoding.ASCII.GetBytes(input + i));
-
- for (var r = 0; r < rehash; r++) {
- for (int ib = 0; ib < 16; ib++) {
- newInput[2 * ib] = (byte)btoh[(hash[ib] >> 4) & 15];
- newInput[2 * ib + 1] = (byte)btoh[hash[ib] & 15];
- }
- hash = md5.ComputeHash(newInput);
- }
-
- q.Enqueue((i, string.Join("", hash.Select(b => b.ToString("x2")))));
- return md5;
- },
- (_) => { }
- );
- foreach (var item in q.OrderBy(x => x.i)) {
- i = item.i;
- yield return item.hash;
- }
- }
- }
-}
diff --git a/2016/Day14/input.in b/2016/Day14/input.in
deleted file mode 100644
index fa1a5b352..000000000
Binary files a/2016/Day14/input.in and /dev/null differ
diff --git a/2016/Day14/input.refout b/2016/Day14/input.refout
deleted file mode 100644
index 0a3027bae..000000000
--- a/2016/Day14/input.refout
+++ /dev/null
@@ -1,2 +0,0 @@
-18626
-20092
diff --git a/2016/Day15/README.md b/2016/Day15/README.md
deleted file mode 100644
index e0930ef41..000000000
--- a/2016/Day15/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-## --- Day 15: Timing is Everything ---
-The halls open into an interior plaza containing a large kinetic sculpture. The sculpture is in a sealed enclosure and seems to involve a set of identical spherical capsules that are carried to the top and allowed to [bounce through the maze](https://youtu.be/IxDoO9oODOk?t=177) of spinning pieces.
-
-Part of the sculpture is even interactive! When a button is pressed, a capsule is dropped and tries to fall through slots in a set of rotating discs to finally go through a little hole at the bottom and come out of the sculpture. If any of the slots aren't aligned with the capsule as it passes, the capsule bounces off the disc and soars away. You feel compelled to get one of those capsules.
-
-Read the [full puzzle](https://adventofcode.com/2016/day/15).
\ No newline at end of file
diff --git a/2016/Day15/Solution.cs b/2016/Day15/Solution.cs
deleted file mode 100644
index f8621d485..000000000
--- a/2016/Day15/Solution.cs
+++ /dev/null
@@ -1,27 +0,0 @@
-using System.Collections.Generic;
-using System.Linq;
-using System.Text.RegularExpressions;
-
-namespace AdventOfCode.Y2016.Day15;
-
-[ProblemName("Timing is Everything")]
-class Solution : Solver {
-
- public object PartOne(string input) => Iterate(Parse(input)).First(v => v.ok).t;
-
- public object PartTwo(string input) => Iterate(Parse(input).Concat(new []{(pos: 0, mod: 11)}).ToArray()).First(v => v.ok).t;
-
- (int pos, int mod)[] Parse(string input) => (
- from line in input.Split('\n')
- let m = Regex.Match(line, @"Disc #\d has (\d+) positions; at time=0, it is at position (\d+).")
- select (pos: int.Parse(m.Groups[2].Value), mod: int.Parse(m.Groups[1].Value))
- ).ToArray();
-
- IEnumerable<(int t, bool ok)> Iterate((int pos, int mod)[] discs) {
- for (int t = 0; ; t++) {
- var ok = Enumerable.Range(0, discs.Length)
- .All(i => (discs[i].pos + t + i + 1) % discs[i].mod == 0);
- yield return (t, ok);
- }
- }
-}
diff --git a/2016/Day15/input.in b/2016/Day15/input.in
deleted file mode 100644
index d98a91e50..000000000
Binary files a/2016/Day15/input.in and /dev/null differ
diff --git a/2016/Day15/input.refout b/2016/Day15/input.refout
deleted file mode 100644
index 5016a01fd..000000000
--- a/2016/Day15/input.refout
+++ /dev/null
@@ -1,2 +0,0 @@
-317371
-2080951
\ No newline at end of file
diff --git a/2016/Day16/README.md b/2016/Day16/README.md
deleted file mode 100644
index e5a6546ce..000000000
--- a/2016/Day16/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-## --- Day 16: Dragon Checksum ---
-You're done scanning this part of the network, but you've left traces of your presence. You need to overwrite some disks with random-looking data to cover your tracks and update the local security system with a new checksum for those disks.
-
-For the data to not be suspicious, it needs to have certain properties; purely random data will be detected as tampering. To generate appropriate random data, you'll need to use a modified [dragon curve](https://en.wikipedia.org/wiki/Dragon_curve).
-
-Read the [full puzzle](https://adventofcode.com/2016/day/16).
\ No newline at end of file
diff --git a/2016/Day16/Solution.cs b/2016/Day16/Solution.cs
deleted file mode 100644
index 8075b29e9..000000000
--- a/2016/Day16/Solution.cs
+++ /dev/null
@@ -1,32 +0,0 @@
-using System.Linq;
-using System.Text;
-
-namespace AdventOfCode.Y2016.Day16;
-
-[ProblemName("Dragon Checksum")]
-class Solution : Solver {
-
- public object PartOne(string input) => Checksum(input, 272);
-
- public object PartTwo(string input) => Checksum(input, 35651584);
-
- string Checksum(string st, int length) {
-
- while (st.Length < length) {
- var a = st;
- var b = string.Join("", from ch in a.Reverse() select ch == '0' ? '1' : '0');
- st = a + "0" + b;
- }
- st = st.Substring(0, length);
- var sb = new StringBuilder();
-
- while (sb.Length % 2 == 0) {
- sb.Clear();
- for (int i = 0; i < st.Length; i += 2) {
- sb.Append(st[i] == st[i + 1] ? "1" : "0");
- }
- st = sb.ToString();
- }
- return st;
- }
-}
diff --git a/2016/Day16/input.in b/2016/Day16/input.in
deleted file mode 100644
index 6d0d69381..000000000
Binary files a/2016/Day16/input.in and /dev/null differ
diff --git a/2016/Day16/input.refout b/2016/Day16/input.refout
deleted file mode 100644
index ed762602f..000000000
--- a/2016/Day16/input.refout
+++ /dev/null
@@ -1,2 +0,0 @@
-10011010010010010
-10101011110100011
diff --git a/2016/Day17/README.md b/2016/Day17/README.md
deleted file mode 100644
index 7cc530e50..000000000
--- a/2016/Day17/README.md
+++ /dev/null
@@ -1,16 +0,0 @@
-## --- Day 17: Two Steps Forward ---
-You're trying to access a secure vault protected by a `4x4` grid of small rooms connected by doors. You start in the top-left room (marked `S`), and you can access the vault (marked `V`) once you reach the bottom-right room:
-
-```
-#########
-#S| | | #
-#-#-#-#-#
-# | | | #
-#-#-#-#-#
-# | | | #
-#-#-#-#-#
-# | | |
-####### V
-```
-
-Read the [full puzzle](https://adventofcode.com/2016/day/17).
\ No newline at end of file
diff --git a/2016/Day17/Solution.cs b/2016/Day17/Solution.cs
deleted file mode 100644
index 7689db5ce..000000000
--- a/2016/Day17/Solution.cs
+++ /dev/null
@@ -1,50 +0,0 @@
-using System.Collections.Generic;
-using System.Linq;
-using System.Security.Cryptography;
-using System.Text;
-
-namespace AdventOfCode.Y2016.Day17;
-
-[ProblemName("Two Steps Forward")]
-class Solution : Solver {
-
- public object PartOne(string input) => Routes(input).First();
-
- public object PartTwo(string input) => Routes(input).Last().Length;
-
- IEnumerable Routes(string input) {
-
- var q = new Queue<(string path, int irow, int icol)>();
- q.Enqueue(("", 0, 0));
-
- while (q.Any()) {
- var s = q.Dequeue();
-
- if (s.icol == 3 && s.irow == 3) {
- yield return s.path;
- } else {
- var doors = DoorState(input + s.path);
-
- if (doors.down && s.irow < 3) {
- q.Enqueue((s.path + "D", s.irow + 1, s.icol));
- }
- if (doors.up && s.irow > 0) {
- q.Enqueue((s.path + "U", s.irow - 1, s.icol));
- }
- if (doors.left && s.icol > 0) {
- q.Enqueue((s.path + "L", s.irow, s.icol - 1));
- }
- if (doors.right && s.icol < 3) {
- q.Enqueue((s.path + "R", s.irow, s.icol + 1));
- }
- }
- }
- }
-
- (bool up, bool down, bool left, bool right) DoorState(string st) {
- var md5 = MD5.Create();
- var hash = md5.ComputeHash(Encoding.ASCII.GetBytes(st));
- var stHash = string.Join("", hash.Select(b => b.ToString("x2")));
- return (stHash[0] > 'a', stHash[1] > 'a', stHash[2] > 'a', stHash[3] > 'a');
- }
-}
diff --git a/2016/Day17/input.in b/2016/Day17/input.in
deleted file mode 100644
index a868569aa..000000000
Binary files a/2016/Day17/input.in and /dev/null differ
diff --git a/2016/Day17/input.refout b/2016/Day17/input.refout
deleted file mode 100644
index 38a82a4e3..000000000
--- a/2016/Day17/input.refout
+++ /dev/null
@@ -1,2 +0,0 @@
-DDRRUDLRRD
-488
diff --git a/2016/Day18/README.md b/2016/Day18/README.md
deleted file mode 100644
index aa4737079..000000000
--- a/2016/Day18/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-## --- Day 18: Like a Rogue ---
-As you enter this room, you hear a loud click! Some of the tiles in the floor here seem to be pressure plates for [traps](https://nethackwiki.com/wiki/Trap), and the trap you just triggered has run out of... whatever it tried to do to you. You doubt you'll be so lucky next time.
-
-Upon closer examination, the traps and safe tiles in this room seem to follow a pattern. The tiles are arranged into rows that are all the same width; you take note of the safe tiles (`.`) and traps (`^`) in the first row (your puzzle input).
-
-Read the [full puzzle](https://adventofcode.com/2016/day/18).
\ No newline at end of file
diff --git a/2016/Day18/Solution.cs b/2016/Day18/Solution.cs
deleted file mode 100644
index 4ceb5b27c..000000000
--- a/2016/Day18/Solution.cs
+++ /dev/null
@@ -1,37 +0,0 @@
-using System.Linq;
-using System.Text;
-
-namespace AdventOfCode.Y2016.Day18;
-
-[ProblemName("Like a Rogue")]
-class Solution : Solver {
-
- public object PartOne(string input) => SafeCount(input, 40);
-
- public object PartTwo(string input) => SafeCount(input, 400000);
-
- int SafeCount(string input, int lines) {
- var rowPrev = input;
- var safeCount = rowPrev.Count(ch => ch == '.');
- for (int i = 0; i < lines - 1; i++) {
- StringBuilder sb = new StringBuilder();
- for (int j = 0; j < rowPrev.Length; j++) {
- var leftTrap = j != 0 && rowPrev[j - 1] == '^';
- var centerTrap = rowPrev[j] == '^';
- var rightTrap = j != rowPrev.Length - 1 && rowPrev[j + 1] == '^';
-
- var trap =
- (leftTrap && centerTrap && !rightTrap) ||
- (!leftTrap && centerTrap && rightTrap) ||
- (leftTrap && !centerTrap && !rightTrap) ||
- (!leftTrap && !centerTrap && rightTrap)
- ;
- sb.Append(trap ? '^' : '.');
- }
- rowPrev = sb.ToString();
- safeCount += rowPrev.Count(ch => ch == '.');
- }
-
- return safeCount;
- }
-}
diff --git a/2016/Day18/input.in b/2016/Day18/input.in
deleted file mode 100644
index ca1d62f7f..000000000
Binary files a/2016/Day18/input.in and /dev/null differ
diff --git a/2016/Day18/input.refout b/2016/Day18/input.refout
deleted file mode 100644
index 7f6ad48ba..000000000
--- a/2016/Day18/input.refout
+++ /dev/null
@@ -1,2 +0,0 @@
-1939
-19999535
diff --git a/2016/Day19/README.md b/2016/Day19/README.md
deleted file mode 100644
index 5bfdef034..000000000
--- a/2016/Day19/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-## --- Day 19: An Elephant Named Joseph ---
-The Elves contact you over a highly secure emergency channel. Back at the North Pole, the Elves are busy misunderstanding [White Elephant parties](https://en.wikipedia.org/wiki/White_elephant_gift_exchange).
-
-Each Elf brings a present. They all sit in a circle, numbered starting with position `1`. Then, starting with the first Elf, they take turns stealing all the presents from the Elf to their left. An Elf with no presents is removed from the circle and does not take turns.
-
-Read the [full puzzle](https://adventofcode.com/2016/day/19).
\ No newline at end of file
diff --git a/2016/Day19/Solution.cs b/2016/Day19/Solution.cs
deleted file mode 100644
index 8d1d61064..000000000
--- a/2016/Day19/Solution.cs
+++ /dev/null
@@ -1,46 +0,0 @@
-using System;
-using System.Linq;
-
-namespace AdventOfCode.Y2016.Day19;
-
-[ProblemName("An Elephant Named Joseph")]
-class Solution : Solver {
-
- public object PartOne(string input) {
- var elves = Elves(int.Parse(input));
- return Solve(elves[0], elves[1], elves.Length,
- (elfVictim, count) => elfVictim.next.next);
- }
-
- public object PartTwo(string input) {
- var elves = Elves(int.Parse(input));
- return Solve(elves[0], elves[elves.Length / 2], elves.Length,
- (elfVictim, count) => count % 2 == 1 ? elfVictim.next : elfVictim.next.next);
- }
-
- int Solve(Elf elf, Elf elfVictim, int elfCount, Func nextVictim) {
- while (elfCount > 1) {
- elfVictim.prev.next = elfVictim.next;
- elfVictim.next.prev = elfVictim.prev;
- elf = elf.next;
- elfCount--;
- elfVictim = nextVictim(elfVictim, elfCount);
- }
- return elf.id;
- }
-
- Elf[] Elves(int count) {
- var elves = Enumerable.Range(0, count).Select(x => new Elf { id = x + 1 }).ToArray();
- for (var i = 0; i < count; i++) {
- elves[i].prev = elves[(i - 1 + count) % count];
- elves[i].next = elves[(i + 1) % count];
- }
- return elves;
- }
-
- class Elf {
- public int id;
- public Elf prev;
- public Elf next;
- }
-}
diff --git a/2016/Day19/input.in b/2016/Day19/input.in
deleted file mode 100644
index e1bea95a1..000000000
Binary files a/2016/Day19/input.in and /dev/null differ
diff --git a/2016/Day19/input.refout b/2016/Day19/input.refout
deleted file mode 100644
index 6379a451c..000000000
--- a/2016/Day19/input.refout
+++ /dev/null
@@ -1,2 +0,0 @@
-1834471
-1420064
diff --git a/2016/Day20/README.md b/2016/Day20/README.md
deleted file mode 100644
index f91a56fec..000000000
--- a/2016/Day20/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-## --- Day 20: Firewall Rules ---
-You'd like to set up a small hidden computer here so you can use it to get back into the network later. However, the corporate firewall only allows communication with certain external [IP addresses](https://en.wikipedia.org/wiki/IPv4#Addressing).
-
-You've retrieved the list of blocked IPs from the firewall, but the list seems to be messy and poorly maintained, and it's not clear which IPs are allowed. Also, rather than being written in [dot-decimal](https://en.wikipedia.org/wiki/Dot-decimal_notation) notation, they are written as plain [32-bit integers](https://en.wikipedia.org/wiki/32-bit), which can have any value from `0` through `4294967295`, inclusive.
-
-Read the [full puzzle](https://adventofcode.com/2016/day/20).
\ No newline at end of file
diff --git a/2016/Day20/Solution.cs b/2016/Day20/Solution.cs
deleted file mode 100644
index 771e31b35..000000000
--- a/2016/Day20/Solution.cs
+++ /dev/null
@@ -1,48 +0,0 @@
-using System.Collections.Generic;
-using System.Linq;
-
-namespace AdventOfCode.Y2016.Day20;
-
-[ProblemName("Firewall Rules")]
-class Solution : Solver {
-
- public object PartOne(string input) {
- var k = 0L;
- foreach (var range in Parse(input)) {
- if (k < range.min) {
- break;
- } else if (range.min <= k && k <= range.max) {
- k = range.max + 1;
- }
- }
- return k;
- }
-
- public object PartTwo(string input) {
- var k = 0L;
- var sum = 0L;
- foreach (var range in Parse(input)) {
- if (k < range.min) {
- sum += range.min - k;
- k = range.max + 1;
- } else if (range.min <= k && k <= range.max) {
- k = range.max + 1;
- }
- }
-
- var lim = 4294967296L;
- if (lim > k) {
- sum += lim - k;
- }
- return sum;
- }
-
- IEnumerable<(long min, long max)> Parse(string input) => (
- from line in input.Split('\n')
- let parts = line.Split('-')
- let min = long.Parse(parts[0])
- let max = long.Parse(parts[1])
- orderby min
- select (min, max)
- ).AsEnumerable();
-}
diff --git a/2016/Day20/input.in b/2016/Day20/input.in
deleted file mode 100644
index 06143dbaf..000000000
Binary files a/2016/Day20/input.in and /dev/null differ
diff --git a/2016/Day20/input.refout b/2016/Day20/input.refout
deleted file mode 100644
index a32c75872..000000000
--- a/2016/Day20/input.refout
+++ /dev/null
@@ -1,2 +0,0 @@
-19449262
-119
diff --git a/2016/Day21/README.md b/2016/Day21/README.md
deleted file mode 100644
index a38e2892c..000000000
--- a/2016/Day21/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-## --- Day 21: Scrambled Letters and Hash ---
-The computer system you're breaking into uses a weird scrambling function to store its passwords. It shouldn't be much trouble to create your own scrambled password so you can add it to the system; you just have to implement the scrambler.
-
-The scrambling function is a series of operations (the exact list is provided in your puzzle input). Starting with the password to be scrambled, apply each operation in succession to the string. The individual operations behave as follows:
-
-Read the [full puzzle](https://adventofcode.com/2016/day/21).
\ No newline at end of file
diff --git a/2016/Day21/Solution.cs b/2016/Day21/Solution.cs
deleted file mode 100644
index 6f684362b..000000000
--- a/2016/Day21/Solution.cs
+++ /dev/null
@@ -1,140 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text.RegularExpressions;
-
-namespace AdventOfCode.Y2016.Day21;
-
-[ProblemName("Scrambled Letters and Hash")]
-class Solution : Solver {
-
- public object PartOne(string input) => string.Join("", Parse(input)("abcdefgh"));
-
- public object PartTwo(string input) {
- var scramble = Parse(input);
- return string.Join("", Permutations("abcdefgh".ToArray()).First(p => scramble(p).SequenceEqual("fbgdceah")));
- }
-
- IEnumerable Permutations(T[] rgt) {
-
- IEnumerable PermutationsRec(int i) {
- if (i == rgt.Length) {
- yield return rgt.ToArray();
- }
-
- for (var j = i; j < rgt.Length; j++) {
- (rgt[i], rgt[j]) = (rgt[j], rgt[i]);
- foreach (var perm in PermutationsRec(i + 1)) {
- yield return perm;
- }
- (rgt[i], rgt[j]) = (rgt[j], rgt[i]);
- }
- }
-
- return PermutationsRec(0);
- }
-
- Func, IEnumerable> Parse(string input) {
- var steps = (
- from line in input.Split('\n')
- select
- Match(line, @"swap position (\d+) with position (\d+)", m => {
- var x = int.Parse(m[0]);
- var y = int.Parse(m[1]);
- return chars => SwapPosition(chars, x, y);
- }) ??
- Match(line, @"swap letter (\w) with letter (\w)", m => {
- var chX = m[0][0];
- var chY = m[1][0];
- return (chars) => SwapLetter(chars, chX, chY);
- }) ??
- Match(line, @"rotate left (\d+) step", m => {
- var x = int.Parse(m[0]);
- return chars => RotateLeft(chars, x);
- }) ??
- Match(line, @"rotate right (\d+) step", m => {
- var x = int.Parse(m[0]);
- return chars => RotateRight(chars, x);
- }) ??
- Match(line, @"rotate based on position of letter (\w)", m => {
- var chX = m[0][0];
- return chars => RotateBasedOnPosition(chars, chX);
- }) ??
- Match(line, @"reverse positions (\d+) through (\d+)", m => {
- var x = int.Parse(m[0]);
- var y = int.Parse(m[1]);
- return chars => Reverse(chars, x, y);
- }) ??
- Match(line, @"move position (\d+) to position (\d+)", m => {
- var x = int.Parse(m[0]);
- var y = int.Parse(m[1]);
- return chars => MovePosition(chars, x, y);
- }) ??
- throw new Exception("Cannot parse " + line)
- ).ToArray();
-
- return chars => {
- var charsArray = chars.ToArray();
- foreach (var step in steps) {
- step(charsArray);
- }
- return charsArray;
- };
- }
-
- Action Match(string stm, string pattern, Func> a) {
- var match = Regex.Match(stm, pattern);
- if (match.Success) {
- return a(match.Groups.Cast().Skip(1).Select(g => g.Value).ToArray());
- } else {
- return null;
- }
- }
-
- void SwapPosition(char[] chars, int x, int y) {
- (chars[x], chars[y]) = (chars[y], chars[x]);
- }
-
- void SwapLetter(char[] chars, char chX, char chY) {
- for (var i = 0; i < chars.Length; i++) {
- chars[i] = chars[i] == chX ? chY : chars[i] == chY ? chX : chars[i];
- }
- }
-
- void RotateBasedOnPosition(char[] chars, char chX) {
- var i = Array.IndexOf(chars, chX);
- RotateRight(chars, i >= 4 ? i + 2 : i + 1);
- }
-
- void RotateLeft(char[] chars, int t) {
- t %= chars.Length;
- Reverse(chars, 0, t - 1);
- Reverse(chars, t, chars.Length - 1);
- Reverse(chars, 0, chars.Length - 1);
- }
-
- void RotateRight(char[] chars, int t) {
- t %= chars.Length;
- Reverse(chars, 0, chars.Length - 1);
- Reverse(chars, 0, t - 1);
- Reverse(chars, t, chars.Length - 1);
- }
-
- void Reverse(char[] chars, int x, int y) {
- while (x < y) {
- (chars[x], chars[y]) = (chars[y], chars[x]);
- x++;
- y--;
- }
- }
-
- void MovePosition(char[] chars, int x, int y) {
- var d = x < y ? 1 : -1;
-
- var ch = chars[x];
- for (int i = x + d; i != y + d; i += d) {
- chars[i - d] = chars[i];
- }
- chars[y] = ch;
- }
-}
diff --git a/2016/Day21/input.in b/2016/Day21/input.in
deleted file mode 100644
index 859177f85..000000000
Binary files a/2016/Day21/input.in and /dev/null differ
diff --git a/2016/Day21/input.refout b/2016/Day21/input.refout
deleted file mode 100644
index cd57f7075..000000000
--- a/2016/Day21/input.refout
+++ /dev/null
@@ -1,2 +0,0 @@
-ghfacdbe
-fhgcdaeb
diff --git a/2016/Day22/README.md b/2016/Day22/README.md
deleted file mode 100644
index 152ace850..000000000
--- a/2016/Day22/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-## --- Day 22: Grid Computing ---
-You gain access to a massive storage cluster arranged in a grid; each storage node is only connected to the four nodes directly adjacent to it (three if the node is on an edge, two if it's in a corner).
-
-You can directly access data *only* on node `/dev/grid/node-x0-y0`, but you can perform some limited actions on the other nodes:
-
-Read the [full puzzle](https://adventofcode.com/2016/day/22).
\ No newline at end of file
diff --git a/2016/Day22/Solution.cs b/2016/Day22/Solution.cs
deleted file mode 100644
index d36b5e5c9..000000000
--- a/2016/Day22/Solution.cs
+++ /dev/null
@@ -1,140 +0,0 @@
-using System;
-using System.Linq;
-using System.Text;
-using System.Text.RegularExpressions;
-
-namespace AdventOfCode.Y2016.Day22;
-
-[ProblemName("Grid Computing")]
-class Solution : Solver {
-
- public object PartOne(string input) {
- var nodes = Parse(input);
- var r = 0;
- foreach (var nodeA in nodes) {
- if (nodeA.used > 0) {
- foreach (var nodeB in nodes) {
- if ((nodeA.irow != nodeB.irow || nodeA.icol != nodeB.icol) && nodeB.avail > nodeA.used) {
- r++;
- }
- }
- }
- }
- return r;
- }
-
- public object PartTwo(string input) {
- var nodes = Parse(input);
- var grid = new Grid(nodes);
-
- while(grid.irowEmpty != 0){
- if (!grid.Wall(grid.irowEmpty - 1, grid.icolEmpty)) {
- grid.Move(-1, 0);
- } else {
- grid.Move(0, -1);
- }
- }
- while (grid.icolEmpty != grid.ccol -1) {
- grid.Move(0, 1);
- }
- while(!nodes[0,0].goal) {
- grid.Move(1, 0);
- grid.Move(0, -1);
- grid.Move(0, -1);
- grid.Move(-1, 0);
- grid.Move(0, 1);
- }
- return grid.moves;
- }
-
- Node[,] Parse(string input) {
- var nodes = (
- from line in input.Split('\n').Skip(2)
- let parts = Regex.Matches(line, @"(\d+)").Select(m => int.Parse(m.Groups[1].Value)).ToArray()
- select new Node { irow = parts[1], icol = parts[0], size = parts[2], used = parts[3] }
- ).ToArray();
-
- var (crow, ccol) = (nodes.Select(x => x.irow).Max() + 1, nodes.Select(x => x.icol).Max() + 1);
- var res = new Node[crow, ccol];
- foreach (var file in nodes) {
- res[file.irow, file.icol] = file;
- }
- res[0, ccol - 1].goal = true;
- return res;
- }
-
- class Grid {
- public int irowEmpty;
- public int icolEmpty;
- public Node[,] nodes;
- public int moves;
-
- public Grid(Node[,] nodes){
- this.nodes = nodes;
- foreach(var node in nodes){
- if(node.used == 0){
- irowEmpty = node.irow;
- icolEmpty = node.icol;
- break;
- }
- }
- }
-
- public int crow { get { return nodes.GetLength(0); } }
- public int ccol { get { return nodes.GetLength(1); } }
-
- public void Tsto() {
- var sb = new StringBuilder();
- sb.AppendLine();
- for (var irowT = 0; irowT < crow; irowT++) {
- for (var icolT = 0; icolT < ccol; icolT++) {
- if (nodes[irowT, icolT].goal) {
- sb.Append("G");
- } else if (irowT == 0 && icolT == 0) {
- sb.Append("x");
- } else if (nodes[irowT, icolT].used == 0) {
- sb.Append("E");
- } else if (Wall(irowT, icolT)) {
- sb.Append("#");
- } else {
- sb.Append(".");
- }
- }
- sb.AppendLine();
- }
- Console.WriteLine(sb.ToString());
- }
-
- public bool Wall(int irow, int icol) =>
- nodes[irow, icol].used > nodes[irowEmpty, icolEmpty].size;
-
- public void Move(int drow, int dcol) {
- if (Math.Abs(drow) + Math.Abs(dcol) != 1) throw new Exception();
-
- var irowT = irowEmpty + drow;
- var icolT = icolEmpty + dcol;
-
- if (irowT < 0 || irowT >= crow) throw new Exception();
- if (icolT < 0 || icolT >= ccol) throw new Exception();
- if (nodes[irowT, icolT].used > nodes[irowEmpty, icolEmpty].avail) throw new Exception();
-
- nodes[irowEmpty, icolEmpty].used = nodes[irowT, icolT].used;
- nodes[irowEmpty, icolEmpty].goal = nodes[irowT, icolT].goal;
-
- (irowEmpty, icolEmpty) = (irowT, icolT);
- nodes[irowEmpty, icolEmpty].used = 0;
- nodes[irowEmpty, icolEmpty].goal = false;
-
- moves++;
- }
- }
-
- class Node {
- public bool goal = false;
- public int irow;
- public int icol;
- public int size;
- public int used;
- public int avail { get { return size - used; } }
- }
-}
diff --git a/2016/Day22/input.in b/2016/Day22/input.in
deleted file mode 100644
index 1c0570dda..000000000
Binary files a/2016/Day22/input.in and /dev/null differ
diff --git a/2016/Day22/input.refout b/2016/Day22/input.refout
deleted file mode 100644
index d5bea675e..000000000
--- a/2016/Day22/input.refout
+++ /dev/null
@@ -1,2 +0,0 @@
-1007
-242
diff --git a/2016/Day23/README.md b/2016/Day23/README.md
deleted file mode 100644
index 6312da7fa..000000000
--- a/2016/Day23/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-## --- Day 23: Safe Cracking ---
-This is one of the top floors of the nicest tower in EBHQ. The Easter Bunny's private office is here, complete with a safe hidden behind a painting, and who *wouldn't* hide a star in a safe behind a painting?
-
-The safe has a digital screen and keypad for code entry. A sticky note attached to the safe has a password hint on it: "eggs". The painting is of a large rabbit coloring some eggs. You see `7`.
-
-Read the [full puzzle](https://adventofcode.com/2016/day/23).
\ No newline at end of file
diff --git a/2016/Day23/Solution.cs b/2016/Day23/Solution.cs
deleted file mode 100644
index 6b6a6b200..000000000
--- a/2016/Day23/Solution.cs
+++ /dev/null
@@ -1,85 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-
-namespace AdventOfCode.Y2016.Day23;
-
-[ProblemName("Safe Cracking")]
-class Solution : Solver {
-
- public object PartOne(string input) => Solve(input, 7);
- public object PartTwo(string input) => Solve(input, 12);
-
- int Solve(string input, int a) {
- var prg = Parse(Patch(input));
- var regs = new Dictionary();
- var ip = 0;
- int getReg(string reg) {
- return int.TryParse(reg, out var n) ? n
- : regs.ContainsKey(reg) ? regs[reg]
- : 0;
- }
- void setReg(string reg, int value) {
- if (!int.TryParse(reg, out var _)) {
- regs[reg] = value;
- }
- }
-
- setReg("a", a);
-
- while(ip < prg.Length){
- var stm = prg[ip];
- switch (stm[0]) {
- case "cpy":
- setReg(stm[2], getReg(stm[1]));
- ip++;
- break;
- case "inc":
- setReg(stm[1], getReg(stm[1]) + 1);
- ip++;
- break;
- case "mul":
- setReg(stm[2], getReg(stm[1]) * getReg(stm[2]));
- ip++;
- break;
- case "dec":
- setReg(stm[1], getReg(stm[1]) - 1);
- ip++;
- break;
- case "jnz":
- ip += getReg(stm[1]) != 0 ? getReg(stm[2]) : 1;
- break;
- case "tgl":
- var ipDst = ip + getReg(stm[1]);
- if (ipDst >= 0 && ipDst < prg.Length) {
- var stmDst = prg[ipDst];
- stmDst[0] = stmDst[0] switch {
- "cpy" => "jnz",
- "inc" => "dec",
- "dec" => "inc",
- "jnz" => "cpy",
- "tgl" => "inc",
- _ => stmDst[0]
- };
- }
- ip++;
- break;
- default:
- throw new Exception("Cannot parse " + string.Join(" ", stm));
- }
- }
- return getReg("a");
- }
-
- string Patch(string input) {
- var lines = input.Split('\n');
- lines[5] = "cpy c a";
- lines[6] = "mul d a";
- lines[7] = "cpy 0 d";
- lines[8] = "cpy 0 c";
- return string.Join("\n", lines);
- }
-
- string[][] Parse(string input) =>
- input.Split('\n').Select(line => line.Split(' ')).ToArray();
-}
diff --git a/2016/Day23/input.in b/2016/Day23/input.in
deleted file mode 100644
index ea5304016..000000000
Binary files a/2016/Day23/input.in and /dev/null differ
diff --git a/2016/Day23/input.refout b/2016/Day23/input.refout
deleted file mode 100644
index 06c80095a..000000000
--- a/2016/Day23/input.refout
+++ /dev/null
@@ -1,2 +0,0 @@
-10223
-479006783
diff --git a/2016/Day24/README.md b/2016/Day24/README.md
deleted file mode 100644
index ca42bf3f9..000000000
--- a/2016/Day24/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-## --- Day 24: Air Duct Spelunking ---
-You've finally met your match; the doors that provide access to the roof are locked tight, and all of the controls and related electronics are inaccessible. You simply can't reach them.
-
-The robot that cleans the air ducts, however, *can*.
-
-Read the [full puzzle](https://adventofcode.com/2016/day/24).
\ No newline at end of file
diff --git a/2016/Day24/Solution.cs b/2016/Day24/Solution.cs
deleted file mode 100644
index daa435049..000000000
--- a/2016/Day24/Solution.cs
+++ /dev/null
@@ -1,105 +0,0 @@
-using System.Collections.Generic;
-using System.Linq;
-
-namespace AdventOfCode.Y2016.Day24;
-
-[ProblemName("Air Duct Spelunking")]
-class Solution : Solver {
-
- public object PartOne(string input) => Routes(input, false).Min();
-
- public object PartTwo(string input) => Routes(input, true).Min();
-
- IEnumerable Routes(string input, bool loop) {
- var map = new Map(input);
-
- foreach (var perm in Permutations(Enumerable.Range(1, map.poi.Length - 1).ToArray())) {
-
- perm.Insert(0, 0);
- if (loop) {
- perm.Add(0);
- }
- var l = 0;
- for (int i = 0; i < perm.Count - 1; i++) {
- l += map.ShortestPathLength(map.poi[perm[i]], map.poi[perm[i + 1]]);
- }
- yield return l;
- }
- }
-
- IEnumerable> Permutations(T[] rgt) {
-
- IEnumerable> PermutationsRec(int i) {
- if (i == rgt.Length) {
- yield return rgt.ToList();
- }
-
- for (var j = i; j < rgt.Length; j++) {
- (rgt[i], rgt[j]) = (rgt[j], rgt[i]);
- foreach (var perm in PermutationsRec(i + 1)) {
- yield return perm;
- }
- (rgt[i], rgt[j]) = (rgt[j], rgt[i]);
- }
- }
-
- return PermutationsRec(0);
- }
-
- class Map {
-
- string[] map;
- public int crow;
- public int ccol;
- public (int irow, int icol)[] poi;
- private Dictionary<(int, int, int, int), int> cache = new Dictionary<(int, int, int, int), int>();
-
- public Map(string input) {
- this.map = input.Split('\n');
- this.crow = map.Length;
- this.ccol = map[0].Length;
-
- poi = new(int irow, int icol)[10];
- var poiCount = 0;
- for (var irow = 0; irow < crow; irow++) {
- for (var icol = 0; icol < ccol; icol++) {
- if (int.TryParse($"{map[irow][icol]}", out var i)) {
- poi[i] = (irow, icol);
- poiCount++;
- }
- }
- }
- poi = poi.Take(poiCount).ToArray();
- }
-
- public int ShortestPathLength((int irow, int icol) from, (int irow, int icol) to) {
- var key = (from.irow, from.icol, to.irow, to.icol);
- if (!cache.ContainsKey(key)) {
- var q = new Queue<(int steps, int irow, int icol)>();
- q.Enqueue((0, from.irow, from.icol));
- var seen = new HashSet<(int, int)>();
- seen.Add(from);
- while (q.Any()) {
- var p = q.Dequeue();
- if (p.irow == to.irow && p.icol == to.icol) {
- cache[key] = p.steps;
- break;
- }
- foreach (var (drow, dcol) in new[] { (-1, 0), (1, 0), (0, 1), (0, -1) }) {
- var (irowT, icolT) = (p.irow + drow, p.icol + dcol);
- if (irowT >= 0 && irowT < crow &&
- icolT >= 0 && icolT < ccol &&
- map[irowT][icolT] != '#' &&
- !seen.Contains((irowT, icolT))
- ) {
- q.Enqueue((p.steps + 1, irowT, icolT));
- seen.Add((irowT, icolT));
- }
- }
- }
- }
-
- return cache[key];
- }
- }
-}
diff --git a/2016/Day24/input.in b/2016/Day24/input.in
deleted file mode 100644
index 5051464fd..000000000
Binary files a/2016/Day24/input.in and /dev/null differ
diff --git a/2016/Day24/input.refout b/2016/Day24/input.refout
deleted file mode 100644
index 93c5bf687..000000000
--- a/2016/Day24/input.refout
+++ /dev/null
@@ -1,2 +0,0 @@
-474
-696
diff --git a/2016/Day25/README.md b/2016/Day25/README.md
deleted file mode 100644
index 268d84818..000000000
--- a/2016/Day25/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-## --- Day 25: Clock Signal ---
-You open the door and find yourself on the roof. The city sprawls away from you for miles and miles.
-
-There's not much time now - it's already Christmas, but you're nowhere near the North Pole, much too far to deliver these stars to the sleigh in time.
-
-Read the [full puzzle](https://adventofcode.com/2016/day/25).
\ No newline at end of file
diff --git a/2016/Day25/Solution.cs b/2016/Day25/Solution.cs
deleted file mode 100644
index 8dd6297d7..000000000
--- a/2016/Day25/Solution.cs
+++ /dev/null
@@ -1,75 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-
-namespace AdventOfCode.Y2016.Day25;
-
-[ProblemName("Clock Signal")]
-class Solution : Solver {
-
- public object PartOne(string input) {
- for (int a = 0; ; a++) {
- var length = 0;
- var expectedBit = 0;
- foreach (var actualBit in Run(input, a).Take(100)) {
- if (actualBit == expectedBit) {
- expectedBit = 1 - expectedBit;
- length++;
- } else {
- break;
- }
- }
- if (length == 100) {
- return a;
- }
- }
- }
-
- IEnumerable Run(string input, int a) {
- var prg = Parse(input);
- var regs = new Dictionary();
- var ip = 0;
- int getReg(string reg) {
- return int.TryParse(reg, out var n) ? n
- : regs.ContainsKey(reg) ? regs[reg]
- : 0;
- }
- void setReg(string reg, int value) {
- if (!int.TryParse(reg, out var _)) {
- regs[reg] = value;
- }
- }
-
- setReg("a", a);
-
- while (ip < prg.Length) {
- var stm = prg[ip];
- switch (stm[0]) {
- case "cpy":
- setReg(stm[2], getReg(stm[1]));
- ip++;
- break;
- case "inc":
- setReg(stm[1], getReg(stm[1]) + 1);
- ip++;
- break;
- case "out":
- yield return getReg(stm[1]);
- ip++;
- break;
- case "dec":
- setReg(stm[1], getReg(stm[1]) - 1);
- ip++;
- break;
- case "jnz":
- ip += getReg(stm[1]) != 0 ? getReg(stm[2]) : 1;
- break;
- default:
- throw new Exception("Cannot parse " + string.Join(" ", stm));
- }
- }
- }
-
- string[][] Parse(string input) =>
- input.Split('\n').Select(line => line.Split(' ')).ToArray();
-}
diff --git a/2016/Day25/input.in b/2016/Day25/input.in
deleted file mode 100644
index 98d287199..000000000
Binary files a/2016/Day25/input.in and /dev/null differ
diff --git a/2016/Day25/input.refout b/2016/Day25/input.refout
deleted file mode 100644
index 86a030719..000000000
--- a/2016/Day25/input.refout
+++ /dev/null
@@ -1 +0,0 @@
-192
diff --git a/2016/README.md b/2016/README.md
deleted file mode 100644
index d3ef6bd90..000000000
--- a/2016/README.md
+++ /dev/null
@@ -1,4 +0,0 @@
-# Advent of Code (2016)
-Check out https://adventofcode.com/2016.
-
-
diff --git a/2016/SplashScreen.cs b/2016/SplashScreen.cs
deleted file mode 100644
index 04fac5852..000000000
--- a/2016/SplashScreen.cs
+++ /dev/null
@@ -1,265 +0,0 @@
-using System;
-
-namespace AdventOfCode.Y2016;
-
-class SplashScreenImpl : SplashScreen {
-
- public void Show() {
-
- var color = Console.ForegroundColor;
- Write(0xcc00, false, " ▄█▄ ▄▄█ ▄ ▄ ▄▄▄ ▄▄ ▄█▄ ▄▄▄ ▄█ ▄▄ ▄▄▄ ▄▄█ ▄▄▄\n █▄█ █ █ █ █ █▄█ █ █ █ █ █ █▄ ");
- Write(0xcc00, false, " █ █ █ █ █ █▄█\n █ █ █▄█ ▀▄▀ █▄▄ █ █ █▄ █▄█ █ █▄ █▄█ █▄█ █▄▄ // 2016\n \n ");
- Write(0xcc00, false, " ");
- Write(0xffff66, true, "( ( ( ( ((*)) ) ) ) ) \n ");
- Write(0x666666, false, " | \n +-|---+ ");
- Write(0x666666, false, " \n / | /| \n ");
- Write(0x666666, false, " +-----+ | \n |");
- Write(0x333333, false, "::");
- Write(0xffff66, true, ":");
- Write(0x333333, false, "::");
- Write(0x666666, false, "| | ");
- Write(0xcccccc, false, "25 ");
- Write(0xffff66, false, "**\n ");
- Write(0x666666, false, " +----+ |");
- Write(0x333333, false, "::");
- Write(0x9900, true, ":");
- Write(0x333333, false, "::");
- Write(0x666666, false, "| |---+ +-----------+ ");
- Write(0xcccccc, false, "24 ");
- Write(0xffff66, false, "**\n ");
- Write(0x666666, false, " / / \\ |");
- Write(0x333333, false, ":");
- Write(0x9900, true, ":::");
- Write(0x333333, false, ":");
- Write(0x666666, false, "| | /| / \\\\\\\\\\\\ [] /| ");
- Write(0xcccccc, false, "23 ");
- Write(0xffff66, false, "**\n ");
- Write(0x666666, false, " / / / \\|");
- Write(0x9900, true, ":::::");
- Write(0x666666, false, "| | / | / \\\\\\\\\\\\ [] / | ");
- Write(0xcccccc, false, "22 ");
- Write(0xffff66, false, "**\n ");
- Write(0x666666, false, " / / / / \\");
- Write(0x333333, false, "::");
- Write(0x553322, true, ":");
- Write(0x333333, false, "::");
- Write(0x666666, false, "|/ / | +-----------+ | ");
- Write(0xcccccc, false, "21 ");
- Write(0xffff66, false, "**\n ");
- Write(0x666666, false, " +----+ / / / \\------+ ------|");
- Write(0x333333, false, "::::");
- Write(0x66ff, true, ":");
- Write(0x333333, false, ":");
- Write(0x66ff, true, ":");
- Write(0x333333, false, "::::");
- Write(0x666666, false, "| | ");
- Write(0xcccccc, false, "20 ");
- Write(0xffff66, false, "**\n ");
- Write(0x666666, false, " |-----\\ / / / \\=====| ------|");
- Write(0x333333, false, ":");
- Write(0x66ff, true, ":");
- Write(0x333333, false, ":::");
- Write(0x66ff, true, ":");
- Write(0x333333, false, ":::");
- Write(0x66ff, true, ":");
- Write(0x333333, false, ":");
- Write(0x666666, false, "| | ");
- Write(0xcccccc, false, "19 ");
- Write(0xffff66, false, "**\n ");
- Write(0x666666, false, " |------\\ / / / \\====| | |");
- Write(0x66ff, true, ":::");
- Write(0x333333, false, ":");
- Write(0x66ff, true, ":::");
- Write(0x333333, false, ":");
- Write(0x66ff, true, ":::");
- Write(0x666666, false, "| | ");
- Write(0xcccccc, false, "18 ");
- Write(0xffff66, false, "**\n ");
- Write(0x666666, false, " |-------\\ / / / +===| | |");
- Write(0x333333, false, ":::");
- Write(0x66ff, true, ":");
- Write(0x333333, false, ":::");
- Write(0x66ff, true, ":");
- Write(0x333333, false, ":::");
- Write(0x666666, false, "| | ");
- Write(0xcccccc, false, "17 ");
- Write(0xffff66, false, "**\n ");
- Write(0x666666, false, " |--------\\ / / /|===| | |");
- Write(0x333333, false, ":::");
- Write(0x66ff, true, ":");
- Write(0x333333, false, ":::");
- Write(0x66ff, true, ":");
- Write(0x333333, false, ":::");
- Write(0x666666, false, "| | ");
- Write(0xcccccc, false, "16 ");
- Write(0xffff66, false, "**\n ");
- Write(0x666666, false, " |---------\\ / / |===| | /|");
- Write(0x66ff, true, ":::");
- Write(0x333333, false, ":");
- Write(0x66ff, true, ":::");
- Write(0x333333, false, ":");
- Write(0x66ff, true, ":::");
- Write(0x666666, false, "| | ");
- Write(0xcccccc, false, "15 ");
- Write(0xffff66, false, "**\n ");
- Write(0x666666, false, " |----------\\ / |===| / //|");
- Write(0x333333, false, ":");
- Write(0x66ff, true, ":");
- Write(0x333333, false, ":::");
- Write(0x66ff, true, ":");
- Write(0x333333, false, ":::");
- Write(0x66ff, true, ":");
- Write(0x333333, false, ":");
- Write(0x666666, false, "| / ");
- Write(0xcccccc, false, "14 ");
- Write(0xffff66, false, "**\n ");
- Write(0x666666, false, " +-----------+ |===| / //||");
- Write(0x333333, false, "::::");
- Write(0x66ff, true, ":");
- Write(0x333333, false, ":");
- Write(0x66ff, true, ":");
- Write(0x333333, false, "::::");
- Write(0x666666, false, "|/ ");
- Write(0xcccccc, false, "13 ");
- Write(0xffff66, false, "**\n ");
- Write(0x666666, false, " |");
- Write(0xff0000, true, ":");
- Write(0x333333, false, ":");
- Write(0xff0000, true, ":");
- Write(0x333333, false, "::::::::");
- Write(0x666666, false, "| |===|/__//___________________ ");
- Write(0xcccccc, false, "12 ");
- Write(0xffff66, false, "**\n ");
- Write(0x666666, false, " |");
- Write(0xff0000, true, ":::");
- Write(0x333333, false, ":");
- Write(0x9900, true, ":::");
- Write(0x333333, false, "::::");
- Write(0x666666, false, "| |______//|_____...._________ ");
- Write(0xcccccc, false, "11 ");
- Write(0xffff66, false, "**\n ");
- Write(0x666666, false, " |");
- Write(0xff0000, true, ":");
- Write(0x333333, false, ":");
- Write(0xff0000, true, ":");
- Write(0x333333, false, ":");
- Write(0x9900, true, ":");
- Write(0x333333, false, ":");
- Write(0x9900, true, ":");
- Write(0x333333, false, "::::");
- Write(0x666666, false, "| | //| ____/ /_/___ ");
- Write(0xcccccc, false, "10 ");
- Write(0xffff66, false, "**\n ");
- Write(0x666666, false, " ---|");
- Write(0x333333, false, "::::");
- Write(0x9900, true, ":::");
- Write(0x333333, false, "::::");
- Write(0x666666, false, "| |--------|[][]|_|[][]_\\------ ");
- Write(0xcccccc, false, " 9 ");
- Write(0xffff66, false, "**\n ");
- Write(0x666666, false, "----|");
- Write(0x333333, false, "::");
- Write(0xff0000, true, ":");
- Write(0x333333, false, ":");
- Write(0xff0000, true, ":");
- Write(0x333333, false, "::::::");
- Write(0x666666, false, "| |--------------------------- ");
- Write(0xcccccc, false, " 8 ");
- Write(0xffff66, false, "**\n ");
- Write(0x666666, false, " || |");
- Write(0x333333, false, "::");
- Write(0xff0000, true, ":::");
- Write(0x333333, false, ":");
- Write(0x9900, true, ":::");
- Write(0x333333, false, "::");
- Write(0x666666, false, "| | //| || / / / || || ");
- Write(0xcccccc, false, " 7 ");
- Write(0xffff66, false, "**\n ");
- Write(0x666666, false, " || |");
- Write(0x333333, false, "::");
- Write(0xff0000, true, ":");
- Write(0x333333, false, ":");
- Write(0xff0000, true, ":");
- Write(0x333333, false, ":");
- Write(0x9900, true, ":");
- Write(0x333333, false, ":");
- Write(0x9900, true, ":");
- Write(0x333333, false, "::");
- Write(0x666666, false, "| | //| || / / || ");
- Write(0xffff66, true, "*");
- Write(0x666666, false, " || ");
- Write(0xcccccc, false, " 6 ");
- Write(0xffff66, false, "**\n ");
- Write(0x666666, false, " |");
- Write(0x333333, false, "::::::");
- Write(0x9900, true, ":::");
- Write(0x333333, false, "::");
- Write(0x666666, false, "| |//| / / / ");
- Write(0x9900, false, ">");
- Write(0xff9900, true, "o");
- Write(0x9900, false, "< ");
- Write(0xcccccc, false, " 5 ");
- Write(0xffff66, false, "**\n ");
- Write(0x666666, false, " |");
- Write(0x333333, false, "::::");
- Write(0xff0000, true, ":");
- Write(0x333333, false, ":");
- Write(0xff0000, true, ":");
- Write(0x333333, false, "::::");
- Write(0x666666, false, "| //| / / ___");
- Write(0x9900, false, ">");
- Write(0xff0000, true, "@");
- Write(0x9900, false, ">");
- Write(0x66ff, true, "O");
- Write(0x9900, false, "<");
- Write(0x666666, false, "____ ");
- Write(0xcccccc, false, " 4 ");
- Write(0xffff66, false, "**\n ");
- Write(0x666666, false, " |");
- Write(0x333333, false, "::::");
- Write(0xff0000, true, ":::");
- Write(0x333333, false, ":");
- Write(0x9900, true, ":::");
- Write(0x666666, false, "| //| / / / / ");
- Write(0x9900, false, ">");
- Write(0x66ff, true, "O");
- Write(0x9900, false, ">");
- Write(0xff9900, true, "o");
- Write(0x9900, false, "<");
- Write(0xff0000, true, "@");
- Write(0x9900, false, "<");
- Write(0x666666, false, " / ");
- Write(0xcccccc, false, " 3 ");
- Write(0xffff66, false, "**\n ");
- Write(0x666666, false, " |");
- Write(0x333333, false, "::::");
- Write(0xff0000, true, ":");
- Write(0x333333, false, ":");
- Write(0xff0000, true, ":");
- Write(0x333333, false, ":");
- Write(0x9900, true, ":");
- Write(0x333333, false, ":");
- Write(0x9900, true, ":");
- Write(0x666666, false, "| //| / / / ");
- Write(0xaaaaaa, false, "_| |_");
- Write(0x666666, false, " / ");
- Write(0xcccccc, false, " 2 ");
- Write(0xffff66, false, "**\n ");
- Write(0x666666, false, " |");
- Write(0x333333, false, "::::::::");
- Write(0x9900, true, ":::");
- Write(0x666666, false, "|//| / / / /___________/ ");
- Write(0xcccccc, false, " 1 ");
- Write(0xffff66, false, "**\n ");
- Write(0x666666, false, " ==============//======+...+==================== \n - - - - - - -// - - -/ / - -");
- Write(0x666666, false, " - - - - - - - - \n ==============//|============================== \n ");
- Write(0x666666, false, " //| \n \n");
-
- Console.ForegroundColor = color;
- Console.WriteLine();
- }
-
- private static void Write(int rgb, bool bold, string text){
- Console.Write($"\u001b[38;2;{(rgb>>16)&255};{(rgb>>8)&255};{rgb&255}{(bold ? ";1" : "")}m{text}");
- }
-}
\ No newline at end of file
diff --git a/2016/calendar.svg b/2016/calendar.svg
deleted file mode 100644
index 001a5323e..000000000
--- a/2016/calendar.svg
+++ /dev/null
@@ -1,55 +0,0 @@
-
\ No newline at end of file
diff --git a/2017/Day01/README.md b/2017/Day01/README.md
deleted file mode 100644
index ceb540a18..000000000
--- a/2017/Day01/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-## --- Day 1: Inverse Captcha ---
-The night before Christmas, one of Santa's Elves calls you in a panic. "The printer's broken! We can't print the Naughty or Nice List!" By the time you make it to sub-basement 17, there are only a few minutes until midnight. "We have a big problem," she says; "there must be almost fifty bugs in this system, but nothing else can print The List. Stand in this square, quick! There's no time to explain; if you can convince them to pay you in stars, you'll be able to--" She pulls a lever and the world goes blurry.
-
-When your eyes can focus again, everything seems a lot more pixelated than before. She must have sent you inside the computer! You check the system clock: 25 milliseconds until midnight. With that much time, you should be able to collect all fifty stars by December 25th.
-
-_Visit the website for the full story and [full puzzle](https://adventofcode.com/2017/day/1) description._
diff --git a/2017/Day01/Solution.cs b/2017/Day01/Solution.cs
deleted file mode 100755
index 2f114aa8c..000000000
--- a/2017/Day01/Solution.cs
+++ /dev/null
@@ -1,19 +0,0 @@
-using System.Linq;
-
-namespace AdventOfCode.Y2017.Day01;
-
-[ProblemName("Inverse Captcha")]
-class Solution : Solver {
-
- public object PartOne(string input) => InverseCaptcha(input, 1);
-
- public object PartTwo(string input) => InverseCaptcha(input, input.Length / 2);
-
- int InverseCaptcha(string input, int skip) {
- return (
- from i in Enumerable.Range(0, input.Length)
- where input[i] == input[(i + skip) % input.Length]
- select int.Parse(input[i].ToString())
- ).Sum();
- }
-}
diff --git a/2017/Day01/input.in b/2017/Day01/input.in
deleted file mode 100644
index a2138c7ab..000000000
Binary files a/2017/Day01/input.in and /dev/null differ
diff --git a/2017/Day01/input.refout b/2017/Day01/input.refout
deleted file mode 100644
index 6250b7ce4..000000000
--- a/2017/Day01/input.refout
+++ /dev/null
@@ -1,2 +0,0 @@
-1253
-1278
\ No newline at end of file
diff --git a/2017/Day02/README.md b/2017/Day02/README.md
deleted file mode 100644
index f2bb4b766..000000000
--- a/2017/Day02/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-## --- Day 2: Corruption Checksum ---
-As you walk through the door, a glowing humanoid shape yells in your direction. "You there! Your state appears to be idle. Come help us repair the corruption in this spreadsheet - if we take another millisecond, we'll have to display an hourglass cursor!"
-
-The spreadsheet consists of rows of apparently-random numbers. To make sure the recovery process is on the right track, they need you to calculate the spreadsheet's *checksum*. For each row, determine the difference between the largest value and the smallest value; the checksum is the sum of all of these differences.
-
-Read the [full puzzle](https://adventofcode.com/2017/day/2).
\ No newline at end of file
diff --git a/2017/Day02/Solution.cs b/2017/Day02/Solution.cs
deleted file mode 100755
index ab500a9eb..000000000
--- a/2017/Day02/Solution.cs
+++ /dev/null
@@ -1,26 +0,0 @@
-using System.Linq;
-
-namespace AdventOfCode.Y2017.Day02;
-
-[ProblemName("Corruption Checksum")]
-class Solution : Solver {
-
- public object PartOne(string input) {
- return (
- from line in input.Split('\n')
- let numbers = line.Split('\t').Select(int.Parse)
- select numbers.Max() - numbers.Min()
- ).Sum();
- }
-
- public object PartTwo(string input) {
- return (
- from line in input.Split('\n')
- let numbers = line.Split('\t').Select(int.Parse)
- from a in numbers
- from b in numbers
- where a > b && a % b == 0
- select a / b
- ).Sum();
- }
-}
diff --git a/2017/Day02/input.in b/2017/Day02/input.in
deleted file mode 100644
index e09ace427..000000000
Binary files a/2017/Day02/input.in and /dev/null differ
diff --git a/2017/Day02/input.refout b/2017/Day02/input.refout
deleted file mode 100644
index b3bf129bd..000000000
--- a/2017/Day02/input.refout
+++ /dev/null
@@ -1,2 +0,0 @@
-32121
-197
diff --git a/2017/Day03/README.md b/2017/Day03/README.md
deleted file mode 100644
index 8bf5afc07..000000000
--- a/2017/Day03/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-## --- 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:
-
-Read the [full puzzle](https://adventofcode.com/2017/day/3).
\ No newline at end of file
diff --git a/2017/Day03/Solution.cs b/2017/Day03/Solution.cs
deleted file mode 100755
index b823a0328..000000000
--- a/2017/Day03/Solution.cs
+++ /dev/null
@@ -1,50 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-
-namespace AdventOfCode.Y2017.Day03;
-
-[ProblemName("Spiral Memory")]
-class Solution : Solver {
-
- public object PartOne(string input) {
- var (x, y) = SpiralCoordinates().ElementAt(int.Parse(input) - 1);
- return Math.Abs(x) + Math.Abs(y);
- }
-
- public object PartTwo(string input) {
- var num = int.Parse(input);
- return SpiralSums().First(v => v > num);
- }
-
- IEnumerable<(int, int)> SpiralCoordinates() {
- var (x, y) = (0, 0);
- var (dx, dy) = (1, 0);
-
- for (var edgeLength = 1; ; edgeLength++) {
- for (var run = 0; run < 2; run++) {
- for (var step = 0; step < edgeLength; step++) {
- yield return (x, y);
- (x, y) = (x + dx, y - dy);
- }
- (dx, dy) = (-dy, dx);
- }
- }
- }
-
- IEnumerable SpiralSums() {
- var mem = new Dictionary<(int, int), int>();
- mem[(0, 0)] = 1;
-
- foreach (var coord in SpiralCoordinates()) {
- var sum = (from coordT in Window(coord) where mem.ContainsKey(coordT) select mem[coordT]).Sum();
- mem[coord] = sum;
- yield return sum;
- }
- }
-
- IEnumerable<(int, int)> Window((int x, int y) coord) =>
- from dx in new[] { -1, 0, 1 }
- from dy in new[] { -1, 0, 1 }
- select (coord.x + dx, coord.y + dy);
-}
diff --git a/2017/Day03/input.in b/2017/Day03/input.in
deleted file mode 100644
index 799a453dc..000000000
Binary files a/2017/Day03/input.in and /dev/null differ
diff --git a/2017/Day03/input.refout b/2017/Day03/input.refout
deleted file mode 100644
index 3605eb183..000000000
--- a/2017/Day03/input.refout
+++ /dev/null
@@ -1,2 +0,0 @@
-430
-312453
diff --git a/2017/Day04/README.md b/2017/Day04/README.md
deleted file mode 100644
index 1c942d90a..000000000
--- a/2017/Day04/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-## --- 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 pass*word*. A passphrase consists of a series of words (lowercase letters) separated by spaces.
-
-To ensure security, a valid passphrase must contain no duplicate words.
-
-Read the [full puzzle](https://adventofcode.com/2017/day/4).
\ No newline at end of file
diff --git a/2017/Day04/Solution.cs b/2017/Day04/Solution.cs
deleted file mode 100755
index c4f1cffe0..000000000
--- a/2017/Day04/Solution.cs
+++ /dev/null
@@ -1,20 +0,0 @@
-using System;
-using System.Linq;
-
-namespace AdventOfCode.Y2017.Day04;
-
-[ProblemName("High-Entropy Passphrases")]
-class Solution : Solver {
-
- public object PartOne(string lines) =>
- ValidLineCount(lines, word => word);
-
- public object PartTwo(string lines) =>
- ValidLineCount(lines, word => string.Concat(word.OrderBy(ch => ch)));
-
- int ValidLineCount(string lines, Func normalizer) =>
- lines.Split('\n').Where(line => IsValidLine(line.Split(' '), normalizer)).Count();
-
- bool IsValidLine(string[] words, Func normalizer) =>
- words.Select(normalizer).Distinct().Count() == words.Count();
-}
diff --git a/2017/Day04/input.in b/2017/Day04/input.in
deleted file mode 100644
index a2a581f41..000000000
Binary files a/2017/Day04/input.in and /dev/null differ
diff --git a/2017/Day04/input.refout b/2017/Day04/input.refout
deleted file mode 100644
index 8b537252d..000000000
--- a/2017/Day04/input.refout
+++ /dev/null
@@ -1,2 +0,0 @@
-455
-186
diff --git a/2017/Day05/README.md b/2017/Day05/README.md
deleted file mode 100644
index 838976f6a..000000000
--- a/2017/Day05/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-## --- 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.
-
-Read the [full puzzle](https://adventofcode.com/2017/day/5).
\ No newline at end of file
diff --git a/2017/Day05/Solution.cs b/2017/Day05/Solution.cs
deleted file mode 100755
index 021d73de9..000000000
--- a/2017/Day05/Solution.cs
+++ /dev/null
@@ -1,25 +0,0 @@
-using System;
-using System.Linq;
-
-namespace AdventOfCode.Y2017.Day05;
-
-[ProblemName("A Maze of Twisty Trampolines, All Alike")]
-class Solution : Solver {
-
- public object PartOne(string input) => GetStepCount(input, x => x + 1);
-
- public object PartTwo(string input) => GetStepCount(input, x => x < 3 ? x + 1 : x - 1);
-
- int GetStepCount(string input, Func update) {
- var numbers = input.Split('\n').Select(int.Parse).ToArray();
- var i = 0;
- var stepCount = 0;
- while (i < numbers.Length && i >= 0) {
- var jmp = numbers[i];
- numbers[i] = update(numbers[i]);
- i += jmp;
- stepCount++;
- }
- return stepCount;
- }
-}
diff --git a/2017/Day05/input.in b/2017/Day05/input.in
deleted file mode 100644
index a6f2d41e0..000000000
Binary files a/2017/Day05/input.in and /dev/null differ
diff --git a/2017/Day05/input.refout b/2017/Day05/input.refout
deleted file mode 100644
index 17c796bbf..000000000
--- a/2017/Day05/input.refout
+++ /dev/null
@@ -1,2 +0,0 @@
-374269
-27720699
diff --git a/2017/Day06/README.md b/2017/Day06/README.md
deleted file mode 100644
index a3a4fd7ba..000000000
--- a/2017/Day06/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-## --- 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.
-
-Read the [full puzzle](https://adventofcode.com/2017/day/6).
\ No newline at end of file
diff --git a/2017/Day06/Solution.cs b/2017/Day06/Solution.cs
deleted file mode 100755
index e37b91233..000000000
--- a/2017/Day06/Solution.cs
+++ /dev/null
@@ -1,43 +0,0 @@
-using System.Collections.Generic;
-using System.Linq;
-
-namespace AdventOfCode.Y2017.Day06;
-
-[ProblemName("Memory Reallocation")]
-class Solution : Solver {
-
- public object PartOne(string input) => GetStepCount(Parse(input));
-
- public object PartTwo(string input) {
- var numbers = Parse(input);
- GetStepCount(numbers);
- return GetStepCount(numbers);
- }
-
- List Parse(string input) => input.Split('\t').Select(int.Parse).ToList();
-
- int GetStepCount(List numbers) {
- var stepCount = 0;
- var seen = new HashSet();
- while (true) {
- var key = string.Join(";", numbers.Select(x => x.ToString()));
- if (seen.Contains(key)) {
- return stepCount;
- }
- seen.Add(key);
- Redistribute(numbers);
- stepCount++;
- }
- }
-
- void Redistribute(List numbers) {
- var max = numbers.Max();
- var i = numbers.IndexOf(max);
- numbers[i] = 0;
- while (max > 0) {
- i++;
- numbers[i % numbers.Count]++;
- max--;
- }
- }
-}
diff --git a/2017/Day06/input.in b/2017/Day06/input.in
deleted file mode 100644
index 90d310c5a..000000000
Binary files a/2017/Day06/input.in and /dev/null differ
diff --git a/2017/Day06/input.refout b/2017/Day06/input.refout
deleted file mode 100644
index 7c5b5110a..000000000
--- a/2017/Day06/input.refout
+++ /dev/null
@@ -1,2 +0,0 @@
-6681
-2392
diff --git a/2017/Day07/README.md b/2017/Day07/README.md
deleted file mode 100644
index 5d8adfa75..000000000
--- a/2017/Day07/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-## --- Day 7: Recursive Circus ---
-Wandering further through the circuits of the computer, you come upon a tower of programs that have gotten themselves into a bit of trouble. A recursive algorithm has gotten out of hand, and now they're balanced precariously in a large tower.
-
-One program at the bottom supports the entire tower. It's holding a large disc, and on the disc are balanced several more sub-towers. At the bottom of these sub-towers, standing on the bottom disc, are other programs, each holding *their* own disc, and so on. At the very tops of these sub-sub-sub-...-towers, many programs stand simply keeping the disc below them balanced but with no disc of their own.
-
-Read the [full puzzle](https://adventofcode.com/2017/day/7).
\ No newline at end of file
diff --git a/2017/Day07/Solution.cs b/2017/Day07/Solution.cs
deleted file mode 100755
index 8f6c361d7..000000000
--- a/2017/Day07/Solution.cs
+++ /dev/null
@@ -1,82 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text.RegularExpressions;
-
-namespace AdventOfCode.Y2017.Day07;
-
-class Node {
- public string Id;
- public string[] Children;
- public int Weight;
- public int TreeWeight = -1;
-}
-
-class Tree : Dictionary { }
-
-[ProblemName("Recursive Circus")]
-class Solution : Solver {
-
- public object PartOne(string input) => Root(Parse(input)).Id;
-
- public object PartTwo(string input) {
- var tree = Parse(input);
- var root = Root(tree);
- ComputeTreeWeights(root, tree);
- var bogusChild = BogusChild(root, tree);
- var desiredWeight = tree[root.Children.First(childId => childId != bogusChild.Id)].TreeWeight;
- return Fix(bogusChild, desiredWeight, tree);
- }
-
- Tree Parse(string input) {
- var tree = new Tree();
- foreach (var line in input.Split('\n')) {
- var parts = Regex.Match(line, @"(?[a-z]+) \((?[0-9]+)\)( -> (?.*))?");
-
- tree.Add(
- parts.Groups["id"].Value,
- new Node {
- Id = parts.Groups["id"].Value,
- Weight = int.Parse(parts.Groups["weight"].Value),
- Children = string.IsNullOrEmpty(parts.Groups["children"].Value)
- ? new string[0]
- : Regex.Split(parts.Groups["children"].Value, ", "),
- });
- }
- return tree;
- }
-
- Node Root(Tree tree) =>
- tree.Values.First(node => !tree.Values.Any(nodeParent => nodeParent.Children.Contains(node.Id)));
-
- int ComputeTreeWeights(Node node, Tree tree) {
- node.TreeWeight = node.Weight + node.Children.Select(childId => ComputeTreeWeights(tree[childId], tree)).Sum();
- return node.TreeWeight;
- }
-
- Node BogusChild(Node node, Tree tree) {
- var w =
- (from childId in node.Children
- let child = tree[childId]
- group child by child.TreeWeight into childrenByTreeWeight
- orderby childrenByTreeWeight.Count()
- select childrenByTreeWeight).ToArray();
-
- return w.Length == 1 ? null : w[0].Single();
- }
-
- int Fix(Node node, int desiredWeight, Tree tree) {
- if (node.Children.Length < 2) {
- throw new NotImplementedException();
- }
-
- var bogusChild = BogusChild(node, tree);
-
- if (bogusChild == null) {
- return desiredWeight - node.TreeWeight + node.Weight;
- } else {
- desiredWeight = desiredWeight - node.TreeWeight + bogusChild.TreeWeight;
- return Fix(bogusChild, desiredWeight, tree);
- }
- }
-}
diff --git a/2017/Day07/input.in b/2017/Day07/input.in
deleted file mode 100644
index 0f1f687ea..000000000
Binary files a/2017/Day07/input.in and /dev/null differ
diff --git a/2017/Day07/input.refout b/2017/Day07/input.refout
deleted file mode 100644
index d3b8398ea..000000000
--- a/2017/Day07/input.refout
+++ /dev/null
@@ -1,2 +0,0 @@
-vvsvez
-362
diff --git a/2017/Day08/README.md b/2017/Day08/README.md
deleted file mode 100644
index b8a09384d..000000000
--- a/2017/Day08/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-## --- Day 8: I Heard You Like Registers ---
-You receive a signal directly from the CPU. Because of your recent assistance with [jump instructions](5), it would like you to compute the result of a series of unusual register instructions.
-
-Each instruction consists of several parts: the register to modify, whether to increase or decrease that register's value, the amount by which to increase or decrease it, and a condition. If the condition fails, skip the instruction without modifying the register. The registers all start at `0`. The instructions look like this:
-
-Read the [full puzzle](https://adventofcode.com/2017/day/8).
\ No newline at end of file
diff --git a/2017/Day08/Solution.cs b/2017/Day08/Solution.cs
deleted file mode 100755
index 30396292d..000000000
--- a/2017/Day08/Solution.cs
+++ /dev/null
@@ -1,46 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-
-namespace AdventOfCode.Y2017.Day08;
-
-[ProblemName("I Heard You Like Registers")]
-class Solution : Solver {
-
- public object PartOne(string input) => Run(input).lastMax;
- public object PartTwo(string input) => Run(input).runningMax;
-
- (int runningMax, int lastMax) Run(string input) {
- var regs = new Dictionary();
- var runningMax = 0;
- foreach (var line in input.Split('\n')) {
- //hsv inc 472 if hsv >= 4637
- var words = line.Split(' ');
- var (regDst, op, num, regCond, cond, condNum) = (words[0], words[1], int.Parse(words[2]), words[4], words[5], int.Parse(words[6]));
- if (!regs.ContainsKey(regDst)) {
- regs[regDst] = 0;
- }
- if (!regs.ContainsKey(regCond)) {
- regs[regCond] = 0;
- }
-
- var conditionHolds = cond switch {
- ">=" => regs[regCond] >= condNum,
- "<=" => regs[regCond] <= condNum,
- "==" => regs[regCond] == condNum,
- "!=" => regs[regCond] != condNum,
- ">" => regs[regCond] > condNum,
- "<" => regs[regCond] < condNum,
- _ => throw new NotImplementedException(cond)
- };
- if (conditionHolds) {
- regs[regDst] +=
- op == "inc" ? num :
- op == "dec" ? -num :
- throw new NotImplementedException(op);
- }
- runningMax = Math.Max(runningMax, regs[regDst]);
- }
- return (runningMax, regs.Values.Max());
- }
-}
diff --git a/2017/Day08/input.in b/2017/Day08/input.in
deleted file mode 100644
index 94afcf93d..000000000
Binary files a/2017/Day08/input.in and /dev/null differ
diff --git a/2017/Day08/input.refout b/2017/Day08/input.refout
deleted file mode 100644
index 90866527f..000000000
--- a/2017/Day08/input.refout
+++ /dev/null
@@ -1,2 +0,0 @@
-6343
-7184
diff --git a/2017/Day09/README.md b/2017/Day09/README.md
deleted file mode 100644
index 03e6ad6b8..000000000
--- a/2017/Day09/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-## --- Day 9: Stream Processing ---
-A large stream blocks your path. According to the locals, it's not safe to cross the stream at the moment because it's full of *garbage*. You look down at the stream; rather than water, you discover that it's a *stream of characters*.
-
-You sit for a while and record part of the stream (your puzzle input). The characters represent *groups* - sequences that begin with `{` and end with `}`. Within a group, there are zero or more other things, separated by commas: either another *group* or *garbage*. Since groups can contain other groups, a `}` only closes the *most-recently-opened unclosed group* - that is, they are nestable. Your puzzle input represents a single, large group which itself contains many smaller ones.
-
-Read the [full puzzle](https://adventofcode.com/2017/day/9).
\ No newline at end of file
diff --git a/2017/Day09/Solution.cs b/2017/Day09/Solution.cs
deleted file mode 100755
index 01b4a2f62..000000000
--- a/2017/Day09/Solution.cs
+++ /dev/null
@@ -1,49 +0,0 @@
-using System.Collections.Generic;
-using System.Linq;
-
-namespace AdventOfCode.Y2017.Day09;
-
-[ProblemName("Stream Processing")]
-class Solution : Solver {
-
- public object PartOne(string input) => BlockScores(input).Sum();
- public object PartTwo(string input) => Classify(input).Where((x) => x.garbage).Count();
-
- IEnumerable BlockScores(string input) {
- var score = 0;
- foreach (var ch in Classify(input).Where((x) => !x.garbage).Select(x => x.ch)) {
- if (ch == '}') {
- score--;
- } else if (ch == '{') {
- score++;
- yield return score;
- }
- }
- }
-
- IEnumerable<(char ch, bool garbage)> Classify(string input) {
- var skip = false;
- var garbage = false;
- foreach (var ch in input) {
- if (garbage) {
- if (skip) {
- skip = false;
- } else {
- if (ch == '>') {
- garbage = false;
- } else if (ch == '!') {
- skip = true;
- } else {
- yield return (ch, garbage);
- }
- }
- } else {
- if (ch == '<') {
- garbage = true;
- } else {
- yield return (ch, garbage);
- }
- }
- }
- }
-}
diff --git a/2017/Day09/input.in b/2017/Day09/input.in
deleted file mode 100644
index 2de7e7361..000000000
Binary files a/2017/Day09/input.in and /dev/null differ
diff --git a/2017/Day09/input.refout b/2017/Day09/input.refout
deleted file mode 100644
index 6dd2325c9..000000000
--- a/2017/Day09/input.refout
+++ /dev/null
@@ -1,2 +0,0 @@
-14212
-6569
diff --git a/2017/Day10/README.md b/2017/Day10/README.md
deleted file mode 100644
index 525202279..000000000
--- a/2017/Day10/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-## --- Day 10: Knot Hash ---
-You come across some programs that are trying to implement a software emulation of a hash based on knot-tying. The hash these programs are implementing isn't very strong, but you decide to help them anyway. You make a mental note to remind the Elves later not to invent their own cryptographic functions.
-
-This hash function simulates tying a knot in a circle of string with 256 marks on it. Based on the input to be hashed, the function repeatedly selects a span of string, brings the ends together, and gives the span a half-twist to reverse the order of the marks within it. After doing this many times, the order of the marks is used to build the resulting hash.
-
-Read the [full puzzle](https://adventofcode.com/2017/day/10).
\ No newline at end of file
diff --git a/2017/Day10/Solution.cs b/2017/Day10/Solution.cs
deleted file mode 100755
index 56eb1186a..000000000
--- a/2017/Day10/Solution.cs
+++ /dev/null
@@ -1,45 +0,0 @@
-using System.Collections.Generic;
-using System.Linq;
-
-namespace AdventOfCode.Y2017.Day10;
-
-[ProblemName("Knot Hash")]
-class Solution : Solver {
-
- public object PartOne(string input) {
- var chars = input.Split(',').Select(int.Parse);
- var hash = KnotHash(chars, 1);
- return hash[0] * hash[1];
- }
-
- public object PartTwo(string input) {
- var suffix = new [] { 17, 31, 73, 47, 23 };
- var chars = input.ToCharArray().Select(b => (int)b).Concat(suffix);
-
- var hash = KnotHash(chars, 64);
-
- return string.Join("",
- from blockIdx in Enumerable.Range(0, 16)
- let block = hash.Skip(16 * blockIdx).Take(16)
- select block.Aggregate(0, (acc, ch) => acc ^ ch).ToString("x2"));
- }
-
- int[] KnotHash(IEnumerable input, int rounds) {
- var output = Enumerable.Range(0, 256).ToArray();
-
- var current = 0;
- var skip = 0;
- for (var round = 0; round < rounds; round++) {
- foreach (var len in input) {
- for (int i = 0; i < len / 2; i++) {
- var from = (current + i) % output.Length;
- var to = (current + len - 1 - i) % output.Length;
- (output[from], output[to]) = (output[to], output[from]);
- }
- current += len + skip;
- skip++;
- }
- }
- return output;
- }
-}
diff --git a/2017/Day10/input.in b/2017/Day10/input.in
deleted file mode 100644
index 960b72aab..000000000
Binary files a/2017/Day10/input.in and /dev/null differ
diff --git a/2017/Day10/input.refout b/2017/Day10/input.refout
deleted file mode 100644
index f7d268b57..000000000
--- a/2017/Day10/input.refout
+++ /dev/null
@@ -1,2 +0,0 @@
-826
-d067d3f14d07e09c2e7308c3926605c4
diff --git a/2017/Day11/README.md b/2017/Day11/README.md
deleted file mode 100644
index 5e1c4b600..000000000
--- a/2017/Day11/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-## --- Day 11: Hex Ed ---
-Crossing the bridge, you've barely reached the other side of the stream when a program comes up to you, clearly in distress. "It's my child process," she says, "he's gotten lost in an infinite grid!"
-
-Fortunately for her, you have plenty of experience with infinite grids.
-
-Read the [full puzzle](https://adventofcode.com/2017/day/11).
\ No newline at end of file
diff --git a/2017/Day11/Solution.cs b/2017/Day11/Solution.cs
deleted file mode 100755
index f0bb5d90f..000000000
--- a/2017/Day11/Solution.cs
+++ /dev/null
@@ -1,32 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-
-namespace AdventOfCode.Y2017.Day11;
-
-[ProblemName("Hex Ed")]
-class Solution : Solver {
-
- public object PartOne(string input) => Distances(input).Last();
-
- public object PartTwo(string input) => Distances(input).Max();
-
- IEnumerable Distances(string input) =>
- from w in Wander(input) select (Math.Abs(w.x) + Math.Abs(w.y) + Math.Abs(w.z))/2;
-
- IEnumerable<(int x, int y, int z)> Wander(string input) {
- var (x, y, z) = (0, 0, 0);
- foreach (var dir in input.Split(',')) {
- switch (dir) {
- case "n": (x, y, z) = (x + 0, y + 1, z - 1); break;
- case "ne": (x, y, z) = (x + 1, y + 0, z - 1); break;
- case "se": (x, y, z) = (x + 1, y - 1, z + 0); break;
- case "s": (x, y, z) = (x + 0, y - 1, z + 1); break;
- case "sw": (x, y, z) = (x - 1, y + 0, z + 1); break;
- case "nw": (x, y, z) = (x - 1, y + 1, z + 0); break;
- default: throw new ArgumentException(dir);
- }
- yield return (x, y, z);
- }
- }
-}
diff --git a/2017/Day11/input.in b/2017/Day11/input.in
deleted file mode 100644
index b630af35f..000000000
Binary files a/2017/Day11/input.in and /dev/null differ
diff --git a/2017/Day11/input.refout b/2017/Day11/input.refout
deleted file mode 100644
index ef522ce42..000000000
--- a/2017/Day11/input.refout
+++ /dev/null
@@ -1,2 +0,0 @@
-687
-1483
diff --git a/2017/Day12/README.md b/2017/Day12/README.md
deleted file mode 100644
index ac03ac73b..000000000
--- a/2017/Day12/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-## --- Day 12: Digital Plumber ---
-Walking along the memory banks of the stream, you find a small village that is experiencing a little confusion: some programs can't communicate with each other.
-
-Programs in this village communicate using a fixed system of *pipes*. Messages are passed between programs using these pipes, but most programs aren't connected to each other directly. Instead, programs pass messages between each other until the message reaches the intended recipient.
-
-Read the [full puzzle](https://adventofcode.com/2017/day/12).
\ No newline at end of file
diff --git a/2017/Day12/Solution.cs b/2017/Day12/Solution.cs
deleted file mode 100755
index 18bcaf829..000000000
--- a/2017/Day12/Solution.cs
+++ /dev/null
@@ -1,59 +0,0 @@
-using System.Collections.Generic;
-using System.Linq;
-using System.Text.RegularExpressions;
-
-namespace AdventOfCode.Y2017.Day12;
-
-class Node {
- public string Id;
- public List Neighbours;
-}
-
-[ProblemName("Digital Plumber")]
-class Solution : Solver {
-
- public object PartOne(string input) => GetPartitions(input).Single(x => x.Contains("0")).Count();
- public object PartTwo(string input) => GetPartitions(input).Count();
-
- IEnumerable> GetPartitions(string input) {
- var nodes = Parse(input);
- var parent = new Dictionary();
-
- string getRoot(string id) {
- var root = id;
- while (parent.ContainsKey(root)) {
- root = parent[root];
- }
- return root;
- }
-
- foreach (var nodeA in nodes) {
- var rootA = getRoot(nodeA.Id);
- foreach (var nodeB in nodeA.Neighbours) {
- var rootB = getRoot(nodeB);
- if (rootB != rootA) {
- parent[rootB] = rootA;
- }
- }
- }
-
- return
- from node in nodes
- let root = getRoot(node.Id)
- group node.Id by root into partitions
- select new HashSet(partitions.ToArray());
-
- }
-
- List Parse(string input) {
- return (
- from line in input.Split('\n')
- let parts = Regex.Split(line, " <-> ")
- select new Node() {
- Id = parts[0],
- Neighbours = new List(Regex.Split(parts[1], ", "))
- }
- ).ToList();
- }
-
-}
diff --git a/2017/Day12/input.in b/2017/Day12/input.in
deleted file mode 100644
index 0e252b630..000000000
Binary files a/2017/Day12/input.in and /dev/null differ
diff --git a/2017/Day12/input.refout b/2017/Day12/input.refout
deleted file mode 100644
index 5d4e8c6a9..000000000
--- a/2017/Day12/input.refout
+++ /dev/null
@@ -1,2 +0,0 @@
-128
-209
diff --git a/2017/Day13/README.md b/2017/Day13/README.md
deleted file mode 100644
index f3f247c6d..000000000
--- a/2017/Day13/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-## --- Day 13: Packet Scanners ---
-You need to cross a vast *firewall*. The firewall consists of several layers, each with a *security scanner* that moves back and forth across the layer. To succeed, you must not be detected by a scanner.
-
-By studying the firewall briefly, you are able to record (in your puzzle input) the *depth* of each layer and the *range* of the scanning area for the scanner within it, written as `depth: range`. Each layer has a thickness of exactly `1`. A layer at depth `0` begins immediately inside the firewall; a layer at depth `1` would start immediately after that.
-
-Read the [full puzzle](https://adventofcode.com/2017/day/13).
\ No newline at end of file
diff --git a/2017/Day13/Solution.cs b/2017/Day13/Solution.cs
deleted file mode 100755
index e8d71e292..000000000
--- a/2017/Day13/Solution.cs
+++ /dev/null
@@ -1,42 +0,0 @@
-using System.Collections.Generic;
-using System.Linq;
-using System.Text.RegularExpressions;
-
-namespace AdventOfCode.Y2017.Day13;
-
-class Layers : List<(int depth, int range)> {
- public Layers(IEnumerable<(int depth, int range)> layers) : base(layers) {
- }
-}
-
-[ProblemName("Packet Scanners")]
-class Solution : Solver {
-
- public object PartOne(string input) => Severities(Parse(input), 0).Sum();
-
- public object PartTwo(string input) {
- var layers = Parse(input);
- return Enumerable
- .Range(0, int.MaxValue)
- .First(n => !Severities(layers, n).Any());
- }
-
- Layers Parse(string input) =>
- new Layers(
- from line in input.Split('\n')
- let parts = Regex.Split(line, ": ").Select(int.Parse).ToArray()
- select (parts[0], parts[1])
- );
-
- IEnumerable Severities(Layers layers, int t) {
- var packetPos = 0;
- foreach (var layer in layers) {
- t += layer.depth - packetPos;
- packetPos = layer.depth;
- var scannerPos = t % (2 * layer.range - 2);
- if (scannerPos == 0) {
- yield return layer.depth * layer.range;
- }
- }
- }
-}
diff --git a/2017/Day13/input.in b/2017/Day13/input.in
deleted file mode 100644
index 04007867a..000000000
Binary files a/2017/Day13/input.in and /dev/null differ
diff --git a/2017/Day13/input.refout b/2017/Day13/input.refout
deleted file mode 100644
index 0f6b43a45..000000000
--- a/2017/Day13/input.refout
+++ /dev/null
@@ -1,2 +0,0 @@
-748
-3873662
diff --git a/2017/Day14/README.md b/2017/Day14/README.md
deleted file mode 100644
index e57cab07d..000000000
--- a/2017/Day14/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-## --- Day 14: Disk Defragmentation ---
-Suddenly, a scheduled job activates the system's [disk defragmenter](https://en.wikipedia.org/wiki/Defragmentation). Were the situation different, you might [sit and watch it for a while](https://www.youtube.com/watch?v=kPv1gQ5Rs8A&t=37), but today, you just don't have that kind of time. It's soaking up valuable system resources that are needed elsewhere, and so the only option is to help it finish its task as soon as possible.
-
-The disk in question consists of a 128x128 grid; each square of the grid is either *free* or *used*. On this disk, the state of the grid is tracked by the bits in a sequence of [knot hashes](10).
-
-Read the [full puzzle](https://adventofcode.com/2017/day/14).
\ No newline at end of file
diff --git a/2017/Day14/Solution.cs b/2017/Day14/Solution.cs
deleted file mode 100755
index b87f90a3f..000000000
--- a/2017/Day14/Solution.cs
+++ /dev/null
@@ -1,100 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-
-namespace AdventOfCode.Y2017.Day14;
-
-[ProblemName("Disk Defragmentation")]
-class Solution : Solver {
-
- public object PartOne(string input) => Extract(input).Select(row => row.Count(ch => ch == '#')).Sum();
-
- public object PartTwo(string input) {
- var mtx = Extract(input).Select(row => row.ToCharArray()).ToArray();
- var regions = 0;
- for (int irow = 0; irow < mtx.Count(); irow++) {
- for (int icol = 0; icol < mtx[0].Count(); icol++) {
- if (mtx[irow][icol] == '#') {
- regions++;
- Fill(mtx, (irow, icol));
- }
- }
- }
- return regions;
- }
-
- void Fill(char[][] mtx, (int, int) startCell) {
- var q = new Queue<(int irow, int icol)>();
- var ccol = mtx[0].Count();
- var crow = mtx.Count();
- q.Enqueue(startCell);
-
- while (q.Any()) {
- var (irowCurrent, icolCurrent) = q.Dequeue();
- mtx[irowCurrent][icolCurrent] = ' ';
-
- var neighbourCells =
- from drow in new[] { -1, 0, 1 }
- from dcol in new[] { -1, 0, 1 }
- where Math.Abs(drow) + Math.Abs(dcol) == 1
-
- let icolNeighbour = icolCurrent + dcol
- let irowNeighbour = irowCurrent + drow
-
- where icolNeighbour >= 0 &&
- icolNeighbour < ccol &&
- irowNeighbour >= 0 &&
- irowNeighbour < crow &&
- mtx[irowNeighbour][icolNeighbour] == '#'
-
- select (irowNeighbour, icolNeighbour);
-
- foreach (var neighbourCell in neighbourCells) {
- q.Enqueue(neighbourCell);
- }
- }
- }
-
- IEnumerable Extract(string input) {
- for (var irow = 0; irow < 128; irow++) {
- var row = "";
- foreach (var n in KnotHash(input + "-" + irow)) {
- var m = n;
- for (var bit = 0; bit < 8; bit++) {
- if ((m & (1 << (7 - bit))) != 0) {
- row += "#";
- } else {
- row += ".";
- }
- }
- }
- yield return row;
- }
- }
-
- int[] KnotHash(string input) {
- var suffix = new[] { 17, 31, 73, 47, 23 };
- var chars = input.ToCharArray().Select(b => (int)b).Concat(suffix);
- var output = Enumerable.Range(0, 256).ToArray();
-
- var current = 0;
- var skip = 0;
- for (var round = 0; round < 64; round++) {
- foreach (var len in chars) {
- for (int i = 0; i < len / 2; i++) {
- var from = (current + i) % output.Length;
- var to = (current + len - 1 - i) % output.Length;
- (output[from], output[to]) = (output[to], output[from]);
- }
- current += len + skip;
- skip++;
- }
- }
- var hash = output;
- return (
- from blockIdx in Enumerable.Range(0, 16)
- let block = hash.Skip(16 * blockIdx).Take(16)
- select block.Aggregate(0, (acc, ch) => acc ^ ch)
- ).ToArray();
- }
-}
diff --git a/2017/Day14/input.in b/2017/Day14/input.in
deleted file mode 100644
index eb4843fa4..000000000
Binary files a/2017/Day14/input.in and /dev/null differ
diff --git a/2017/Day14/input.refout b/2017/Day14/input.refout
deleted file mode 100644
index f0fc530ee..000000000
--- a/2017/Day14/input.refout
+++ /dev/null
@@ -1,2 +0,0 @@
-8148
-1180
diff --git a/2017/Day15/README.md b/2017/Day15/README.md
deleted file mode 100644
index caa4832bf..000000000
--- a/2017/Day15/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-## --- Day 15: Dueling Generators ---
-Here, you encounter a pair of dueling generators. The generators, called generator A and generator B, are trying to agree on a sequence of numbers. However, one of them is malfunctioning, and so the sequences don't always match.
-
-As they do this, a judge waits for each of them to generate its next value, compares the lowest 16 bits of both values, and keeps track of the number of times those parts of the values match.
-
-Read the [full puzzle](https://adventofcode.com/2017/day/15).
\ No newline at end of file
diff --git a/2017/Day15/Solution.cs b/2017/Day15/Solution.cs
deleted file mode 100755
index 88d8a2546..000000000
--- a/2017/Day15/Solution.cs
+++ /dev/null
@@ -1,40 +0,0 @@
-using System.Collections.Generic;
-using System.Linq;
-
-namespace AdventOfCode.Y2017.Day15;
-
-[ProblemName("Dueling Generators")]
-class Solution : Solver {
-
- public object PartOne(string input) =>
- MatchCount(Combine(ParseGenerators(input)).Take(40000000));
-
- public object PartTwo(string input) {
- var generators = ParseGenerators(input);
- return MatchCount(Combine((generators.a.Where(a => (a & 3) == 0), generators.b.Where(a => (a & 7) == 0))).Take(5000000));
- }
-
- IEnumerable<(long, long)> Combine((IEnumerable a, IEnumerable b) items) =>
- Enumerable.Zip(items.a, items.b, (a, b) => (a, b));
-
- int MatchCount(IEnumerable<(long a, long b)> items) =>
- items.Count(item => (item.a & 0xffff) == (item.b & 0xffff));
-
- (IEnumerable a, IEnumerable b) ParseGenerators(string input) {
- var lines = input.Split('\n');
- var startA = int.Parse(lines[0].Substring("Generator A starts with ".Length));
- var startB = int.Parse(lines[1].Substring("Generator B starts with ".Length));
-
- return (Generator(startA, 16807), Generator(startB, 48271));
- }
-
- IEnumerable Generator(int start, int mul) {
- var mod = 2147483647;
-
- long state = start;
- while (true) {
- state = (state * mul) % mod;
- yield return state;
- }
- }
-}
diff --git a/2017/Day15/input.in b/2017/Day15/input.in
deleted file mode 100644
index a5e775638..000000000
Binary files a/2017/Day15/input.in and /dev/null differ
diff --git a/2017/Day15/input.refout b/2017/Day15/input.refout
deleted file mode 100644
index 18c95fe29..000000000
--- a/2017/Day15/input.refout
+++ /dev/null
@@ -1,2 +0,0 @@
-569
-298
\ No newline at end of file
diff --git a/2017/Day16/README.md b/2017/Day16/README.md
deleted file mode 100644
index 5fea82b4c..000000000
--- a/2017/Day16/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-## --- Day 16: Permutation Promenade ---
-You come upon a very unusual sight; a group of programs here appear to be [dancing](https://www.youtube.com/watch?v=lyZQPjUT5B4&t=53).
-
-There are sixteen programs in total, named `a` through `p`. They start by standing in a line: `a` stands in position `0`, `b` stands in position `1`, and so on until `p`, which stands in position `15`.
-
-Read the [full puzzle](https://adventofcode.com/2017/day/16).
\ No newline at end of file
diff --git a/2017/Day16/Solution.cs b/2017/Day16/Solution.cs
deleted file mode 100755
index 63f61b27d..000000000
--- a/2017/Day16/Solution.cs
+++ /dev/null
@@ -1,85 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text.RegularExpressions;
-
-namespace AdventOfCode.Y2017.Day16;
-
-[ProblemName("Permutation Promenade")]
-class Solution : Solver {
-
- public object PartOne(string input) {
- return ParseStep(input)("abcdefghijklmnop");
- }
-
- public object PartTwo(string input) {
- var step = ParseStep(input);
- var startState = "abcdefghijklmnop";
-
- var mod = Mod(step, startState);
-
- var state = startState;
- for (int i = 0; i < 1000000000 % mod; i++) {
- state = step(state);
- }
- return state;
- }
-
- int Mod(Func step, string startState) {
- var state = startState;
- for (int i = 0; ; i++) {
- state = step(state);
- if (startState == state) {
- return i + 1;
- }
- }
- }
-
- Func ParseStep(string input) {
- var moves = (
- from stm in input.Split(',')
- select
- ParseMove(stm, "s([0-9]+)", m => {
- int n = int.Parse(m[0]);
- return (order) => {
- return order.Skip(order.Count - n).Concat(order.Take(order.Count - n)).ToList();
- };
- }) ??
- ParseMove(stm, "x([0-9]+)/([0-9]+)", m => {
- int idx1 = int.Parse(m[0]);
- int idx2 = int.Parse(m[1]);
- return (order) => {
- (order[idx1], order[idx2]) = (order[idx2], order[idx1]);
- return order;
- };
- }) ??
- ParseMove(stm, "p([a-z])/([a-z])", m => {
- var (c1, c2) = (m[0].Single(), m[1].Single());
- return order => {
- var (idx1, idx2) = (order.IndexOf(c1), order.IndexOf(c2));
- order[idx1] = c2;
- order[idx2] = c1;
- return order;
- };
- }) ??
- throw new Exception("Cannot parse " + stm)
- ).ToArray();
-
- return startOrder => {
- var order = startOrder.ToList();
- foreach (var move in moves) {
- order = move(order);
- }
- return string.Join("", order);
- };
- }
-
- Func, List> ParseMove(string stm, string pattern, Func, List>> a) {
- var match = Regex.Match(stm , pattern);
- if (match.Success) {
- return a(match.Groups.Cast().Skip(1).Select(g => g.Value).ToArray());
- } else {
- return null;
- }
- }
-}
diff --git a/2017/Day16/input.in b/2017/Day16/input.in
deleted file mode 100644
index bca792491..000000000
Binary files a/2017/Day16/input.in and /dev/null differ
diff --git a/2017/Day16/input.refout b/2017/Day16/input.refout
deleted file mode 100644
index 79267ff33..000000000
--- a/2017/Day16/input.refout
+++ /dev/null
@@ -1,2 +0,0 @@
-kpfonjglcibaedhm
-odiabmplhfgjcekn
diff --git a/2017/Day17/README.md b/2017/Day17/README.md
deleted file mode 100755
index 470b36a6a..000000000
--- a/2017/Day17/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-## --- Day 17: Spinlock ---
-Suddenly, whirling in the distance, you notice what looks like a massive, pixelated hurricane: a deadly [spinlock](https://en.wikipedia.org/wiki/Spinlock). This spinlock isn't just consuming computing power, but memory, too; vast, digital mountains are being ripped from the ground and consumed by the vortex.
-
-If you don't move quickly, fixing that printer will be the least of your problems.
-
-Read the [full puzzle](https://adventofcode.com/2017/day/17).
\ No newline at end of file
diff --git a/2017/Day17/Solution.cs b/2017/Day17/Solution.cs
deleted file mode 100755
index c42b6b19e..000000000
--- a/2017/Day17/Solution.cs
+++ /dev/null
@@ -1,33 +0,0 @@
-using System.Collections.Generic;
-
-namespace AdventOfCode.Y2017.Day17;
-
-[ProblemName("Spinlock")]
-class Solution : Solver {
-
- public object PartOne(string input) {
- var step = int.Parse(input);
- var nums = new List() { 0 };
- var pos = 0;
- for (int i = 1; i < 2018; i++) {
- pos = (pos + step) % nums.Count + 1;
- nums.Insert(pos, i);
- }
- return nums[(pos + 1) % nums.Count];
- }
-
- public object PartTwo(string input) {
- var step = int.Parse(input);
- var pos = 0;
- var numsCount = 1;
- var res = 0;
- for (int i = 1; i < 50000001; i++) {
- pos = (pos + step) % numsCount + 1;
- if (pos == 1) {
- res = i;
- }
- numsCount++;
- }
- return res;
- }
-}
diff --git a/2017/Day17/input.in b/2017/Day17/input.in
deleted file mode 100755
index 680907958..000000000
Binary files a/2017/Day17/input.in and /dev/null differ
diff --git a/2017/Day17/input.refout b/2017/Day17/input.refout
deleted file mode 100644
index 12e438148..000000000
--- a/2017/Day17/input.refout
+++ /dev/null
@@ -1,2 +0,0 @@
-180
-13326437
diff --git a/2017/Day18/README.md b/2017/Day18/README.md
deleted file mode 100755
index 5dad72bb5..000000000
--- a/2017/Day18/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-## --- Day 18: Duet ---
-You discover a tablet containing some strange assembly code labeled simply "[Duet](https://en.wikipedia.org/wiki/Duet)". Rather than bother the sound card with it, you decide to run the code yourself. Unfortunately, you don't see any documentation, so you're left to figure out what the instructions mean on your own.
-
-It seems like the assembly is meant to operate on a set of *registers* that are each named with a single letter and that can each hold a single [integer](https://en.wikipedia.org/wiki/Integer). You suppose each register should start with a value of `0`.
-
-Read the [full puzzle](https://adventofcode.com/2017/day/18).
\ No newline at end of file
diff --git a/2017/Day18/Solution.cs b/2017/Day18/Solution.cs
deleted file mode 100755
index 39ad1db6e..000000000
--- a/2017/Day18/Solution.cs
+++ /dev/null
@@ -1,151 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-
-namespace AdventOfCode.Y2017.Day18;
-
-[ProblemName("Duet")]
-class Solution : Solver {
-
- public object PartOne(string input) =>
- new Machine1()
- .Execute(input)
- .First(received => received != null).Value;
-
- public object PartTwo(string input) {
- var p0Input = new Queue();
- var p1Input = new Queue();
-
- return Enumerable
- .Zip(
- new Machine2(0, p0Input, p1Input).Execute(input),
- new Machine2(1, p1Input, p0Input).Execute(input),
- (state0, state1) => (state0: state0, state1: state1))
- .First(x => !x.state0.running && !x.state1.running)
- .state1.valueSent;
- }
-}
-
-abstract class Machine {
- private Dictionary regs = new Dictionary();
-
- protected bool running;
- protected int ip = 0;
- protected long this[string reg] {
- get {
- return long.TryParse(reg, out var n) ? n
- : regs.ContainsKey(reg) ? regs[reg]
- : 0;
- }
- set {
- regs[reg] = value;
- }
- }
-
- public IEnumerable Execute(string input) {
- var prog = input.Split('\n').ToArray();
-
- while (ip >= 0 && ip < prog.Length) {
- running = true;
- var line = prog[ip];
- var parts = line.Split(' ');
- switch (parts[0]) {
- case "snd": snd(parts[1]); break;
- case "rcv": rcv(parts[1]); break;
- case "set": set(parts[1], parts[2]); break;
- case "add": add(parts[1], parts[2]); break;
- case "mul": mul(parts[1], parts[2]); break;
- case "mod": mod(parts[1], parts[2]); break;
- case "jgz": jgz(parts[1], parts[2]); break;
- default: throw new Exception("Cannot parse " + line);
- }
- yield return State();
- }
-
- running = false;
- yield return State();
- }
-
- protected abstract TState State();
-
- protected abstract void snd(string reg);
-
- protected abstract void rcv(string reg);
-
- protected void set(string reg0, string reg1) {
- this[reg0] = this[reg1];
- ip++;
- }
-
- protected void add(string reg0, string reg1) {
- this[reg0] += this[reg1];
- ip++;
- }
-
- protected void mul(string reg0, string reg1) {
- this[reg0] *= this[reg1];
- ip++;
- }
-
- protected void mod(string reg0, string reg1) {
- this[reg0] %= this[reg1];
- ip++;
- }
-
- protected void jgz(string reg0, string reg1) {
- ip += this[reg0] > 0 ? (int)this[reg1] : 1;
- }
-}
-
-class Machine1 : Machine {
- private long? sent = null;
- private long? received = null;
-
- protected override long? State() {
- return received;
- }
-
- protected override void snd(string reg) {
- sent = this[reg];
- ip++;
- }
-
- protected override void rcv(string reg) {
- if (this[reg] != 0) {
- received = sent;
- }
- ip++;
- }
-
-}
-
-class Machine2 : Machine<(bool running, int valueSent)> {
- private int valueSent = 0;
- private Queue qIn;
- private Queue qOut;
-
- public Machine2(long p, Queue qIn, Queue qOut) {
- this["p"] = p;
- this.qIn = qIn;
- this.qOut = qOut;
- }
-
- protected override (bool running, int valueSent) State() {
- return (running: running, valueSent: valueSent);
- }
-
- protected override void snd(string reg) {
- qOut.Enqueue(this[reg]);
- valueSent++;
- ip++;
- }
-
- protected override void rcv(string reg) {
- if (qIn.Any()) {
- this[reg] = qIn.Dequeue();
- ip++;
- } else {
- running = false;
- }
- }
-}
diff --git a/2017/Day18/input.in b/2017/Day18/input.in
deleted file mode 100755
index d009c685d..000000000
Binary files a/2017/Day18/input.in and /dev/null differ
diff --git a/2017/Day18/input.refout b/2017/Day18/input.refout
deleted file mode 100644
index 40344ddc6..000000000
--- a/2017/Day18/input.refout
+++ /dev/null
@@ -1,2 +0,0 @@
-9423
-7620
diff --git a/2017/Day19/README.md b/2017/Day19/README.md
deleted file mode 100644
index 51bf41e1f..000000000
--- a/2017/Day19/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-## --- Day 19: A Series of Tubes ---
-Somehow, a network packet got lost and ended up here. It's trying to follow a routing diagram (your puzzle input), but it's confused about where to go.
-
-Its starting point is just off the top of the diagram. Lines (drawn with `|`, `-`, and `+`) show the path it needs to take, starting by going down onto the only line connected to the top of the diagram. It needs to follow this path until it reaches the end (located somewhere within the diagram) and stop there.
-
-Read the [full puzzle](https://adventofcode.com/2017/day/19).
\ No newline at end of file
diff --git a/2017/Day19/Solution.cs b/2017/Day19/Solution.cs
deleted file mode 100644
index e2a072db4..000000000
--- a/2017/Day19/Solution.cs
+++ /dev/null
@@ -1,47 +0,0 @@
-using System.Linq;
-
-namespace AdventOfCode.Y2017.Day19;
-
-[ProblemName("A Series of Tubes")]
-class Solution : Solver {
-
- public object PartOne(string input) => FollowPath(input).msg;
-
- public object PartTwo(string input) => FollowPath(input).steps;
-
- (string msg, int steps) FollowPath(string input){
- var map = input.Split('\n');
- var (ccol, crow) = (map[0].Length, map.Length);
- var (icol, irow) = (map[0].IndexOf('|'), 0);
- var (dcol, drow) = (0, 1);
-
- var msg = "";
- var steps = 0;
-
- while (true) {
- irow += drow;
- icol += dcol;
- steps++;
-
- if (icol < 0 || icol >= ccol || irow < 0 || irow >= crow || map[irow][icol] == ' ') {
- break;
- }
-
- switch (map[irow][icol]) {
- case '+':
- (dcol, drow) = (
- from q in new[] { (drow: dcol, dcol: -drow), (drow: -dcol, dcol: drow)}
- let icolT = icol + q.dcol
- let irowT = irow + q.drow
- where icolT >= 0 && icolT < ccol && irowT >= 0 && irowT < crow && map[irowT][icolT] != ' '
- select (q.dcol, q.drow)
- ).Single();
- break;
- case char ch when (ch >= 'A' && ch <= 'Z'):
- msg += ch;
- break;
- }
- }
- return (msg, steps);
- }
-}
diff --git a/2017/Day19/input.in b/2017/Day19/input.in
deleted file mode 100644
index 5dff2031d..000000000
Binary files a/2017/Day19/input.in and /dev/null differ
diff --git a/2017/Day19/input.refout b/2017/Day19/input.refout
deleted file mode 100644
index 93bf8246c..000000000
--- a/2017/Day19/input.refout
+++ /dev/null
@@ -1,2 +0,0 @@
-RUEDAHWKSM
-17264
diff --git a/2017/Day20/README.md b/2017/Day20/README.md
deleted file mode 100644
index 5f187c427..000000000
--- a/2017/Day20/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-## --- Day 20: Particle Swarm ---
-Suddenly, the GPU contacts you, asking for help. Someone has asked it to simulate *too many particles*, and it won't be able to finish them all in time to render the next frame at this rate.
-
-It transmits to you a buffer (your puzzle input) listing each particle in order (starting with particle `0`, then particle `1`, particle `2`, and so on). For each particle, it provides the `X`, `Y`, and `Z` coordinates for the particle's position (`p`), velocity (`v`), and acceleration (`a`), each in the format ``.
-
-Read the [full puzzle](https://adventofcode.com/2017/day/20).
\ No newline at end of file
diff --git a/2017/Day20/Solution.cs b/2017/Day20/Solution.cs
deleted file mode 100644
index 30382587f..000000000
--- a/2017/Day20/Solution.cs
+++ /dev/null
@@ -1,142 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text.RegularExpressions;
-
-namespace AdventOfCode.Y2017.Day20;
-
-[ProblemName("Particle Swarm")]
-class Solution : Solver {
-
- public object PartOne(string input) {
- var particles = Parse(input);
- return (
- from particle in particles
- orderby particle.acc.Len(), particle.vel.Len(), particle.pos.Len()
- select particle
- ).First().i;
- }
-
- public object PartTwo(string input) {
- var particles = Parse(input);
- var collisionTimes = (
- from p1 in particles
- from p2 in particles
- where p1.i != p2.i
- from collisionTime in p1.CollisionTime(p2)
- select collisionTime
- ).ToArray();
- var T = collisionTimes.Max();
-
- var t = 0;
- while (t <= T) {
- var particlesByPos = (from particle in particles orderby particle.pos.x, particle.pos.y, particle.pos.z select particle).ToArray();
-
- var particlePrev = particlesByPos[0];
-
- for (int i = 1; i < particlesByPos.Length; i++) {
- var particle = particlesByPos[i];
- if (particlePrev.pos.x == particle.pos.x && particlePrev.pos.y == particle.pos.y && particlePrev.pos.z == particle.pos.z) {
- particlePrev.destroyed = true;
- particle.destroyed = true;
- }
- particlePrev = particle;
- }
-
- if (particles.Any(p => p.destroyed)) {
- particles = particles.Where(particle => !particle.destroyed).ToList();
- }
-
- foreach (var particle in particles) {
- particle.Step();
- }
-
- t++;
- }
- return particles.Count;
- }
-
-
- List Parse(string input) {
- var lines = input.Split('\n');
- return (
- from q in Enumerable.Zip(lines, Enumerable.Range(0, int.MaxValue), (line, i) => (i: i, line: line))
- let nums = Regex.Matches(q.line, "-?[0-9]+").Select(m => int.Parse(m.Value)).ToArray()
- let p = new Point(nums[0], nums[1], nums[2])
- let v = new Point(nums[3], nums[4], nums[5])
- let a = new Point(nums[6], nums[7], nums[8])
- select new Particle(q.i, p, v, a))
- .ToList();
- }
-}
-
-class Point {
- public int x;
- public int y;
- public int z;
-
- public int Len() => Math.Abs(x) + Math.Abs(y) + Math.Abs(z);
-
- public Point(int x, int y, int z) {
- this.x = x;
- this.y = y;
- this.z = z;
- }
-}
-
-class Particle {
- public int i;
- public Point pos;
- public Point vel;
- public Point acc;
-
- public bool destroyed = false;
-
- public Particle(int i, Point pos, Point vel, Point acc) {
- this.i = i;
- this.pos = pos;
- this.vel = vel;
- this.acc = acc;
- }
-
- public void Step() {
- (vel.x, vel.y, vel.z) = (vel.x + acc.x, vel.y + acc.y, vel.z + acc.z);
- (pos.x, pos.y, pos.z) = (pos.x + vel.x, pos.y + vel.y, pos.z + vel.z);
- }
-
- public IEnumerable CollisionTime(Particle particle) {
- return
- from tx in CollisionTimeOnAxis(particle.acc.x - acc.x, particle.vel.x - vel.x, particle.pos.x - pos.x)
- from ty in CollisionTimeOnAxis(particle.acc.y - acc.y, particle.vel.y - vel.y, particle.pos.y - pos.y)
- from tz in CollisionTimeOnAxis(particle.acc.z - acc.x, particle.vel.z - vel.z, particle.pos.z - pos.z)
- where tx == ty && ty == tz
- select (tx);
- }
-
- private IEnumerable CollisionTimeOnAxis(int da, int dv, int dp) =>
- SolveIntEq(da / 2, dv, dp);
-
- private IEnumerable SolveIntEq(int a, int b, int c) {
- if (a == 0) {
- if (b == 0) {
- if (c == 0) {
- yield return 0;
- }
- } else {
- yield return -c / b;
- }
- } else {
- var d = b * b - 4 * a * c;
- if (d == 0) {
- yield return -b / (2 * a);
- } else if (d > 0) {
- var ds = Math.Sqrt(d);
- if (ds * ds == d) {
- yield return (int)((-b + ds) / (2 * a));
- yield return (int)((-b - ds) / (2 * a));
- }
-
- }
- }
- }
-}
diff --git a/2017/Day20/input.in b/2017/Day20/input.in
deleted file mode 100644
index 7c61f4550..000000000
Binary files a/2017/Day20/input.in and /dev/null differ
diff --git a/2017/Day20/input.refout b/2017/Day20/input.refout
deleted file mode 100644
index ee3ee6635..000000000
--- a/2017/Day20/input.refout
+++ /dev/null
@@ -1,2 +0,0 @@
-457
-448
diff --git a/2017/Day21/README.md b/2017/Day21/README.md
deleted file mode 100644
index e949862b9..000000000
--- a/2017/Day21/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-## --- Day 21: Fractal Art ---
-You find a program trying to generate some art. It uses a strange process that involves repeatedly enhancing the detail of an image through a set of rules.
-
-The image consists of a two-dimensional square grid of pixels that are either on (`#`) or off (`.`). The program always begins with this pattern:
-
-Read the [full puzzle](https://adventofcode.com/2017/day/21).
\ No newline at end of file
diff --git a/2017/Day21/Solution.cs b/2017/Day21/Solution.cs
deleted file mode 100644
index 7ae2b8378..000000000
--- a/2017/Day21/Solution.cs
+++ /dev/null
@@ -1,197 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Text.RegularExpressions;
-
-namespace AdventOfCode.Y2017.Day21;
-
-[ProblemName("Fractal Art")]
-class Solution : Solver {
-
- public object PartOne(string input) => Iterate(input, 5);
-
- public object PartTwo(string input) => Iterate(input, 18);
-
- int Iterate(string input, int iterations) {
- var mtx = Mtx.FromString(".#./..#/###");
- var ruleset = new RuleSet(input);
- for (var i = 0; i < iterations; i++) {
- mtx = ruleset.Apply(mtx);
- }
- return mtx.Count();
- }
-}
-
-class RuleSet {
- private Dictionary rules2;
- private Dictionary rules3;
-
- public RuleSet(string input) {
- rules2 = new Dictionary();
- rules3 = new Dictionary();
-
- foreach (var line in input.Split('\n')) {
- var parts = Regex.Split(line, " => ");
- var left = parts[0];
- var right = parts[1];
- var rules =
- left.Length == 5 ? rules2 :
- left.Length == 11 ? rules3 :
- throw new Exception();
- foreach (var mtx in Variations(Mtx.FromString(left))) {
- rules[mtx.CodeNumber] = Mtx.FromString(right);
- }
- }
- }
-
- public Mtx Apply(Mtx mtx) {
- return Mtx.Join((
- from child in mtx.Split()
- select
- child.Size == 2 ? rules2[child.CodeNumber] :
- child.Size == 3 ? rules3[child.CodeNumber] :
- null
- ).ToArray());
- }
-
- IEnumerable Variations(Mtx mtx) {
- for (int j = 0; j < 2; j++) {
- for (int i = 0; i < 4; i++) {
- yield return mtx;
- mtx = mtx.Rotate();
- }
- mtx = mtx.Flip();
- }
- }
-}
-
-class Mtx {
- private bool[] flags;
-
- public int Size {
- get;
- private set;
- }
-
- public int CodeNumber {
- get {
- if (Size != 2 && Size != 3) {
- throw new ArgumentException();
- }
- var i = 0;
- for (int irow = 0; irow < Size; irow++) {
- for (int icol = 0; icol < Size; icol++) {
- if (this[irow, icol]) {
- i |= (1 << (irow * Size + icol));
- }
- }
- }
- return i;
- }
- }
-
- public Mtx(int size) {
- this.flags = new bool[size * size];
- this.Size = size;
- }
-
- public static Mtx FromString(string st) {
- st = st.Replace("/", "");
- var size = (int)Math.Sqrt(st.Length);
- var res = new Mtx(size);
- for (int i = 0; i < st.Length; i++) {
- res[i / size, i % size] = st[i] == '#';
- }
- return res;
- }
-
- public static Mtx Join(Mtx[] rgmtx) {
- var mtxPerRow = (int)Math.Sqrt(rgmtx.Length);
- var res = new Mtx(mtxPerRow * rgmtx[0].Size);
- for (int imtx = 0; imtx < rgmtx.Length; imtx++) {
- var mtx = rgmtx[imtx];
- for (int irow = 0; irow < mtx.Size; irow++) {
- for (int icol = 0; icol < mtx.Size; icol++) {
- var irowRes = (imtx / mtxPerRow) * mtx.Size + irow;
- var icolRes = (imtx % mtxPerRow) * mtx.Size + icol;
- res[irowRes, icolRes] = mtx[irow, icol];
- }
- }
- }
-
- return res;
- }
-
- public IEnumerable Split() {
-
- var blockSize =
- Size % 2 == 0 ? 2 :
- Size % 3 == 0 ? 3 :
- throw new Exception();
-
- for (int irow = 0; irow < Size; irow += blockSize) {
- for (int icol = 0; icol < Size; icol += blockSize) {
- var mtx = new Mtx(blockSize);
- for (int drow = 0; drow < blockSize; drow++) {
- for (int dcol = 0; dcol < blockSize; dcol++) {
- mtx[drow, dcol] = this[irow + drow, icol + dcol];
- }
- }
- yield return mtx;
- }
- }
- }
-
- public Mtx Flip() {
- var res = new Mtx(this.Size);
- for (int irow = 0; irow < Size; irow++) {
- for (int icol = 0; icol < Size; icol++) {
- res[irow, Size - icol - 1] = this[irow, icol];
- }
- }
- return res;
- }
-
- public Mtx Rotate() {
- var res = new Mtx(this.Size);
- for (int i = 0; i < Size; i++) {
- for (int j = 0; j < Size; j++) {
- res[i, j] = this[j, Size - i - 1];
- }
- }
- return res;
- }
-
- public int Count() {
- var count = 0;
- for (int irow = 0; irow < Size; irow++) {
- for (int icol = 0; icol < Size; icol++) {
- if (this[irow, icol]) {
- count++;
- }
- }
- }
- return count;
- }
-
- public override string ToString() {
- var sb = new StringBuilder();
- for (int irow = 0; irow < Size; irow++) {
- for (int icol = 0; icol < Size; icol++) {
- sb.Append(this[irow, icol] ? "#" : ".");
- }
- sb.AppendLine();
- }
- return sb.ToString();
- }
-
- private bool this[int irow, int icol] {
- get {
- return flags[(Size * irow) + icol];
- }
- set {
- flags[(Size * irow) + icol] = value;
- }
- }
-}
diff --git a/2017/Day21/input.in b/2017/Day21/input.in
deleted file mode 100644
index 8ef156364..000000000
Binary files a/2017/Day21/input.in and /dev/null differ
diff --git a/2017/Day21/input.refout b/2017/Day21/input.refout
deleted file mode 100644
index 2e78b4052..000000000
--- a/2017/Day21/input.refout
+++ /dev/null
@@ -1,2 +0,0 @@
-147
-1936582
diff --git a/2017/Day22/README.md b/2017/Day22/README.md
deleted file mode 100644
index 8355477fd..000000000
--- a/2017/Day22/README.md
+++ /dev/null
@@ -1,5 +0,0 @@
-## --- Day 22: Sporifica Virus ---
-
-Diagnostics indicate that the local *grid computing cluster* has been contaminated with the *Sporifica Virus*. The grid computing cluster is a seemingly-infinite two-dimensional grid of compute nodes. Each node is either *clean* or *infected* by the virus.
-
-Read the [full puzzle](https://adventofcode.com/2017/day/22).
\ No newline at end of file
diff --git a/2017/Day22/Solution.cs b/2017/Day22/Solution.cs
deleted file mode 100644
index 9494c0bf2..000000000
--- a/2017/Day22/Solution.cs
+++ /dev/null
@@ -1,71 +0,0 @@
-using System;
-using System.Collections.Generic;
-
-namespace AdventOfCode.Y2017.Day22;
-
-enum State {
- Clean,
- Weakened,
- Infected,
- Flagged
-}
-
-[ProblemName("Sporifica Virus")]
-class Solution : Solver {
-
- public object PartOne(string input) =>
- Iterate(input, 10000,
- (state, drow, dcol) =>
- state switch {
- State.Clean => (State.Infected, -dcol, drow),
- State.Infected => (State.Clean, dcol, -drow),
- _ => throw new ArgumentException()
- }
- );
-
- public object PartTwo(string input) =>
- Iterate(input, 10000000,
- (state, drow, dcol) =>
- state switch {
- State.Clean => (State.Weakened, -dcol, drow),
- State.Weakened => (State.Infected, drow, dcol),
- State.Infected => (State.Flagged, dcol, -drow),
- State.Flagged => (State.Clean, -drow, -dcol),
- _ => throw new ArgumentException()
- }
- );
-
-
- int Iterate(string input, int iterations, Func update) {
- var lines = input.Split('\n');
- var crow = lines.Length;
- var ccol = lines[0].Length;
- var cells = new Dictionary<(int irow, int icol), State>();
- for (int irowT = 0; irowT < crow; irowT++) {
- for (int icolT = 0; icolT < ccol; icolT++) {
- if (lines[irowT][icolT] == '#') {
- cells.Add((irowT, icolT), State.Infected);
- }
- }
- }
- var (irow, icol) = (crow / 2, ccol / 2);
- var (drow, dcol) = (-1, 0);
- var infections = 0;
- for (int i = 0; i < iterations; i++) {
- var state = cells.TryGetValue((irow, icol), out var s) ? s : State.Clean;
-
- (state, drow, dcol) = update(state, drow, dcol);
-
- if (state == State.Infected) {
- infections++;
- }
- if (state == State.Clean) {
- cells.Remove((irow, icol));
- } else {
- cells[(irow, icol)] = state;
- }
- (irow, icol) = (irow + drow, icol + dcol);
- }
- return infections;
- }
-}
diff --git a/2017/Day22/input.in b/2017/Day22/input.in
deleted file mode 100644
index 51ee69ad2..000000000
Binary files a/2017/Day22/input.in and /dev/null differ
diff --git a/2017/Day22/input.refout b/2017/Day22/input.refout
deleted file mode 100644
index 7bb50aedd..000000000
--- a/2017/Day22/input.refout
+++ /dev/null
@@ -1,2 +0,0 @@
-5406
-2511640
\ No newline at end of file
diff --git a/2017/Day23/README.md b/2017/Day23/README.md
deleted file mode 100644
index 67204d7f4..000000000
--- a/2017/Day23/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-## --- Day 23: Coprocessor Conflagration ---
-You decide to head directly to the CPU and fix the printer from there. As you get close, you find an *experimental coprocessor* doing so much work that the local programs are afraid it will [halt and catch fire](https://en.wikipedia.org/wiki/Halt_and_Catch_Fire). This would cause serious issues for the rest of the computer, so you head in and see what you can do.
-
-The code it's running seems to be a variant of the kind you saw recently on that [tablet](18). The general functionality seems *very similar*, but some of the instructions are different:
-
-Read the [full puzzle](https://adventofcode.com/2017/day/23).
\ No newline at end of file
diff --git a/2017/Day23/Solution.cs b/2017/Day23/Solution.cs
deleted file mode 100644
index 248f520fc..000000000
--- a/2017/Day23/Solution.cs
+++ /dev/null
@@ -1,66 +0,0 @@
-using System;
-using System.Collections.Generic;
-
-namespace AdventOfCode.Y2017.Day23;
-
-[ProblemName("Coprocessor Conflagration")]
-class Solution : Solver {
-
- public object PartOne(string input) {
- var regs = new Dictionary();
- int ip = 0;
- int getReg(string reg) {
- return int.TryParse(reg, out var n) ? n
- : regs.ContainsKey(reg) ? regs[reg]
- : 0;
- }
- void setReg(string reg, int value) {
- regs[reg] = value;
- }
-
- var prog = input.Split('\n');
- var mulCount = 0;
- while (ip >= 0 && ip < prog.Length) {
- var line = prog[ip];
- var parts = line.Split(' ');
- switch (parts[0]) {
- case "set":
- setReg(parts[1], getReg(parts[2]));
- ip++;
- break;
- case "sub":
- setReg(parts[1], getReg(parts[1]) - getReg(parts[2]));
- ip++;
- break;
- case "mul":
- mulCount++;
- setReg(parts[1], getReg(parts[1]) * getReg(parts[2]));
- ip++;
- break;
- case "jnz":
- ip += getReg(parts[1]) != 0 ? getReg(parts[2]) : 1;
- break;
- default: throw new Exception("Cannot parse " + line);
- }
- }
- return mulCount;
- }
-
- public object PartTwo(string input) {
- var c = 0;
- for (int b = 107900; b <= 124900; b += 17) {
- if (!IsPrime(b)) {
- c++;
- }
- }
- return c;
- }
-
- bool IsPrime(int n) {
- for (int j = 2; j * j <= n; j++) {
- if (n % j == 0) return false;
- }
- return true;
- }
-
-}
diff --git a/2017/Day23/input.in b/2017/Day23/input.in
deleted file mode 100644
index cbf93a8de..000000000
Binary files a/2017/Day23/input.in and /dev/null differ
diff --git a/2017/Day23/input.refout b/2017/Day23/input.refout
deleted file mode 100644
index 3f1ac48b1..000000000
--- a/2017/Day23/input.refout
+++ /dev/null
@@ -1,2 +0,0 @@
-5929
-907
diff --git a/2017/Day24/README.md b/2017/Day24/README.md
deleted file mode 100644
index 78618390a..000000000
--- a/2017/Day24/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-## --- Day 24: Electromagnetic Moat ---
-The CPU itself is a large, black building surrounded by a bottomless pit. Enormous metal tubes extend outward from the side of the building at regular intervals and descend down into the void. There's no way to cross, but you need to get inside.
-
-No way, of course, other than building a *bridge* out of the magnetic components strewn about nearby.
-
-Read the [full puzzle](https://adventofcode.com/2017/day/24).
\ No newline at end of file
diff --git a/2017/Day24/Solution.cs b/2017/Day24/Solution.cs
deleted file mode 100644
index d546441d2..000000000
--- a/2017/Day24/Solution.cs
+++ /dev/null
@@ -1,49 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-
-namespace AdventOfCode.Y2017.Day24;
-
-[ProblemName("Electromagnetic Moat")]
-class Solution : Solver {
-
- public object PartOne(string input) => StrongestBridge(input, (a, b) => a.strength - b.strength);
- public object PartTwo(string input) => StrongestBridge(input, (a, b) => a.CompareTo(b));
-
- int StrongestBridge(string input, Func<(int length, int strength), (int length, int strength), int> compare) {
-
- (int length, int strength) fold(int pinIn, HashSet components) {
- var strongest = (0, 0);
- foreach (var component in components.ToList()) {
- var pinOut =
- pinIn == component.pinA ? component.pinB :
- pinIn == component.pinB ? component.pinA :
- -1;
-
- if (pinOut != -1) {
- components.Remove(component);
- var curr = fold(pinOut, components);
- (curr.length, curr.strength) = (curr.length + 1, curr.strength + component.pinA + component.pinB);
- strongest = compare(curr, strongest) > 0 ? curr : strongest;
- components.Add(component);
- }
- }
- return strongest;
- }
- return fold(0, Parse(input)).strength;
- }
-
- HashSet Parse(string input) {
- var components = new HashSet();
- foreach (var line in input.Split('\n')) {
- var parts = line.Split('/');
- components.Add(new Component { pinA = int.Parse(parts[0]), pinB = int.Parse(parts[1]) });
- }
- return components;
- }
-}
-
-class Component {
- public int pinA;
- public int pinB;
-}
diff --git a/2017/Day24/input.in b/2017/Day24/input.in
deleted file mode 100644
index 1309fea11..000000000
Binary files a/2017/Day24/input.in and /dev/null differ
diff --git a/2017/Day24/input.refout b/2017/Day24/input.refout
deleted file mode 100644
index cf8455bc6..000000000
--- a/2017/Day24/input.refout
+++ /dev/null
@@ -1,2 +0,0 @@
-1859
-1799
diff --git a/2017/Day25/README.md b/2017/Day25/README.md
deleted file mode 100644
index 301a86bc7..000000000
--- a/2017/Day25/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-## --- Day 25: The Halting Problem ---
-Following the twisty passageways deeper and deeper into the CPU, you finally reach the core of the computer. Here, in the expansive central chamber, you find a grand apparatus that fills the entire room, suspended nanometers above your head.
-
-You had always imagined CPUs to be noisy, chaotic places, bustling with activity. Instead, the room is quiet, motionless, and dark.
-
-Read the [full puzzle](https://adventofcode.com/2017/day/25).
\ No newline at end of file
diff --git a/2017/Day25/Solution.cs b/2017/Day25/Solution.cs
deleted file mode 100644
index 4b001daeb..000000000
--- a/2017/Day25/Solution.cs
+++ /dev/null
@@ -1,70 +0,0 @@
-using System.Collections.Generic;
-using System.Linq;
-using System.Text.RegularExpressions;
-
-namespace AdventOfCode.Y2017.Day25;
-
-[ProblemName("The Halting Problem")]
-class Solution : Solver {
-
- public object PartOne(string input) {
- var machine = Parse(input);
- var tape = new Dictionary();
- var pos = 0;
- while (machine.iterations > 0) {
- var read = tape.TryGetValue(pos, out var t) ? t : 0;
- var (write, dir, newState) = machine.prg[(machine.state, read)];
- machine.state = newState;
- tape[pos] = write;
- pos += dir;
- machine.iterations--;
- }
- return tape.Select(kvp => kvp.Value).Sum();
- }
-
- Machine Parse(string input) {
- var lines = input.Split('\n').Where(line => !string.IsNullOrEmpty(line)).ToArray();
- int iline = 0;
-
- Machine machine = new Machine();
-
- String(@"Begin in state (\w).", out machine.state);
- Int(@"Perform a diagnostic checksum after (\d+) steps.", out machine.iterations);
-
- while (String(@"In state (\w):", out var state)) {
- while (Int(@"If the current value is (\d):", out var read)) {
- Int(@"- Write the value (\d).", out var write);
- String(@"- Move one slot to the (left|right).", out var dir);
- String(@" - Continue with state (\w).", out string newState);
- machine.prg[(state, read)] = (write, dir == "left" ? -1 : 1, newState);
- }
- }
-
- bool Int(string pattern, out int r) {
- r = 0;
- return String(pattern, out string st) && int.TryParse(st, out r);
- }
-
- bool String(string pattern, out string st) {
- st = null;
- if (iline >= lines.Length) {
- return false;
- }
- var m = Regex.Match(lines[iline], pattern);
- if (m.Success) {
- iline++;
- st = m.Groups[1].Value;
- }
- return m.Success;
- }
-
- return machine;
- }
-}
-
-class Machine {
- public string state;
- public int iterations;
- public Dictionary<(string state, int read), (int write, int dir, string state)> prg =
- new Dictionary<(string, int), (int, int, string)>();
-}
diff --git a/2017/Day25/input.in b/2017/Day25/input.in
deleted file mode 100644
index b0a778b4a..000000000
Binary files a/2017/Day25/input.in and /dev/null differ
diff --git a/2017/Day25/input.refout b/2017/Day25/input.refout
deleted file mode 100644
index 2dcfbdc04..000000000
--- a/2017/Day25/input.refout
+++ /dev/null
@@ -1 +0,0 @@
-2870
diff --git a/2017/README.md b/2017/README.md
deleted file mode 100644
index 33861dcbc..000000000
--- a/2017/README.md
+++ /dev/null
@@ -1,4 +0,0 @@
-# Advent of Code (2017)
-Check out https://adventofcode.com/2017.
-
-
diff --git a/2017/SplashScreen.cs b/2017/SplashScreen.cs
deleted file mode 100644
index fb4ba3fb2..000000000
--- a/2017/SplashScreen.cs
+++ /dev/null
@@ -1,217 +0,0 @@
-using System;
-
-namespace AdventOfCode.Y2017;
-
-class SplashScreenImpl : SplashScreen {
-
- public void Show() {
-
- var color = Console.ForegroundColor;
- Write(0xcc00, false, " ▄█▄ ▄▄█ ▄ ▄ ▄▄▄ ▄▄ ▄█▄ ▄▄▄ ▄█ ▄▄ ▄▄▄ ▄▄█ ▄▄▄\n █▄█ █ █ █ █ █▄█ █ █ █ █ █ █▄ ");
- Write(0xcc00, false, " █ █ █ █ █ █▄█\n █ █ █▄█ ▀▄▀ █▄▄ █ █ █▄ █▄█ █ █▄ █▄█ █▄█ █▄▄ {'year': 2017}\n ");
- Write(0xcc00, false, " \n ");
- Write(0x999999, false, "|O| ");
- Write(0xcccccc, false, " Naughty | Nice ");
- Write(0x999999, false, "|O| \n |O| ");
- Write(0xcccccc, false, "-------------------+------------------- ");
- Write(0x999999, false, "|O| \n |O| ");
- Write(0xcccccc, false, "The Easter Bunny | encse ");
- Write(0x999999, false, "|O| \n |O| ");
- Write(0xcccccc, false, "Martin Galese | Szabolcs Sipos ");
- Write(0x999999, false, "|O| \n |O| ");
- Write(0xcccccc, false, "Balázs Dankó | wesen ");
- Write(0x999999, false, "|O| \n |O| ");
- Write(0xcccccc, false, "Gábor Gyebnár | Daniel Willenson ");
- Write(0x999999, false, "|O| \n |O| ");
- Write(0xcccccc, false, "Woodrow Hedberg | gkatai ");
- Write(0x999999, false, "|O| \n ");
- Write(0xcccccc, false, ".-----------------------------------------------. \n | ");
- Write(0x666666, false, "┌───────────────o┌");
- Write(0xffff66, true, "*");
- Write(0x666666, false, "───────");
- Write(0xaaaaaa, false, "[─]");
- Write(0x666666, false, "────┐o─────────┐ ");
- Write(0xcccccc, false, "| 25 ");
- Write(0xffff66, false, "**\n ");
- Write(0xcccccc, false, "| ");
- Write(0x666666, false, "└──────");
- Write(0x9900, false, "oTo");
- Write(0x666666, false, "───────┘└────");
- Write(0xffff66, true, "*");
- Write(0x666666, false, "┌o┌────┐┌┘┌─────────┤ ");
- Write(0xcccccc, false, "| 24 ");
- Write(0xffff66, false, "**\n ");
- Write(0xcccccc, false, "| ");
- Write(0xffff66, true, "*");
- Write(0x666666, false, "───────────────────");
- Write(0x66ff, false, "|(");
- Write(0x666666, false, "─┘├─┘┌──o└┘┌┴──────┐o─┘ ");
- Write(0xcccccc, false, "| 23 ");
- Write(0xffff66, false, "**\n ");
- Write(0xcccccc, false, "| ");
- Write(0x666666, false, "└───");
- Write(0xff0000, false, "┤|├");
- Write(0x666666, false, "───┬┴┴┴┴┬────");
- Write(0xffff66, true, "*");
- Write(0x666666, false, "┌─o│o─┴─────┴──────o└──┐ ");
- Write(0xcccccc, false, "| 22 ");
- Write(0xffff66, false, "**\n ");
- Write(0xcccccc, false, "| ");
- Write(0xffff66, true, "*");
- Write(0x666666, false, "─");
- Write(0xaaaaaa, false, "[─]");
- Write(0x666666, false, "─");
- Write(0xaaaaaa, false, "[─]");
- Write(0x666666, false, "─┤ DY├────┘└──┴────");
- Write(0xff9900, false, "∧∧∧");
- Write(0x666666, false, "────────────┤ ");
- Write(0xcccccc, false, "| 21 ");
- Write(0xffff66, false, "**\n ");
- Write(0xcccccc, false, "| ");
- Write(0x666666, false, "├─────────┤ EP├─────┐┌──");
- Write(0xff9900, false, "∧∧∧");
- Write(0x666666, false, "──");
- Write(0x990099, false, "┤[]├");
- Write(0x666666, false, "───┐┌─");
- Write(0xffff66, true, "*");
- Write(0x666666, false, "o──┘ ");
- Write(0xcccccc, false, "| 20 ");
- Write(0xffff66, false, "**\n ");
- Write(0xcccccc, false, "| ");
- Write(0x666666, false, "└─────────┤ CT├────┬┘│V┌────┬──────o└┴o└───");
- Write(0xffff66, true, "* ");
- Write(0xcccccc, false, "| 19 ");
- Write(0xffff66, false, "**\n ");
- Write(0xcccccc, false, "| ");
- Write(0x666666, false, "┌─────────┤ RR├o───┘┌┘└┴──o┌┘");
- Write(0xffff66, true, "*");
- Write(0x666666, false, "─────┬┴┴┴┬───┘ ");
- Write(0xcccccc, false, "| 18 ");
- Write(0xffff66, false, "**\n ");
- Write(0xcccccc, false, "| ");
- Write(0x666666, false, "├─────────┤ ├─────┘o┬────┘┌┘┌────┤ 30├───");
- Write(0xffff66, true, "* ");
- Write(0xcccccc, false, "| 17 ");
- Write(0xffff66, false, "**\n ");
- Write(0xcccccc, false, "| ");
- Write(0x666666, false, "│o┬─┐");
- Write(0xffff66, true, "*");
- Write(0x666666, false, "────┼┬┬┬┬┴───");
- Write(0xff9900, false, "∧∧∧");
- Write(0x666666, false, "─┘┌───┐└─┴────┤ 29├┐┌─┘ ");
- Write(0xcccccc, false, "| 16 ");
- Write(0xffff66, false, "**\n ");
- Write(0xcccccc, false, "| ");
- Write(0x666666, false, "└─┘┌┘└───");
- Write(0xffff66, true, "*");
- Write(0x666666, false, "└┬┴┴┴┴┬───────┘o──┴──────┐┤ 83├┘└─┐ ");
- Write(0xcccccc, false, "| 15 ");
- Write(0xffff66, false, "**\n ");
- Write(0xcccccc, false, "| ");
- Write(0x666666, false, "┌──┘┌───o└─┤ ├──┐┌───────");
- Write(0xffff66, true, "*");
- Write(0x666666, false, "o─────┴┤ P6├───┘ ");
- Write(0xcccccc, false, "| 14 ");
- Write(0xffff66, false, "**\n ");
- Write(0xcccccc, false, "| ");
- Write(0x666666, false, "└┬──┘┌─");
- Write(0x9900, false, "oTo");
- Write(0x666666, false, "─┤ ├─o└┘┌─────o└───────┴┬┬┬┴───");
- Write(0xffff66, true, "* ");
- Write(0xcccccc, false, "| 13 ");
- Write(0xffff66, false, "**\n ");
- Write(0xcccccc, false, "| ");
- Write(0x666666, false, "o┘┌──┘┌────┤ v17├────┴─┐");
- Write(0xffff66, true, "*");
- Write(0x666666, false, "──");
- Write(0xaaaaaa, false, "[─]");
- Write(0x666666, false, "─────────┐┌───┤ ");
- Write(0xcccccc, false, "| 12 ");
- Write(0xffff66, false, "**\n ");
- Write(0xcccccc, false, "| ");
- Write(0x666666, false, "┌─┘┌┴┴┴┴┴┬─┴┬┬┬┬┴──");
- Write(0x66ff, false, "|(");
- Write(0x666666, false, "──┘└──────");
- Write(0xffff66, true, "*");
- Write(0x666666, false, "┌─o┌───┘└─┐V│ ");
- Write(0xcccccc, false, "| 11 ");
- Write(0xffff66, false, "**\n ");
- Write(0xcccccc, false, "| ");
- Write(0x666666, false, "└──┤ ├");
- Write(0xffff66, true, "*");
- Write(0x666666, false, "──────");
- Write(0xff9900, false, "∧∧∧");
- Write(0x666666, false, "───────────┘└──┴──────┘└┘ ");
- Write(0xcccccc, false, "| 10 ");
- Write(0xffff66, false, "**\n ");
- Write(0xcccccc, false, "| ");
- Write(0x666666, false, "┌──┤ ├┘┌─────");
- Write(0xff9900, false, "∧∧∧");
- Write(0x666666, false, "───────┐┌───────────────");
- Write(0xffff66, true, "* ");
- Write(0xcccccc, false, "| 9 ");
- Write(0xffff66, false, "**\n ");
- Write(0xcccccc, false, "| ");
- Write(0x666666, false, "└──┤ 5 ├─┴─────o");
- Write(0xffff66, true, "*");
- Write(0x666666, false, "───────┐└┴o┌─────────");
- Write(0x66ff, false, "|(");
- Write(0x666666, false, "──┤ ");
- Write(0xcccccc, false, "| 8 ");
- Write(0xffff66, false, "**\n ");
- Write(0xcccccc, false, "| ");
- Write(0x666666, false, "┌");
- Write(0xffff66, true, "*");
- Write(0x666666, false, "─┤ 1P├────────┘o──");
- Write(0x66ff, false, "|(");
- Write(0x666666, false, "──┴───┘o─────┬─o┌───┘ ");
- Write(0xcccccc, false, "| 7 ");
- Write(0xffff66, false, "**\n ");
- Write(0xcccccc, false, "| ");
- Write(0x666666, false, "│└─┤ 2B├────────────────────────");
- Write(0xffff66, true, "*");
- Write(0x666666, false, "┌─┘┌─┘o──┐ ");
- Write(0xcccccc, false, "| 6 ");
- Write(0xffff66, false, "**\n ");
- Write(0xcccccc, false, "| ");
- Write(0x666666, false, "└──┴┬┬┬┬┬┴───┐┌──o┌──────┐");
- Write(0xffff66, true, "*");
- Write(0x666666, false, "───────┘└──┴─────┘ ");
- Write(0xcccccc, false, "| 5 ");
- Write(0xffff66, false, "**\n ");
- Write(0xcccccc, false, "| ");
- Write(0x666666, false, "V┌───────────┘└───┴───o┌─┘└──────┐┌────────");
- Write(0xffff66, true, "*");
- Write(0x666666, false, "o ");
- Write(0xcccccc, false, "| 4 ");
- Write(0xffff66, false, "**\n ");
- Write(0xcccccc, false, "| ");
- Write(0x666666, false, "└┴───");
- Write(0xff0000, false, "┤|├");
- Write(0x666666, false, "──────────────┐└──┬───o┌─┘└┐");
- Write(0xffff66, true, "*");
- Write(0x666666, false, "─┐┌──┐└┐ ");
- Write(0xcccccc, false, "| 3 ");
- Write(0xffff66, false, "**\n ");
- Write(0xcccccc, false, "| ");
- Write(0x666666, false, "┌─────────────o┌──────┴───┘");
- Write(0xffff66, true, "*");
- Write(0x666666, false, "──┐└───┘└┐│└─┐└─┤ ");
- Write(0xcccccc, false, "| 2 ");
- Write(0xffff66, false, "**\n ");
- Write(0xcccccc, false, "| ");
- Write(0x666666, false, "└──────────────┴─────o");
- Write(0xffff66, true, "*");
- Write(0x666666, false, "────┘o─┴──────┘└──┘o─┘ ");
- Write(0xcccccc, false, "| 1 ");
- Write(0xffff66, false, "**\n ");
- Write(0xcccccc, false, "'-----------------------------------------------' \n \n");
-
- Console.ForegroundColor = color;
- Console.WriteLine();
- }
-
- private static void Write(int rgb, bool bold, string text){
- Console.Write($"\u001b[38;2;{(rgb>>16)&255};{(rgb>>8)&255};{rgb&255}{(bold ? ";1" : "")}m{text}");
- }
-}
\ No newline at end of file
diff --git a/2017/calendar.svg b/2017/calendar.svg
deleted file mode 100644
index 8c532d567..000000000
--- a/2017/calendar.svg
+++ /dev/null
@@ -1,55 +0,0 @@
-
\ No newline at end of file
diff --git a/2018/Day01/README.md b/2018/Day01/README.md
deleted file mode 100644
index 8ccecebb9..000000000
--- a/2018/Day01/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-## --- Day 1: Chronal Calibration ---
-"We've detected some temporal anomalies," one of Santa's Elves at the Temporal Anomaly Research and Detection Instrument Station tells you. She sounded pretty worried when she called you down here. "At 500-year intervals into the past, someone has been changing Santa's history!"
-
-"The good news is that the changes won't propagate to our time stream for another 25 days, and we have a device" - she attaches something to your wrist - "that will let you fix the changes with no such propagation delay. It's configured to send you 500 years further into the past every few days; that was the best we could do on such short notice."
-
-_Visit the website for the full story and [full puzzle](https://adventofcode.com/2018/day/1) description._
diff --git a/2018/Day01/Solution.cs b/2018/Day01/Solution.cs
deleted file mode 100644
index 92e411e5c..000000000
--- a/2018/Day01/Solution.cs
+++ /dev/null
@@ -1,34 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-
-namespace AdventOfCode.Y2018.Day01;
-
-[ProblemName("Chronal Calibration")]
-class Solution : Solver {
-
- public object PartOne(string input) {
- return Frequencies(input).ElementAt(input.Split("\n").Count() - 1);
- }
-
- public object PartTwo(string input) {
- var seen = new HashSet();
- foreach (var f in Frequencies(input)) {
- if (seen.Contains(f)) {
- return f;
- }
- seen.Add(f);
- }
- throw new Exception();
- }
-
- IEnumerable Frequencies(string input) {
- var f = 0;
- while (true) {
- foreach (var d in input.Split("\n").Select(int.Parse)) {
- f += d;
- yield return f;
- }
- }
- }
-}
diff --git a/2018/Day01/input.in b/2018/Day01/input.in
deleted file mode 100644
index 8103c3057..000000000
Binary files a/2018/Day01/input.in and /dev/null differ
diff --git a/2018/Day01/input.refout b/2018/Day01/input.refout
deleted file mode 100644
index 95dce70f7..000000000
--- a/2018/Day01/input.refout
+++ /dev/null
@@ -1,2 +0,0 @@
-490
-70357
\ No newline at end of file
diff --git a/2018/Day02/README.md b/2018/Day02/README.md
deleted file mode 100644
index 920cce933..000000000
--- a/2018/Day02/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-## --- Day 2: Inventory Management System ---
-You stop falling through time, catch your breath, and check the screen on the device. "Destination reached. Current Year: 1518. Current Location: North Pole Utility Closet 83N10." You made it! Now, to find those anomalies.
-
-Outside the utility closet, you hear footsteps and a voice. "...I'm not sure either. But now that so many people have chimneys, maybe he could sneak in that way?" Another voice responds, "Actually, we've been working on a new kind of *suit* that would let him fit through tight spaces like that. But, I heard that a few days ago, they lost the prototype fabric, the design plans, everything! Nobody on the team can even seem to remember important details of the project!"
-
-Read the [full puzzle](https://adventofcode.com/2018/day/2).
\ No newline at end of file
diff --git a/2018/Day02/Solution.cs b/2018/Day02/Solution.cs
deleted file mode 100644
index c6aaff74c..000000000
--- a/2018/Day02/Solution.cs
+++ /dev/null
@@ -1,48 +0,0 @@
-using System.Linq;
-
-namespace AdventOfCode.Y2018.Day02;
-
-[ProblemName("Inventory Management System")]
-class Solution : Solver {
-
- public object PartOne(string input) {
- var doubles = (
- from line in input.Split("\n")
- where CheckLine(line, 2)
- select line
- ).Count();
- var tripples = (
- from line in input.Split("\n")
- where CheckLine(line, 3)
- select line
- ).Count();
- return doubles * tripples;
- }
-
- bool CheckLine(string line, int n) {
- return (from ch in line
- group ch by ch into g
- select g.Count()).Any(cch => cch == n);
- }
-
- public object PartTwo(string input) {
- var lines = input.Split("\n");
- return (from i in Enumerable.Range(0, lines.Length)
- from j in Enumerable.Range(i + 1, lines.Length - i - 1)
- let line1 = lines[i]
- let line2 = lines[j]
- where Diff(line1, line2) == 1
- select Common(line1, line2)
- ).Single();
- }
-
- int Diff(string line1, string line2) {
- return line1.Zip(line2,
- (chA, chB) => chA == chB
- ).Count(x => x == false);
- }
-
- string Common(string line1, string line2) {
- return string.Join("", line1.Zip(line2, (chA, chB) => chA == chB ? chA.ToString() : ""));
- }
-}
diff --git a/2018/Day02/input.in b/2018/Day02/input.in
deleted file mode 100644
index dc37cf34f..000000000
Binary files a/2018/Day02/input.in and /dev/null differ
diff --git a/2018/Day02/input.refout b/2018/Day02/input.refout
deleted file mode 100644
index a7398df9d..000000000
--- a/2018/Day02/input.refout
+++ /dev/null
@@ -1,2 +0,0 @@
-7808
-efmyhuckqldtwjyvisipargno
diff --git a/2018/Day03/README.md b/2018/Day03/README.md
deleted file mode 100644
index cc4dad2c6..000000000
--- a/2018/Day03/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-## --- Day 3: No Matter How You Slice It ---
-The Elves managed to locate the chimney-squeeze prototype fabric for Santa's suit (thanks to someone who helpfully wrote its box IDs on the wall of the warehouse in the middle of the night). Unfortunately, anomalies are still affecting them - nobody can even agree on how to *cut* the fabric.
-
-The whole piece of fabric they're working on is a very large square - at least `1000` inches on each side.
-
-Read the [full puzzle](https://adventofcode.com/2018/day/3).
\ No newline at end of file
diff --git a/2018/Day03/Solution.cs b/2018/Day03/Solution.cs
deleted file mode 100644
index dc9ed4e4c..000000000
--- a/2018/Day03/Solution.cs
+++ /dev/null
@@ -1,51 +0,0 @@
-using System.Collections.Generic;
-using System.Linq;
-using System.Text.RegularExpressions;
-
-namespace AdventOfCode.Y2018.Day03;
-
-[ProblemName("No Matter How You Slice It")]
-class Solution : Solver {
-
- public object PartOne(string input) => Decorate(input).overlapArea;
-
- public object PartTwo(string input) => Decorate(input).intactId;
-
- (int overlapArea, int intactId) Decorate(string input) {
- // #1 @ 55,885: 22x10
- var rx = new Regex(@"(?\d+) @ (?\d+),(?\d+): (?\d+)x(?\d+)");
- var mtx = new int[1000, 1000];
-
- var overlapArea = 0;
-
- var ids = new HashSet();
- foreach (var line in input.Split("\n")) {
- var parts = rx.Match(line);
- var id = int.Parse(parts.Groups["id"].Value);
- var x = int.Parse(parts.Groups["x"].Value);
- var y = int.Parse(parts.Groups["y"].Value);
- var width = int.Parse(parts.Groups["width"].Value);
- var height = int.Parse(parts.Groups["height"].Value);
-
- ids.Add(id);
-
- for (var i = 0; i < width; i++) {
- for (var j = 0; j < height; j++) {
- if (mtx[x + i, y + j] == 0) {
- mtx[x + i, y + j] = id;
- } else if (mtx[x + i, y + j] == -1) {
- ids.Remove(id);
- } else {
- ids.Remove(mtx[x + i, y + j]);
- ids.Remove(id);
- overlapArea++;
-
- mtx[x + i, y + j] = -1;
- }
- }
- }
- }
-
- return (overlapArea, ids.Single());
- }
-}
diff --git a/2018/Day03/input.in b/2018/Day03/input.in
deleted file mode 100644
index ad9827ff8..000000000
Binary files a/2018/Day03/input.in and /dev/null differ
diff --git a/2018/Day03/input.refout b/2018/Day03/input.refout
deleted file mode 100644
index c43208a7d..000000000
--- a/2018/Day03/input.refout
+++ /dev/null
@@ -1,2 +0,0 @@
-111266
-266
diff --git a/2018/Day04/README.md b/2018/Day04/README.md
deleted file mode 100644
index 043e4e5a5..000000000
--- a/2018/Day04/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-## --- Day 4: Repose Record ---
-You've sneaked into another supply closet - this time, it's across from the prototype suit manufacturing lab. You need to sneak inside and fix the issues with the suit, but there's a guard stationed outside the lab, so this is as close as you can safely get.
-
-As you search the closet for anything that might help, you discover that you're not the first person to want to sneak in. Covering the walls, someone has spent an hour starting every midnight for the past few months secretly observing this guard post! They've been writing down the ID of *the one guard on duty that night* - the Elves seem to have decided that one guard was enough for the overnight shift - as well as when they fall asleep or wake up while at their post (your puzzle input).
-
-Read the [full puzzle](https://adventofcode.com/2018/day/4).
\ No newline at end of file
diff --git a/2018/Day04/Solution.cs b/2018/Day04/Solution.cs
deleted file mode 100644
index a0e68416f..000000000
--- a/2018/Day04/Solution.cs
+++ /dev/null
@@ -1,97 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text.RegularExpressions;
-
-namespace AdventOfCode.Y2018.Day04;
-
-[ProblemName("Repose Record")]
-class Solution : Solver {
-
- public object PartOne(string input) {
- var foo = from day in Parse(input)
- group day by day.guard into g
- select new {
- guard = g.Key,
- totalSleeps = g.Select(day => day.totalSleep).Sum(),
- sleepByMin = Enumerable.Range(0, 60).Select(minT => g.Sum(day => day.sleep[minT])).ToArray()
- };
- var maxSleep = foo.Max(x => x.totalSleeps);
- var fooT = foo.Single(g => g.totalSleeps == maxSleep);
- var maxSleepByMin = Enumerable.Range(0, 60).Max(minT => fooT.sleepByMin[minT]);
- var min = Enumerable.Range(0, 60).Single(minT => fooT.sleepByMin[minT] == maxSleepByMin);
- return fooT.guard * min;
- }
-
- public object PartTwo(string input) {
- var foo = from day in Parse(input)
- group day by day.guard into g
- select new {
- guard = g.Key,
- totalSleeps = g.Select(day => day.totalSleep).Sum(),
- sleepByMin = Enumerable.Range(0, 60).Select(minT => g.Sum(day => day.sleep[minT])).ToArray()
- };
-
- var maxMaxSleep = foo.Max(x => x.sleepByMin.Max());
- var fooT = foo.Single(x => x.sleepByMin.Max() == maxMaxSleep);
- var min = Enumerable.Range(0, 60).Single(minT => fooT.sleepByMin[minT] == maxMaxSleep);
-
- return fooT.guard * min;
- }
-
- IEnumerable Parse(string input) {
- var lines = input.Split("\n").ToList();
- lines.Sort((x, y) => DateTime.Parse(x.Substring(1, "1518-03-25 00:01".Length)).CompareTo(DateTime.Parse(y.Substring(1, "1518-03-25 00:01".Length))));
- var iline = 0;
-
- while (Int(@"Guard #(\d+) begins shift", out var guard)) {
-
- var sleep = new int[60];
- while (Date(@"\[(.*)\] falls asleep", out var fallsAsleap)) {
- Date(@"\[(.*)\] wakes up", out var wakesUp);
-
- var from = fallsAsleap.Hour != 0 ? 0 : fallsAsleap.Minute;
- var to = wakesUp.Hour != 0 ? 0 : wakesUp.Minute;
-
- for (var min = from; min < to; min++) {
- sleep[min] = 1;
- }
- }
-
- yield return new Day() { guard = guard, sleep = sleep };
- }
-
- if (iline != lines.Count) {
- throw new Exception();
- }
- bool Int(string pattern, out int r) {
- r = 0;
- return String(pattern, out string st) && int.TryParse(st, out r);
- }
-
- bool Date(string pattern, out DateTime r) {
- r = DateTime.MinValue;
- return String(pattern, out string st) && DateTime.TryParse(st, out r);
- }
-
- bool String(string pattern, out string st) {
- st = null;
- if (iline >= lines.Count) {
- return false;
- }
- var m = Regex.Match(lines[iline], pattern);
- if (m.Success) {
- iline++;
- st = m.Groups[1].Value;
- }
- return m.Success;
- }
-
- }
-}
-
-class Day {
- public int guard;
- public int[] sleep;
- public int totalSleep => sleep.Sum();
-}
diff --git a/2018/Day04/input.in b/2018/Day04/input.in
deleted file mode 100644
index 3675066b8..000000000
Binary files a/2018/Day04/input.in and /dev/null differ
diff --git a/2018/Day04/input.refout b/2018/Day04/input.refout
deleted file mode 100644
index 569861772..000000000
--- a/2018/Day04/input.refout
+++ /dev/null
@@ -1,2 +0,0 @@
-60438
-47989
diff --git a/2018/Day05/README.md b/2018/Day05/README.md
deleted file mode 100644
index 09a32c2e7..000000000
--- a/2018/Day05/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-## --- Day 5: Alchemical Reduction ---
-You've managed to sneak in to the prototype suit manufacturing lab. The Elves are making decent progress, but are still struggling with the suit's size reduction capabilities.
-
-While the very latest in 1518 alchemical technology might have solved their problem eventually, you can do better. You scan the chemical composition of the suit's material and discover that it is formed by extremely long [polymers](https://en.wikipedia.org/wiki/Polymer) (one of which is available as your puzzle input).
-
-Read the [full puzzle](https://adventofcode.com/2018/day/5).
\ No newline at end of file
diff --git a/2018/Day05/Solution.cs b/2018/Day05/Solution.cs
deleted file mode 100644
index 7d39ca053..000000000
--- a/2018/Day05/Solution.cs
+++ /dev/null
@@ -1,30 +0,0 @@
-using System.Collections.Generic;
-using System.Linq;
-
-namespace AdventOfCode.Y2018.Day05;
-
-[ProblemName("Alchemical Reduction")]
-class Solution : Solver {
-
- public object PartOne(string input) => React(input);
-
- public object PartTwo(string input) => (from ch in "abcdefghijklmnopqrstuvwxyz" select React(input, ch)).Min();
-
- char ToLower(char ch) => ch <= 'Z' ? (char)(ch - 'A' + 'a') : ch;
-
- int React(string input, char? skip = null) {
- var stack = new Stack("⊥");
-
- foreach (var ch in input) {
- var top = stack.Peek();
- if (ToLower(ch) == skip) {
- continue;
- } else if (top != ch && ToLower(ch) == ToLower(top)) {
- stack.Pop();
- } else {
- stack.Push(ch);
- }
- }
- return stack.Count() - 1;
- }
-}
diff --git a/2018/Day05/input.in b/2018/Day05/input.in
deleted file mode 100644
index c23e0782e..000000000
Binary files a/2018/Day05/input.in and /dev/null differ
diff --git a/2018/Day05/input.refout b/2018/Day05/input.refout
deleted file mode 100644
index 43b30d0ec..000000000
--- a/2018/Day05/input.refout
+++ /dev/null
@@ -1,2 +0,0 @@
-10804
-6650
diff --git a/2018/Day06/README.md b/2018/Day06/README.md
deleted file mode 100644
index 47db579bb..000000000
--- a/2018/Day06/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-## --- Day 6: Chronal Coordinates ---
-The device on your wrist beeps several times, and once again you feel like you're falling.
-
-"Situation critical," the device announces. "Destination indeterminate. Chronal interference detected. Please specify new target coordinates."
-
-Read the [full puzzle](https://adventofcode.com/2018/day/6).
\ No newline at end of file
diff --git a/2018/Day06/Solution.cs b/2018/Day06/Solution.cs
deleted file mode 100644
index 5df21bc09..000000000
--- a/2018/Day06/Solution.cs
+++ /dev/null
@@ -1,75 +0,0 @@
-using System;
-using System.Linq;
-
-namespace AdventOfCode.Y2018.Day06;
-
-[ProblemName("Chronal Coordinates")]
-class Solution : Solver {
-
- public object PartOne(string input) {
- var coords = Parse(input);
-
- var minX = coords.Min(coord => coord.x) - 1;
- var maxX = coords.Max(coord => coord.x) + 1;
- var minY = coords.Min(coord => coord.y) - 1;
- var maxY = coords.Max(coord => coord.y) + 1;
-
- var area = new int[coords.Length];
-
- foreach (var x in Enumerable.Range(minX, maxX - minX + 1)) {
- foreach (var y in Enumerable.Range(minY, maxY - minX + 1)) {
- var d = coords.Select(coord => Dist((x, y), coord)).Min();
- var closest = Enumerable.Range(0, coords.Length).Where(i => Dist((x, y), coords[i]) == d).ToArray();
-
- if (closest.Length != 1) {
- continue;
- }
-
- if (x == minX || x == maxX || y == minY || y == maxY) {
- foreach (var icoord in closest) {
- if (area[icoord] != -1) {
- area[icoord] = -1;
- }
- }
- } else {
- foreach (var icoord in closest) {
- if (area[icoord] != -1) {
- area[icoord]++;
- }
- }
- }
- }
- }
- return area.Max();
- }
-
- public object PartTwo(string input) {
- var coords = Parse(input);
-
- var minX = coords.Min(coord => coord.x) - 1;
- var maxX = coords.Max(coord => coord.x) + 1;
- var minY = coords.Min(coord => coord.y) - 1;
- var maxY = coords.Max(coord => coord.y) + 1;
-
- var area = 0;
-
- foreach (var x in Enumerable.Range(minX, maxX - minX + 1)) {
- foreach (var y in Enumerable.Range(minY, maxY - minX + 1)) {
- var d = coords.Select(coord => Dist((x, y), coord)).Sum();
- if (d < 10000)
- area++;
- }
- }
- return area;
- }
-
- int Dist((int x, int y) c1, (int x, int y) c2) {
- return Math.Abs(c1.x - c2.x) + Math.Abs(c1.y - c2.y);
- }
-
- (int x, int y)[] Parse(string input) => (
- from line in input.Split("\n")
- let coords = line.Split(", ").Select(int.Parse).ToArray()
- select (coords[0], coords[1])
- ).ToArray();
-}
diff --git a/2018/Day06/input.in b/2018/Day06/input.in
deleted file mode 100644
index 54e5710fd..000000000
Binary files a/2018/Day06/input.in and /dev/null differ
diff --git a/2018/Day06/input.refout b/2018/Day06/input.refout
deleted file mode 100644
index 8b674ebad..000000000
--- a/2018/Day06/input.refout
+++ /dev/null
@@ -1,2 +0,0 @@
-3969
-42123
diff --git a/2018/Day07/README.md b/2018/Day07/README.md
deleted file mode 100644
index 2dd1cc983..000000000
--- a/2018/Day07/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-## --- Day 7: The Sum of Its Parts ---
-You find yourself standing on a snow-covered coastline; apparently, you landed a little off course. The region is too hilly to see the North Pole from here, but you do spot some Elves that seem to be trying to unpack something that washed ashore. It's quite cold out, so you decide to risk creating a paradox by asking them for directions.
-
-"Oh, are you the search party?" Somehow, you can understand whatever Elves from the year 1018 speak; you assume it's [Ancient Nordic Elvish](/2015/day/6). Could the device on your wrist also be a translator? "Those clothes don't look very warm; take this." They hand you a heavy coat.
-
-Read the [full puzzle](https://adventofcode.com/2018/day/7).
\ No newline at end of file
diff --git a/2018/Day07/Solution.cs b/2018/Day07/Solution.cs
deleted file mode 100644
index ed3ef7c8e..000000000
--- a/2018/Day07/Solution.cs
+++ /dev/null
@@ -1,101 +0,0 @@
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-
-namespace AdventOfCode.Y2018.Day07;
-
-[ProblemName("The Sum of Its Parts")]
-class Solution : Solver {
-
- public object PartOne(string input) {
-
- var sb = new StringBuilder();
- var graph = Parse(input);
- while (graph.Any()) {
- char minKey = char.MaxValue;
- foreach (var key in graph.Keys) {
- if (graph[key].Count == 0) {
- if (key < minKey) {
- minKey = key;
- }
- }
- }
- sb.Append(minKey);
- graph.Remove(minKey);
- foreach (var key in graph.Keys) {
- graph[key].Remove(minKey);
- }
- }
- return sb.ToString();
- }
-
- public object PartTwo(string input) {
- var time = 0;
- var graph = Parse(input);
-
- var works = new int[5];
- var items = new char[works.Length];
-
- while (graph.Any() || works.Any(work => work > 0)) {
- for (var i = 0; i < works.Length && graph.Any(); i++) {
- // start working
- if (works[i] == 0) {
- char minKey = char.MaxValue;
- foreach (var key in graph.Keys) {
- if (graph[key].Count == 0) {
- if (key < minKey) {
- minKey = key;
- }
- }
- }
- if (minKey != char.MaxValue) {
- works[i] = 60 + minKey - 'A' + 1;
- items[i] = minKey;
- graph.Remove(items[i]);
- }
- }
- }
-
- time++;
-
- for (var i = 0; i < works.Length; i++) {
- if (works[i] == 0) {
- // wait
- continue;
- } else if (works[i] == 1) {
- // finish
- works[i]--;
- foreach (var key in graph.Keys) {
- graph[key].Remove(items[i]);
- }
-
- } else if (works[i] > 0) {
- // step
- works[i]--;
- }
- }
- }
-
- return time;
- }
-
- Dictionary> Parse(string input) {
- var dict = (
- from line in input.Split("\n")
- let parts = line.Split(" ")
- let part = parts[7][0]
- let partDependsOn = parts[1][0]
- group partDependsOn by part into g
- select g
- ).ToDictionary(g => g.Key, g => g.ToList());
-
- foreach (var key in new List(dict.Keys)) {
- foreach (var d in dict[key]) {
- if (!dict.ContainsKey(d)) {
- dict.Add(d, new List());
- }
- }
- }
- return dict;
- }
-}
diff --git a/2018/Day07/input.in b/2018/Day07/input.in
deleted file mode 100644
index 414e2d7a2..000000000
Binary files a/2018/Day07/input.in and /dev/null differ
diff --git a/2018/Day07/input.refout b/2018/Day07/input.refout
deleted file mode 100644
index b390f20a5..000000000
--- a/2018/Day07/input.refout
+++ /dev/null
@@ -1,2 +0,0 @@
-ABGKCMVWYDEHFOPQUILSTNZRJX
-898
diff --git a/2018/Day08/README.md b/2018/Day08/README.md
deleted file mode 100644
index 8e314227d..000000000
--- a/2018/Day08/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-## --- Day 8: Memory Maneuver ---
-The sleigh is much easier to pull than you'd expect for something its weight. Unfortunately, neither you nor the Elves know which way the North Pole is from here.
-
-You check your wrist device for anything that might help. It seems to have some kind of navigation system! Activating the navigation system produces more bad news: "Failed to start navigation system. Could not read software license file."
-
-Read the [full puzzle](https://adventofcode.com/2018/day/8).
\ No newline at end of file
diff --git a/2018/Day08/Solution.cs b/2018/Day08/Solution.cs
deleted file mode 100644
index 77d9fa112..000000000
--- a/2018/Day08/Solution.cs
+++ /dev/null
@@ -1,64 +0,0 @@
-using System;
-using System.Linq;
-
-namespace AdventOfCode.Y2018.Day08;
-
-[ProblemName("Memory Maneuver")]
-class Solution : Solver {
-
- public object PartOne(string input) =>
- Parse(input).fold(0, (cur, node) => cur + node.metadata.Sum());
-
-
- public object PartTwo(string input) {
- return Parse(input).value();
- }
-
- Node Parse(string input) {
- var nums = input.Split(" ").Select(int.Parse).GetEnumerator();
- Func next = () => {
- nums.MoveNext();
- return nums.Current;
- };
-
- Func read = null;
- read = () => {
- var node = new Node() {
- children = new Node[next()],
- metadata = new int[next()]
- };
- for (var i = 0; i < node.children.Length; i++) {
- node.children[i] = read();
- }
- for (var i = 0; i < node.metadata.Length; i++) {
- node.metadata[i] = next();
- }
- return node;
- };
- return read();
- }
-
-
-}
-
-class Node {
- public Node[] children;
- public int[] metadata;
- public T fold(T seed, Func aggregate) {
- return children.Aggregate(aggregate(seed, this), (cur, child) => child.fold(cur, aggregate));
- }
-
- public int value() {
- if(children.Length == 0){
- return metadata.Sum();
- }
-
- var res = 0;
- foreach(var i in metadata){
- if(i >= 1 && i <= children.Length){
- res += children[i-1].value();
- }
- }
- return res;
- }
-}
diff --git a/2018/Day08/input.in b/2018/Day08/input.in
deleted file mode 100644
index 01888be79..000000000
Binary files a/2018/Day08/input.in and /dev/null differ
diff --git a/2018/Day08/input.refout b/2018/Day08/input.refout
deleted file mode 100644
index 15920ddb9..000000000
--- a/2018/Day08/input.refout
+++ /dev/null
@@ -1,2 +0,0 @@
-43825
-19276
diff --git a/2018/Day09/README.md b/2018/Day09/README.md
deleted file mode 100644
index 750be53b5..000000000
--- a/2018/Day09/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-## --- Day 9: Marble Mania ---
-You talk to the Elves while you wait for your navigation system to initialize. To pass the time, they introduce you to their favorite [marble](https://en.wikipedia.org/wiki/Marble_(toy)) game.
-
-The Elves play this game by taking turns arranging the marbles in a *circle* according to very particular rules. The marbles are numbered starting with `0` and increasing by `1` until every marble has a number.
-
-Read the [full puzzle](https://adventofcode.com/2018/day/9).
\ No newline at end of file
diff --git a/2018/Day09/Solution.cs b/2018/Day09/Solution.cs
deleted file mode 100644
index ad54d968b..000000000
--- a/2018/Day09/Solution.cs
+++ /dev/null
@@ -1,60 +0,0 @@
-using System.Linq;
-using System.Text.RegularExpressions;
-
-namespace AdventOfCode.Y2018.Day09;
-
-[ProblemName("Marble Mania")]
-class Solution : Solver {
-
- public object PartOne(string input) => Solve(input, 1);
-
- public object PartTwo(string input) => Solve(input, 100);
-
- long Solve(string input, int mul) {
-
- var match = Regex.Match(input, @"(?\d+) players; last marble is worth (?\d+) points");
- var players = new long[int.Parse(match.Groups["players"].Value)];
- var targetPoints = int.Parse(match.Groups["points"].Value) * mul;
-
- var current = new Node { value = 0 };
- current.left = current;
- current.right = current;
-
- var points = 1;
- var iplayer = 1;
- while (points <= targetPoints) {
-
- if (points % 23 == 0) {
- for (var i = 0; i < 7; i++) {
- current = current.left;
- }
-
- players[iplayer] += points + current.value;
-
- var left = current.left;
- var right = current.right;
- right.left = left;
- left.right = right;
- current = right;
-
- } else {
- var left = current.right;
- var right = current.right.right;
- current = new Node { value = points, left = left, right = right };
- left.right = current;
- right.left = current;
- }
-
- points++;
- iplayer = (iplayer + 1) % players.Length;
- }
-
- return players.Max();
- }
-}
-
-class Node {
- public int value;
- public Node left;
- public Node right;
-}
diff --git a/2018/Day09/input.in b/2018/Day09/input.in
deleted file mode 100644
index ec6953af2..000000000
Binary files a/2018/Day09/input.in and /dev/null differ
diff --git a/2018/Day09/input.refout b/2018/Day09/input.refout
deleted file mode 100644
index 72d142c50..000000000
--- a/2018/Day09/input.refout
+++ /dev/null
@@ -1,2 +0,0 @@
-400493
-3338341690
diff --git a/2018/Day10/README.md b/2018/Day10/README.md
deleted file mode 100644
index 867a88d43..000000000
--- a/2018/Day10/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-## --- Day 10: The Stars Align ---
-It's no use; your navigation system simply isn't capable of providing walking directions in the arctic circle, and certainly not in 1018.
-
-The Elves suggest an alternative. In times like these, North Pole rescue operations will arrange points of light in the sky to guide missing Elves back to base. Unfortunately, the message is easy to miss: the points move slowly enough that it takes hours to align them, but have so much momentum that they only stay aligned for a second. If you blink at the wrong time, it might be hours before another message appears.
-
-Read the [full puzzle](https://adventofcode.com/2018/day/10).
\ No newline at end of file
diff --git a/2018/Day10/Solution.cs b/2018/Day10/Solution.cs
deleted file mode 100644
index b8694fe46..000000000
--- a/2018/Day10/Solution.cs
+++ /dev/null
@@ -1,76 +0,0 @@
-using System;
-using System.Linq;
-using System.Text.RegularExpressions;
-
-namespace AdventOfCode.Y2018.Day10;
-
-[ProblemName("The Stars Align")]
-class Solution : Solver {
-
- public object PartOne(string input) => Solver(input).st.Ocr();
-
- public object PartTwo(string input) => Solver(input).seconds;
-
- (string st, int seconds) Solver(string input) {
- // position=< 21992, -10766> velocity=<-2, 1>
- var rx = new Regex(@"position=\<\s*(?-?\d+),\s*(?-?\d+)\> velocity=\<\s*(?-?\d+),\s*(?-?\d+)\>");
- var points = (
- from line in input.Split("\n")
- let m = rx.Match(line)
- select new Point {
- x = int.Parse(m.Groups["x"].Value),
- y = int.Parse(m.Groups["y"].Value),
- vx = int.Parse(m.Groups["vx"].Value),
- vy = int.Parse(m.Groups["vy"].Value)
- }
- ).ToArray();
-
- var seconds = 0;
- Func step = (bool forward) => {
- foreach (var point in points) {
- if (forward) {
- point.x += point.vx;
- point.y += point.vy;
- } else {
- point.x -= point.vx;
- point.y -= point.vy;
- }
- }
- seconds += forward ? 1 : -1;
-
- var minX = points.Min(pt => pt.x);
- var maxX = points.Max(pt => pt.x);
- var minY = points.Min(pt => pt.y);
- var maxY = points.Max(pt => pt.y);
- return (minX, minY, maxX - minX + 1, maxY - minY + 1);
- };
-
- var area = long.MaxValue;
- while (true) {
-
- var rect = step(true);
- var areaNew = (rect.width) * (rect.height);
-
- if (areaNew > area) {
- rect = step(false);
- var st = "";
- for(var irow=0;irow p.x - rect.left == icol && p.y-rect.top == irow) ? '#': ' ';
- }
- st+= "\n";
- }
- return (st, seconds);
- }
- area = areaNew;
- }
- }
-}
-
-class Point {
- public int x;
- public int y;
- public int vx;
- public int vy;
-}
diff --git a/2018/Day10/input.in b/2018/Day10/input.in
deleted file mode 100644
index e85ff3932..000000000
Binary files a/2018/Day10/input.in and /dev/null differ
diff --git a/2018/Day10/input.refout b/2018/Day10/input.refout
deleted file mode 100644
index de505dd72..000000000
--- a/2018/Day10/input.refout
+++ /dev/null
@@ -1,2 +0,0 @@
-ZZCBGGCJ
-10886
diff --git a/2018/Day11/README.md b/2018/Day11/README.md
deleted file mode 100644
index 8f32d908b..000000000
--- a/2018/Day11/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-## --- Day 11: Chronal Charge ---
-You watch the Elves and their sleigh fade into the distance as they head toward the North Pole.
-
-Actually, you're the one fading. The falling sensation returns.
-
-Read the [full puzzle](https://adventofcode.com/2018/day/11).
\ No newline at end of file
diff --git a/2018/Day11/Solution.cs b/2018/Day11/Solution.cs
deleted file mode 100644
index ed3750d90..000000000
--- a/2018/Day11/Solution.cs
+++ /dev/null
@@ -1,72 +0,0 @@
-namespace AdventOfCode.Y2018.Day11;
-
-[ProblemName("Chronal Charge")]
-class Solution : Solver {
-
- public object PartOne(string input) {
- var res = Solver(int.Parse(input), 3);
- return $"{res.xMax},{res.yMax}";
- }
-
- public object PartTwo(string input) {
- var res = Solver(int.Parse(input), 300);
- return $"{res.xMax},{res.yMax},{res.dMax}";
- }
-
- (int xMax, int yMax, int dMax) Solver(int gridSerialNumber, int D) {
- var gridOriginal = new int[300, 300];
- for (var irow = 0; irow < 300; irow++) {
- for (var icol = 0; icol < 300; icol++) {
- var x = icol + 1;
- var y = irow + 1;
- // Find the fuel cell's *rack ID*, which is its *X coordinate plus 10*.
- var rackId = x + 10;
- // - Begin with a power level of the *rack ID* times the *Y coordinate*.
- var powerLevel = rackId * y;
- // - Increase the power level by the value of the *grid serial number* (your puzzle input).
- powerLevel += gridSerialNumber;
- // - Set the power level to itself multiplied by the *rack ID*.
- powerLevel *= rackId;
- // - Keep only the *hundreds digit* of the power level (so `12*3*45` becomes `3`; numbers with no hundreds digit become `0`).
- powerLevel = (powerLevel % 1000) / 100;
- // - *Subtract 5* from the power level.
- powerLevel -= 5;
-
- gridOriginal[irow, icol] = powerLevel;
- }
- }
-
- var maxTotalPower = int.MinValue;
- var yMax = int.MinValue;
- var xMax = int.MinValue;
- var dMax = int.MinValue;
-
- var grid = new int[300, 300];
- for (var d = 1; d <= D; d++) {
- for (var irow = 0; irow < 300 - d; irow++) {
- for (var icol = 0; icol < 300; icol++) {
- grid[irow, icol] += gridOriginal[irow + d - 1, icol];
- }
- }
-
- for (var irow = 0; irow < 300 - d; irow++) {
- for (var icol = 0; icol < 300 - d; icol++) {
- var totalPower = 0;
-
- for (var i = 0; i < d; i++) {
- totalPower += grid[irow, icol + i];
- }
-
- if (totalPower > maxTotalPower) {
- maxTotalPower = totalPower;
- yMax = irow + 1;
- xMax = icol + 1;
- dMax = d;
- }
- }
- }
- }
- return (xMax, yMax, dMax);
- }
-
-}
diff --git a/2018/Day11/input.in b/2018/Day11/input.in
deleted file mode 100644
index 77e59ecee..000000000
Binary files a/2018/Day11/input.in and /dev/null differ
diff --git a/2018/Day11/input.refout b/2018/Day11/input.refout
deleted file mode 100644
index 673116044..000000000
--- a/2018/Day11/input.refout
+++ /dev/null
@@ -1,2 +0,0 @@
-33,54
-232,289,8
diff --git a/2018/Day12/README.md b/2018/Day12/README.md
deleted file mode 100644
index 267227936..000000000
--- a/2018/Day12/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-## --- Day 12: Subterranean Sustainability ---
-The year 518 is significantly more underground than your history books implied. Either that, or you've arrived in a vast cavern network under the North Pole.
-
-After exploring a little, you discover a long tunnel that contains a row of small pots as far as you can see to your left and right. A few of them contain plants - someone is trying to grow things in these geothermally-heated caves.
-
-Read the [full puzzle](https://adventofcode.com/2018/day/12).
\ No newline at end of file
diff --git a/2018/Day12/Solution.cs b/2018/Day12/Solution.cs
deleted file mode 100644
index 5a428cc7c..000000000
--- a/2018/Day12/Solution.cs
+++ /dev/null
@@ -1,61 +0,0 @@
-using System.Collections.Generic;
-using System.Linq;
-
-namespace AdventOfCode.Y2018.Day12;
-
-[ProblemName("Subterranean Sustainability")]
-class Solution : Solver {
-
- public object PartOne(string input) => Iterate(input, 20);
-
- public object PartTwo(string input) => Iterate(input, 50000000000);
-
- long Iterate(string input, long iterations) {
- var (state, rules) = Parse(input);
-
- var dLeftPos = 0L;
-
- while (iterations > 0) {
- var prevState = state;
- state = Step(state, rules);
- iterations--;
- dLeftPos = state.left - prevState.left;
- if (state.pots == prevState.pots) {
- state = new State { left = state.left + iterations * dLeftPos, pots = state.pots };
- break;
- }
- }
-
- return Enumerable.Range(0, state.pots.Length).Select(i => state.pots[i] == '#' ? i + state.left : 0).Sum();
- }
-
- State Step(State state, Dictionary rules) {
- var pots = "....." + state.pots + ".....";
- var newPots = "";
- for (var i = 2; i < pots.Length - 2; i++) {
- var x = pots.Substring(i - 2, 5);
- newPots += rules.TryGetValue(x, out var ch) ? ch : ".";
- }
-
- var firstFlower = newPots.IndexOf("#");
- var newLeft = firstFlower + state.left - 3;
-
- newPots = newPots.Substring(firstFlower);
- newPots = newPots.Substring(0, newPots.LastIndexOf("#") + 1);
- var res = new State { left = newLeft, pots = newPots };
-
- return res;
- }
-
- (State state, Dictionary rules) Parse(string input) {
- var lines = input.Split("\n");
- var state = new State { left = 0, pots = lines[0].Substring("initial state: ".Length) };
- var rules = (from line in lines.Skip(2) let parts = line.Split(" => ") select new { key = parts[0], value = parts[1] }).ToDictionary(x => x.key, x => x.value);
- return (state, rules);
- }
-}
-
-class State {
- public long left;
- public string pots;
-}
diff --git a/2018/Day12/input.in b/2018/Day12/input.in
deleted file mode 100644
index f94e0da77..000000000
Binary files a/2018/Day12/input.in and /dev/null differ
diff --git a/2018/Day12/input.refout b/2018/Day12/input.refout
deleted file mode 100644
index 3b042617b..000000000
--- a/2018/Day12/input.refout
+++ /dev/null
@@ -1,2 +0,0 @@
-3903
-3450000002268
diff --git a/2018/Day13/README.md b/2018/Day13/README.md
deleted file mode 100644
index 14747d94f..000000000
--- a/2018/Day13/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-## --- Day 13: Mine Cart Madness ---
-A crop of this size requires significant logistics to transport produce, soil, fertilizer, and so on. The Elves are very busy pushing things around in *carts* on some kind of rudimentary system of tracks they've come up with.
-
-Seeing as how cart-and-track systems don't appear in recorded history for another 1000 years, the Elves seem to be making this up as they go along. They haven't even figured out how to avoid collisions yet.
-
-Read the [full puzzle](https://adventofcode.com/2018/day/13).
\ No newline at end of file
diff --git a/2018/Day13/Solution.cs b/2018/Day13/Solution.cs
deleted file mode 100644
index b05ae51db..000000000
--- a/2018/Day13/Solution.cs
+++ /dev/null
@@ -1,119 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-
-namespace AdventOfCode.Y2018.Day13;
-
-[ProblemName("Mine Cart Madness")]
-class Solution : Solver {
-
-
- public object PartOne(string input) {
- var (mat, carts) = Parse(input);
- while (true) {
- var newState = Step(mat, carts);
- if (newState.crashed.Any()) {
- return Tsto(newState.crashed[0]);
- }
- }
- }
-
- public object PartTwo(string input) {
- var (mat, carts) = Parse(input);
- while (carts.Count > 1) {
- var newState = Step(mat, carts);
- carts = newState.carts;
- }
- return Tsto(carts[0]);
- }
-
- string Tsto(Cart cart) => $"{cart.pos.icol},{cart.pos.irow}";
-
- (List crashed, List carts) Step(string[] mat, List carts) {
- var crashed = new List();
-
- foreach (var cart in carts.OrderBy((cartT) => cartT.pos)) {
- cart.pos = (irow: cart.pos.irow + cart.drow, icol: cart.pos.icol + cart.dcol);
-
- foreach (var cart2 in carts.ToArray()) {
- if (cart != cart2 && cart.pos.irow == cart2.pos.irow && cart.pos.icol == cart2.pos.icol) {
- crashed.Add(cart);
- crashed.Add(cart2);
-
- }
- }
- switch (mat[cart.pos.irow][cart.pos.icol]) {
- case '\\':
- if (cart.dcol == 1 || cart.dcol == -1) {
- cart.Rotate(Dir.Right);
- } else if (cart.drow == -1 || cart.drow == 1) {
- cart.Rotate(Dir.Left);
- } else {
- throw new Exception();
- }
- break;
- case '/':
- if (cart.dcol == 1 || cart.dcol == -1) {
- cart.Rotate(Dir.Left);
- } else if (cart.drow == 1 || cart.drow == -1) {
- cart.Rotate(Dir.Right);
- }
- break;
- case '+':
- cart.Turn();
- break;
- }
- }
- return (crashed, carts.Where(cart => !crashed.Contains(cart)).ToList());
- }
-
- (string[] mat, List carts) Parse(string input){
- var mat = input.Split("\n");
- var crow = mat.Length;
- var ccol = mat[0].Length;
-
- var carts = new List();
- for (var irow = 0; irow < crow; irow++) {
- for (var icol = 0; icol < ccol; icol++) {
- var ch = mat[irow][icol];
- switch (ch) {
- case '^':
- carts.Add(new Cart { pos = (irow: irow, icol: icol), dcol = 0, drow = -1 });
- break;
- case 'v':
- carts.Add(new Cart { pos = (irow: irow, icol: icol), dcol = 0, drow = 1 });
- break;
- case '<':
- carts.Add(new Cart { pos = (irow: irow, icol: icol), dcol = -1, drow = 0 });
- break;
- case '>':
- carts.Add(new Cart { pos = (irow: irow, icol: icol), dcol = 1, drow = 0 });
- break;
- }
- }
- }
- return (mat, carts);
- }
-}
-
-enum Dir { Left, Forward, Right }
-class Cart {
- public (int irow, int icol) pos;
- public int drow;
- public int dcol;
- private Dir nextTurn = Dir.Left;
-
- public void Rotate(Dir dir) {
- (drow, dcol) = dir switch {
- Dir.Left => (-dcol, drow),
- Dir.Right => (dcol, -drow),
- Dir.Forward => (drow, dcol),
- _ => throw new ArgumentException()
- };
- }
-
- public void Turn() {
- Rotate(nextTurn);
- nextTurn = (Dir)(((int)nextTurn + 1) % 3);
- }
-}
diff --git a/2018/Day13/input.in b/2018/Day13/input.in
deleted file mode 100644
index 921dc501f..000000000
Binary files a/2018/Day13/input.in and /dev/null differ
diff --git a/2018/Day13/input.refout b/2018/Day13/input.refout
deleted file mode 100644
index 91799b64e..000000000
--- a/2018/Day13/input.refout
+++ /dev/null
@@ -1,2 +0,0 @@
-8,3
-73,121
diff --git a/2018/Day14/README.md b/2018/Day14/README.md
deleted file mode 100644
index 69452d3ed..000000000
--- a/2018/Day14/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-## --- Day 14: Chocolate Charts ---
-You finally have a chance to look at all of the produce moving around. Chocolate, cinnamon, mint, chili peppers, nutmeg, vanilla... the Elves must be growing these plants to make *hot chocolate*! As you realize this, you hear a conversation in the distance. When you go to investigate, you discover two Elves in what appears to be a makeshift underground kitchen/laboratory.
-
-The Elves are trying to come up with the ultimate hot chocolate recipe; they're even maintaining a scoreboard which tracks the quality *score* (`0`-`9`) of each recipe.
-
-Read the [full puzzle](https://adventofcode.com/2018/day/14).
\ No newline at end of file
diff --git a/2018/Day14/Solution.cs b/2018/Day14/Solution.cs
deleted file mode 100644
index ccd9377b1..000000000
--- a/2018/Day14/Solution.cs
+++ /dev/null
@@ -1,50 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-
-namespace AdventOfCode.Y2018.Day14;
-
-[ProblemName("Chocolate Charts")]
-class Solution : Solver {
-
- public object PartOne(string input) => Window(10).ElementAt(int.Parse(input)).st;
-
- public object PartTwo(string input) => Window(input.Length).First(item => item.st == input).i;
-
- IEnumerable<(int i, string st)> Window(int w) {
- var st = "";
- var i = 0;
- foreach (var score in Scores()) {
- i++;
- st += score;
- if (st.Length > w) {
- st = st.Substring(st.Length - w);
- }
- if (st.Length == w) {
- yield return (i - w, st);
- }
- }
- }
-
- IEnumerable Scores() {
- var scores = new List();
- Func add = (i) => { scores.Add(i); return i; };
-
- var elf1 = 0;
- var elf2 = 1;
-
- yield return add(3);
- yield return add(7);
-
- while (true) {
- var sum = scores[elf1] + scores[elf2];
- if (sum >= 10) {
- yield return add(sum / 10);
- }
- yield return add(sum % 10);
-
- elf1 = (elf1 + scores[elf1] + 1) % scores.Count;
- elf2 = (elf2 + scores[elf2] + 1) % scores.Count;
- }
- }
-}
diff --git a/2018/Day14/input.in b/2018/Day14/input.in
deleted file mode 100644
index 342edb5ac..000000000
Binary files a/2018/Day14/input.in and /dev/null differ
diff --git a/2018/Day14/input.refout b/2018/Day14/input.refout
deleted file mode 100644
index 1db589e3b..000000000
--- a/2018/Day14/input.refout
+++ /dev/null
@@ -1,2 +0,0 @@
-1221283494
-20261485
diff --git a/2018/Day15/README.md b/2018/Day15/README.md
deleted file mode 100644
index ffa44ddd5..000000000
--- a/2018/Day15/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-## --- Day 15: Beverage Bandits ---
-Having perfected their hot chocolate, the Elves have a new problem: the [Goblins](https://en.wikipedia.org/wiki/Goblin) that live in these caves will do anything to steal it. Looks like they're here for a fight.
-
-You scan the area, generating a map of the walls (#
), open cavern (.
), and starting position of every Goblin (G
) and Elf (E
) (your puzzle input).
-
-Read the [full puzzle](https://adventofcode.com/2018/day/15).
\ No newline at end of file
diff --git a/2018/Day15/Solution.cs b/2018/Day15/Solution.cs
deleted file mode 100644
index 41aa93b9d..000000000
--- a/2018/Day15/Solution.cs
+++ /dev/null
@@ -1,251 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-
-namespace AdventOfCode.Y2018.Day15;
-
-[ProblemName("Beverage Bandits")]
-class Solution : Solver {
-
- public object PartOne(string input) {
- return Outcome(input, 3, 3, false).score;
- }
-
- public object PartTwo(string input) {
- var elfAp = 4;
- while (true) {
- var outcome = Outcome(input, 3, elfAp, false);
- if (outcome.noElfDied) {
- return outcome.score;
- }
- elfAp++;
- }
- }
-
- (bool noElfDied, int score) Outcome(string input, int goblinAp, int elfAp, bool tsto) {
- var game = Parse(input, goblinAp, elfAp);
- var elfCount = game.players.Count(player => player.elf);
-
- if (tsto) {
- Console.WriteLine(game.Tsto());
- }
-
- while (!game.Finished()) {
- game.Step();
- if (tsto) {
- Console.WriteLine(game.Tsto());
- }
- }
-
- return (game.players.Count(p => p.elf) == elfCount, game.rounds * game.players.Select(player => player.hp).Sum());
- }
-
-
- Game Parse(string input, int goblinAp, int elfAp) {
- var players = new List();
- var lines = input.Split("\n");
- var mtx = new Block[lines.Length, lines[0].Length];
-
- var game = new Game { mtx = mtx, players = players };
-
- for (var irow = 0; irow < lines.Length; irow++) {
- for (var icol = 0; icol < lines[0].Length; icol++) {
- switch (lines[irow][icol]) {
- case '#':
- mtx[irow, icol] = Wall.Block;
- break;
- case '.':
- mtx[irow, icol] = Empty.Block;
- break;
- case var ch when ch == 'G' || ch == 'E':
- var player = new Player {
- elf = ch == 'E',
- ap = ch == 'E' ? elfAp : goblinAp,
- pos = (irow, icol),
- game = game
- };
- players.Add(player);
- mtx[irow, icol] = player;
- break;
- }
- }
- }
- return game;
- }
-
-
-}
-
-class Game {
- public Block[,] mtx;
- public List players;
- public int rounds;
-
- private bool ValidPos((int irow, int icol) pos) =>
- pos.irow >= 0 && pos.irow < this.mtx.GetLength(0) && pos.icol >= 0 && pos.icol < this.mtx.GetLength(1);
-
- public Block GetBlock((int irow, int icol) pos) =>
- ValidPos(pos) ? mtx[pos.irow, pos.icol] : Wall.Block;
-
- public void Step() {
- var finishedBeforeEndOfRound = false;
- foreach (var player in players.OrderBy(player => player.pos).ToArray()) {
- if (player.hp > 0) {
- finishedBeforeEndOfRound |= Finished();
- player.Step();
- }
- }
-
- if (!finishedBeforeEndOfRound) {
- rounds++;
- }
- }
-
- public bool Finished() =>
- players.Where(p => p.elf).All(p => p.hp == 0) ||
- players.Where(p => !p.elf).All(p => p.hp == 0);
-
- public string Tsto() {
-
- var res = "";
- res += rounds == 0 ? "Initial:\n" : $"After round {rounds}:\n";
- for (var irow = 0; irow < mtx.GetLength(0); irow++) {
- for (var icol = 0; icol < mtx.GetLength(1); icol++) {
- res += GetBlock((irow, icol)) switch {
- Player p when p.elf => "E",
- Player p when !p.elf => "G",
- Empty _ => ".",
- Wall _ => "#",
- _ => throw new ArgumentException()
- };
- }
-
- foreach (var player in players.Where(player => player.pos.irow == irow).OrderBy(player => player.pos)) {
- var ch = player.elf ? 'E' : 'G';
- res += $" {ch}{{{player.pos.irow}, {player.pos.icol}}}({player.hp})";
- }
- res += "\n";
- }
- res += "\n";
- return res;
- }
-}
-
-abstract class Block { }
-
-class Empty : Block {
- public static readonly Empty Block = new Empty();
- private Empty() { }
-}
-
-class Wall : Block {
- public static readonly Wall Block = new Wall();
- private Wall() { }
-}
-
-class Player : Block {
- public (int irow, int icol) pos;
- public bool elf;
- public int ap = 3;
- public int hp = 200;
- public Game game;
-
- public bool Step() {
- if (hp <= 0) {
- return false;
- } else if (Attack()) {
- return true;
- } else if (Move()) {
- Attack();
- return true;
- } else {
- return false;
- }
- }
-
- private bool Move() {
- var targets = FindTargets();
- if (!targets.Any()) {
- return false;
- }
- var opponent = targets.OrderBy(a => a.target).First();
- var nextPos = targets.Where(a => a.player == opponent.player).Select(a => a.firstStep).OrderBy(_ => _).First();
- (game.mtx[nextPos.irow, nextPos.icol], game.mtx[pos.irow, pos.icol]) =
- (game.mtx[pos.irow, pos.icol], game.mtx[nextPos.irow, nextPos.icol]);
- pos = nextPos;
- return true;
- }
-
- private IEnumerable<(Player player, (int irow, int icol) firstStep, (int irow, int icol) target)> FindTargets() {
-
- var minDist = int.MaxValue;
- foreach (var (otherPlayer, firstStep, target, dist) in BlocksNextToOpponentsByDistance()) {
- if (dist > minDist) {
- break;
- } else {
- minDist = dist;
- yield return (otherPlayer, firstStep, target);
- }
- }
- }
-
- private IEnumerable<(Player player, (int irow, int icol) firstStep, (int irow, int icol) target, int dist)> BlocksNextToOpponentsByDistance() {
- var seen = new HashSet<(int irow, int icol)>();
- seen.Add(pos);
- var q = new Queue<((int irow, int icol) pos, (int drow, int dcol) origDir, int dist)>();
-
- foreach (var (drow, dcol) in new[] { (-1, 0), (0, -1), (0, 1), (1, 0) }) {
- var posT = (pos.irow + drow, pos.icol + dcol);
- q.Enqueue((posT, posT, 1));
- }
-
- while (q.Any()) {
- var (pos, firstStep, dist) = q.Dequeue();
-
- if (game.GetBlock(pos) is Empty) {
- foreach (var (drow, dcol) in new[] { (-1, 0), (0, -1), (0, 1), (1, 0) }) {
- var posT = (pos.irow + drow, pos.icol + dcol);
- if (!seen.Contains(posT)) {
- seen.Add(posT);
- q.Enqueue((posT, firstStep, dist + 1));
-
- var nextBlock = game.GetBlock(posT);
- if (nextBlock is Player) {
- var player = nextBlock as Player;
- if (player.elf != this.elf) {
- yield return (player, firstStep, pos, dist);
- }
- }
- }
- }
- }
- }
- }
-
- private bool Attack() {
- var opponents = new List();
-
- foreach (var (drow, dcol) in new[] { (-1, 0), (0, -1), (0, 1), (1, 0) }) {
- var posT = (this.pos.irow + drow, this.pos.icol + dcol);
- var block = game.GetBlock(posT);
- switch (block) {
- case Player otherPlayer when otherPlayer.elf != this.elf:
- opponents.Add(otherPlayer);
- break;
- }
- }
-
- if (!opponents.Any()) {
- return false;
- }
- var minHp = opponents.Select(a => a.hp).Min();
- var opponent = opponents.First(a => a.hp == minHp);
- opponent.hp -= this.ap;
- if (opponent.hp <= 0) {
- game.players.Remove(opponent);
- game.mtx[opponent.pos.irow, opponent.pos.icol] = Empty.Block;
- }
- return true;
- }
-
-}
diff --git a/2018/Day15/input.in b/2018/Day15/input.in
deleted file mode 100644
index 0ea43d55c..000000000
Binary files a/2018/Day15/input.in and /dev/null differ
diff --git a/2018/Day15/input.refout b/2018/Day15/input.refout
deleted file mode 100644
index cc68bcea7..000000000
--- a/2018/Day15/input.refout
+++ /dev/null
@@ -1,2 +0,0 @@
-319410
-63168
\ No newline at end of file
diff --git a/2018/Day16/README.md b/2018/Day16/README.md
deleted file mode 100644
index 0c41ed9df..000000000
--- a/2018/Day16/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-## --- Day 16: Chronal Classification ---
-As you see the Elves defend their hot chocolate successfully, you go back to falling through time. This is going to become a problem.
-
-If you're ever going to return to your own time, you need to understand how this device on your wrist works. You have a little while before you reach your next destination, and with a bit of trial and error, you manage to pull up a programming manual on the device's tiny screen.
-
-Read the [full puzzle](https://adventofcode.com/2018/day/16).
\ No newline at end of file
diff --git a/2018/Day16/Solution.cs b/2018/Day16/Solution.cs
deleted file mode 100644
index e268e8d30..000000000
--- a/2018/Day16/Solution.cs
+++ /dev/null
@@ -1,139 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text.RegularExpressions;
-
-namespace AdventOfCode.Y2018.Day16;
-
-[ProblemName("Chronal Classification")]
-class Solution : Solver {
-
- public object PartOne(string input) {
- var res = 0;
- var (testCases, prg) = Parse(input);
- foreach (var testCase in testCases) {
- var match = 0;
- for (var i = 0; i < 16; i++) {
- testCase.stm[0] = i;
- var regsActual = Step(testCase.regsBefore, testCase.stm);
- if (Enumerable.Range(0, 4).All(ireg => regsActual[ireg] == testCase.regsAfter[ireg])) {
- match++;
- }
- }
- if (match >= 3) {
- res++;
- }
- }
- return res;
- }
-
- public object PartTwo(string input) {
-
- var constraints = Enumerable.Range(0, 16).ToDictionary(i => i, i => Enumerable.Range(0, 16).ToList());
- var (testCases, prg) = Parse(input);
- foreach (var testCase in testCases) {
- var op = testCase.stm[0];
- var oldMapping = constraints[op];
- var newMapping = new List();
- foreach (var i in oldMapping) {
- testCase.stm[0] = i;
- var regsActual = Step(testCase.regsBefore, testCase.stm);
- if (Enumerable.Range(0, 4).All(ireg => regsActual[ireg] == testCase.regsAfter[ireg])) {
- newMapping.Add(i);
- }
- }
- constraints[op] = newMapping;
- }
-
- var mapping = WorkOutMapping(constraints, new bool[16], new Dictionary());
- var regs = new int[4];
- foreach (var stm in prg) {
- stm[0] = mapping[stm[0]];
- regs = Step(regs, stm);
- }
- return regs[0];
- }
-
- Dictionary WorkOutMapping(Dictionary> constaints, bool[] used, Dictionary res) {
- var op = res.Count;
- if (op == 16) {
- return res;
- }
- foreach (var i in constaints[op]) {
- if (!used[i]) {
- used[i] = true;
- res[op] = i;
- var x = WorkOutMapping(constaints, used, res);
- if (x != null) {
- return x;
- }
- res.Remove(op);
- used[i] = false;
- }
- }
- return null;
- }
-
- (List testCases, List prg) Parse(string input) {
- var lines = input.Split("\n").ToList();
- var iline = 0;
-
- var testCases = new List();
- while (Ints(@"Before: \[(\d+), (\d+), (\d+), (\d+)\]", out var regsBefore)) {
- Ints(@"(\d+) (\d+) (\d+) (\d+)", out var stm);
- Ints(@"After: \[(\d+), (\d+), (\d+), (\d+)\]", out var regsAfter);
- iline++;
- testCases.Add(new TestCase() { regsBefore = regsBefore, regsAfter = regsAfter, stm = stm });
- }
- iline++;
- iline++;
- var prg = new List();
- while (Ints(@"(\d+) (\d+) (\d+) (\d+)", out var stm)) {
- prg.Add(stm);
- }
-
- bool Ints(string pattern, out int[] r) {
- r = null;
- if (iline >= lines.Count) {
- return false;
- }
- var m = Regex.Match(lines[iline], pattern);
- if (m.Success) {
- iline++;
- r = m.Groups.Values.Skip(1).Select(x => int.Parse(x.Value)).ToArray();
- }
- return m.Success;
- }
- return (testCases, prg);
- }
-
- int[] Step(int[] regs, int[] stm) {
- regs = regs.ToArray();
- regs[stm[3]] = stm[0] switch {
- 0 => regs[stm[1]] + regs[stm[2]],
- 1 => regs[stm[1]] + stm[2],
- 2 => regs[stm[1]] * regs[stm[2]],
- 3 => regs[stm[1]] * stm[2],
- 4 => regs[stm[1]] & regs[stm[2]],
- 5 => regs[stm[1]] & stm[2],
- 6 => regs[stm[1]] | regs[stm[2]],
- 7 => regs[stm[1]] | stm[2],
- 8 => regs[stm[1]],
- 9 => stm[1],
- 10 => stm[1] > regs[stm[2]] ? 1 : 0,
- 11 => regs[stm[1]] > stm[2] ? 1 : 0,
- 12 => regs[stm[1]] > regs[stm[2]] ? 1 : 0,
- 13 => stm[1] == regs[stm[2]] ? 1 : 0,
- 14 => regs[stm[1]] == stm[2] ? 1 : 0,
- 15 => regs[stm[1]] == regs[stm[2]] ? 1 : 0,
- _ => throw new ArgumentException()
- };
- return regs;
- }
-}
-
-class TestCase {
- public int[] regsBefore;
- public int[] regsAfter;
- public int[] stm;
-}
diff --git a/2018/Day16/input.in b/2018/Day16/input.in
deleted file mode 100644
index 75cac132a..000000000
Binary files a/2018/Day16/input.in and /dev/null differ
diff --git a/2018/Day16/input.refout b/2018/Day16/input.refout
deleted file mode 100644
index ce8897022..000000000
--- a/2018/Day16/input.refout
+++ /dev/null
@@ -1,2 +0,0 @@
-567
-610
diff --git a/2018/Day17/README.md b/2018/Day17/README.md
deleted file mode 100644
index 16a5873ac..000000000
--- a/2018/Day17/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-## --- Day 17: Reservoir Research ---
-You arrive in the year 18. If it weren't for the coat you got in 1018, you would be very cold: the North Pole base hasn't even been constructed.
-
-Rather, it hasn't been constructed *yet*. The Elves are making a little progress, but there's not a lot of liquid water in this climate, so they're getting very dehydrated. Maybe there's more underground?
-
-Read the [full puzzle](https://adventofcode.com/2018/day/17).
\ No newline at end of file
diff --git a/2018/Day17/Solution.cs b/2018/Day17/Solution.cs
deleted file mode 100644
index b225a8d30..000000000
--- a/2018/Day17/Solution.cs
+++ /dev/null
@@ -1,96 +0,0 @@
-using System;
-using System.Linq;
-using System.Text;
-using System.Text.RegularExpressions;
-
-namespace AdventOfCode.Y2018.Day17;
-
-[ProblemName("Reservoir Research")]
-class Solution : Solver {
-
- public object PartOne(string input) => Regex.Matches(Fill(input), "[~|]").Count;
- public object PartTwo(string input) => Regex.Matches(Fill(input), "[~]").Count;
-
- string Fill(string input) {
- var (width, height) = (2000, 2000);
- var mtx = new char[width, height];
-
- for (var y = 0; y < height; y++) {
- for (var x = 0; x < width; x++) {
- mtx[x, y] = '.';
- }
- }
-
- foreach (var line in input.Split("\n")) {
- var nums = Regex.Matches(line, @"\d+").Select(g => int.Parse(g.Value)).ToArray();
- for (var i = nums[1]; i <= nums[2]; i++) {
- if (line.StartsWith("x")) {
- mtx[nums[0], i] = '#';
- } else {
- mtx[i, nums[0]] = '#';
- }
- }
- }
- FillRecursive(mtx, 500, 0);
-
- var (minY, maxY) = (int.MaxValue, int.MinValue);
- for (var y = 0; y < height; y++) {
- for (var x = 0; x < width; x++) {
- if (mtx[x, y] == '#') {
- minY = Math.Min(minY, y);
- maxY = Math.Max(maxY, y);
- }
- }
- }
- var sb = new StringBuilder();
- for (var y = minY; y <= maxY; y++) {
- for (var x = 0; x < width; x++) {
- sb.Append(mtx[x, y]);
- }
- sb.AppendLine();
- }
- return sb.ToString();
- }
-
- void FillRecursive(char[,] mtx, int x, int y) {
- var width = mtx.GetLength(0);
- var height = mtx.GetLength(1);
- if (mtx[x, y] != '.') {
- return;
- }
- mtx[x, y] = '|';
- if (y == height - 1) {
- return ;
- }
- FillRecursive(mtx, x, y + 1);
-
- if (mtx[x, y + 1] == '#' || mtx[x, y + 1] == '~') {
- if (x > 0) {
- FillRecursive(mtx, x - 1, y);
- }
- if (x < width - 1) {
- FillRecursive(mtx, x + 1, y);
- }
- }
-
- if (IsStill(mtx, x, y)) {
- foreach (var dx in new[] { -1, 1 }) {
- for (var xT = x; xT >= 0 && xT < width && mtx[xT, y] == '|'; xT += dx) {
- mtx[xT, y] = '~';
- }
- }
- }
- }
-
- bool IsStill(char[,] mtx, int x, int y) {
- var width = mtx.GetLength(0);
- foreach (var dx in new[] { -1, 1 }) {
- for (var xT = x; xT >= 0 && xT < width && mtx[xT, y] != '#'; xT += dx) {
- if (mtx[xT, y] == '.' || mtx[xT, y + 1] == '|') {
- return false;
- }
- }
- }
- return true;
- }
-}
diff --git a/2018/Day17/input.in b/2018/Day17/input.in
deleted file mode 100644
index 47120cff7..000000000
Binary files a/2018/Day17/input.in and /dev/null differ
diff --git a/2018/Day17/input.refout b/2018/Day17/input.refout
deleted file mode 100644
index cd2b0b0da..000000000
--- a/2018/Day17/input.refout
+++ /dev/null
@@ -1,2 +0,0 @@
-41027
-34214
diff --git a/2018/Day18/README.md b/2018/Day18/README.md
deleted file mode 100644
index 10baaa900..000000000
--- a/2018/Day18/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-## --- Day 18: Settlers of The North Pole ---
-On the outskirts of the North Pole base construction project, many Elves are collecting lumber.
-
-The lumber collection area is 50 acres by 50 acres; each acre can be either *open ground* (`.`), *trees* (`|`), or a *lumberyard* (`#`). You take a scan of the area (your puzzle input).
-
-Read the [full puzzle](https://adventofcode.com/2018/day/18).
\ No newline at end of file
diff --git a/2018/Day18/Solution.cs b/2018/Day18/Solution.cs
deleted file mode 100644
index 1cf6be00b..000000000
--- a/2018/Day18/Solution.cs
+++ /dev/null
@@ -1,68 +0,0 @@
-using System.Collections.Generic;
-using System.Text.RegularExpressions;
-
-namespace AdventOfCode.Y2018.Day18;
-
-[ProblemName("Settlers of The North Pole")]
-class Solution : Solver {
-
- public object PartOne(string input) => Iterate(input, 10);
- public object PartTwo(string input) => Iterate(input, 1000000000);
-
- int Iterate(string input, int lim) {
- var seen = new Dictionary();
- var mtx = input.Split("\n");
-
- for (var t = 0; t < lim; t++) {
- var hash = string.Join("", mtx);
- if (seen.ContainsKey(hash)) {
- var loopLength = t - seen[hash];
- var remainingSteps = lim - t - 1;
- var remainingLoops = remainingSteps / loopLength;
- t += remainingLoops * loopLength;
- } else {
- seen[hash] = t;
- }
- mtx = Step(mtx);
- }
- var res = string.Join("", mtx);
- return Regex.Matches(res, @"\#").Count * Regex.Matches(res, @"\|").Count;
- }
-
- string[] Step(string[] mtx) {
- var res = new List();
- var crow = mtx.Length;
- var ccol = mtx[0].Length;
-
- for (var irow = 0; irow < crow; irow++) {
- var line = "";
- for (var icol = 0; icol < ccol; icol++) {
- var (tree, lumberyard, empty) = (0, 0, 0);
- foreach (var drow in new[] { -1, 0, 1 }) {
- foreach (var dcol in new[] { -1, 0, 1 }) {
- if (drow != 0 || dcol != 0) {
- var (icolT, irowT) = (icol + dcol, irow + drow);
- if (icolT >= 0 && icolT < ccol && irowT >= 0 && irowT < crow) {
- switch (mtx[irowT][icolT]) {
- case '#': lumberyard++; break;
- case '|': tree++; break;
- case '.': empty++; break;
- }
- }
- }
- }
- }
-
- line += mtx[irow][icol] switch {
- '#' when lumberyard >= 1 && tree >= 1 => '#',
- '|' when lumberyard >= 3 => '#',
- '.' when tree >= 3 => '|',
- '#' => '.',
- var c => c
- };
- }
- res.Add(line);
- }
- return res.ToArray();
- }
-}
diff --git a/2018/Day18/input.in b/2018/Day18/input.in
deleted file mode 100644
index 5babc989e..000000000
Binary files a/2018/Day18/input.in and /dev/null differ
diff --git a/2018/Day18/input.refout b/2018/Day18/input.refout
deleted file mode 100644
index b196652ee..000000000
--- a/2018/Day18/input.refout
+++ /dev/null
@@ -1,2 +0,0 @@
-594712
-203138
diff --git a/2018/Day19/README.md b/2018/Day19/README.md
deleted file mode 100644
index b2070b233..000000000
--- a/2018/Day19/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-## --- Day 19: Go With The Flow ---
-With the Elves well on their way constructing the North Pole base, you turn your attention back to understanding the inner workings of programming the device.
-
-You can't help but notice that the [device's opcodes](16) don't contain any *flow control* like jump instructions. The device's [manual](16) goes on to explain:
-
-Read the [full puzzle](https://adventofcode.com/2018/day/19).
\ No newline at end of file
diff --git a/2018/Day19/Solution.cs b/2018/Day19/Solution.cs
deleted file mode 100644
index ff0696dcb..000000000
--- a/2018/Day19/Solution.cs
+++ /dev/null
@@ -1,57 +0,0 @@
-using System;
-using System.Linq;
-
-namespace AdventOfCode.Y2018.Day19;
-
-[ProblemName("Go With The Flow")]
-class Solution : Solver {
-
- public object PartOne(string input) {
- var ip = 0;
- var ipReg = int.Parse(input.Split("\n").First().Substring("#ip ".Length));
- var prg = input.Split("\n").Skip(1).ToArray();
- var regs = new int[6];
- while (ip >= 0 && ip < prg.Length) {
- var args = prg[ip].Split(" ");
- regs[ipReg] = ip;
- regs = Step(regs, args[0], args.Skip(1).Select(int.Parse).ToArray());
- ip = regs[ipReg];
- ip++;
- }
- return regs[0];
- }
-
- public object PartTwo(string input) {
- var t = 10551292;
- var r0 = 0;
- for (var x = 1; x <= t; x++) {
- if (t % x == 0)
- r0 += x;
- }
- return r0;
- }
-
- int[] Step(int[] regs, string op, int[] stm) {
- regs = regs.ToArray();
- regs[stm[2]] = op switch {
- "addr" => regs[stm[0]] + regs[stm[1]],
- "addi" => regs[stm[0]] + stm[1],
- "mulr" => regs[stm[0]] * regs[stm[1]],
- "muli" => regs[stm[0]] * stm[1],
- "banr" => regs[stm[0]] & regs[stm[1]],
- "bani" => regs[stm[0]] & stm[1],
- "borr" => regs[stm[0]] | regs[stm[1]],
- "bori" => regs[stm[0]] | stm[1],
- "setr" => regs[stm[0]],
- "seti" => stm[0],
- "gtir" => stm[0] > regs[stm[1]] ? 1 : 0,
- "gtri" => regs[stm[0]] > stm[1] ? 1 : 0,
- "gtrr" => regs[stm[0]] > regs[stm[1]] ? 1 : 0,
- "eqir" => stm[0] == regs[stm[1]] ? 1 : 0,
- "eqri" => regs[stm[0]] == stm[1] ? 1 : 0,
- "eqrr" => regs[stm[0]] == regs[stm[1]] ? 1 : 0,
- _ => throw new ArgumentException()
- };
- return regs;
- }
-}
diff --git a/2018/Day19/input.in b/2018/Day19/input.in
deleted file mode 100644
index 07bc89717..000000000
Binary files a/2018/Day19/input.in and /dev/null differ
diff --git a/2018/Day19/input.orig b/2018/Day19/input.orig
deleted file mode 100644
index 986151d9b..000000000
--- a/2018/Day19/input.orig
+++ /dev/null
@@ -1,37 +0,0 @@
-#ip 2
-addi 2 16 2
-seti 1 8 5
-seti 1 0 3
-mulr 5 3 4
-eqrr 4 1 4
-addr 4 2 2
-addi 2 1 2
-addr 5 0 0
-addi 3 1 3
-gtrr 3 1 4
-addr 2 4 2
-seti 2 1 2
-addi 5 1 5
-gtrr 5 1 4
-addr 4 2 2
-seti 1 1 2
-mulr 2 2 2
-addi 1 2 1
-mulr 1 1 1
-mulr 2 1 1
-muli 1 11 1
-addi 4 2 4
-mulr 4 2 4
-addi 4 12 4
-addr 1 4 1
-addr 2 0 2
-seti 0 9 2
-setr 2 3 4
-mulr 4 2 4
-addr 2 4 4
-mulr 2 4 4
-muli 4 14 4
-mulr 4 2 4
-addr 1 4 1
-seti 0 1 0
-seti 0 4 2
\ No newline at end of file
diff --git a/2018/Day19/input.refout b/2018/Day19/input.refout
deleted file mode 100644
index 1d587a220..000000000
--- a/2018/Day19/input.refout
+++ /dev/null
@@ -1,2 +0,0 @@
-1568
-19030032
diff --git a/2018/Day20/README.md b/2018/Day20/README.md
deleted file mode 100644
index 195e256fe..000000000
--- a/2018/Day20/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-## --- Day 20: A Regular Map ---
-While you were learning about instruction pointers, the Elves made considerable progress. When you look up, you discover that the North Pole base construction project has completely surrounded you.
-
-The area you are in is made up entirely of *rooms* and *doors*. The rooms are arranged in a grid, and rooms only connect to adjacent rooms when a door is present between them.
-
-Read the [full puzzle](https://adventofcode.com/2018/day/20).
\ No newline at end of file
diff --git a/2018/Day20/Solution.cs b/2018/Day20/Solution.cs
deleted file mode 100644
index 221cad07c..000000000
--- a/2018/Day20/Solution.cs
+++ /dev/null
@@ -1,65 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-
-namespace AdventOfCode.Y2018.Day20;
-[ProblemName("A Regular Map")]
-class Solution : Solver {
-
- public object PartOne(string input) => Solver(input).dMax;
- public object PartTwo(string input) => Solver(input).distantRooms;
-
- (int dMax, int distantRooms) Solver(string input) {
- var grid = Doors(input)
- .ToList()
- .GroupBy(x => x.posFrom)
- .ToDictionary(x=>x.Key, x=> x.Select(y => y.posTo).ToList());
-
- var queue = new Queue<((int x, int y) pos, int d)>();
- queue.Enqueue(((0, 0), 0));
-
- var seen = new HashSet<(int x, int y)>();
- var (dMax, distantRooms) = (int.MinValue, 0);
-
- while (queue.Any()) {
- var (pos, d) = queue.Dequeue();
- if (seen.Contains(pos)) {
- continue;
- }
-
- dMax = Math.Max(dMax, d);
- if (d >= 1000) {
- distantRooms++;
- }
-
- seen.Add(pos);
- foreach (var nextPos in grid[pos]) {
- queue.Enqueue((nextPos, d + 1));
- }
- }
-
- return (dMax, distantRooms);
- }
-
- IEnumerable<((int x, int y) posFrom, (int x, int y) posTo)> Doors(string input) {
- var s = new Stack<(int x, int y)>();
- (int x, int y) pos = (0, 0);
- foreach (var ch in input) {
- var prev = pos;
- switch (ch) {
- case 'N': pos = (pos.x, pos.y - 1); break;
- case 'S': pos = (pos.x, pos.y + 1); break;
- case 'E': pos = (pos.x + 1, pos.y); break;
- case 'W': pos = (pos.x - 1, pos.y); break;
- case '(': s.Push(pos); break;
- case '|': pos = s.Peek(); break;
- case ')': pos = s.Pop(); break;
- }
-
- if ("NSEW".IndexOf(ch) >= 0) {
- yield return (prev, pos);
- yield return (pos, prev);
- }
- }
- }
-}
diff --git a/2018/Day20/input.in b/2018/Day20/input.in
deleted file mode 100644
index 84ee2d7a1..000000000
Binary files a/2018/Day20/input.in and /dev/null differ
diff --git a/2018/Day20/input.refout b/2018/Day20/input.refout
deleted file mode 100644
index 19f571c46..000000000
--- a/2018/Day20/input.refout
+++ /dev/null
@@ -1,2 +0,0 @@
-4186
-8466
diff --git a/2018/Day21/README.md b/2018/Day21/README.md
deleted file mode 100644
index f7558e4d8..000000000
--- a/2018/Day21/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-## --- Day 21: Chronal Conversion ---
-You should have been watching where you were going, because as you wander the new North Pole base, you trip and fall into a very deep hole!
-
-Just kidding. You're falling through time again.
-
-Read the [full puzzle](https://adventofcode.com/2018/day/21).
\ No newline at end of file
diff --git a/2018/Day21/Solution.cs b/2018/Day21/Solution.cs
deleted file mode 100644
index f7ed345ae..000000000
--- a/2018/Day21/Solution.cs
+++ /dev/null
@@ -1,65 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-
-namespace AdventOfCode.Y2018.Day21;
-
-[ProblemName("Chronal Conversion")]
-class Solution : Solver {
-
- public object PartOne(string input) => Run(input).First();
- public object PartTwo(string input) => Run(input).Last();
-
- public IEnumerable Run(string input) {
- var breakpoint = 28;
- var seen = new List();
-
- foreach (var regs in Trace(input, breakpoint)) {
- if (seen.Contains(regs[3])) {
- break;
- }
- seen.Add(regs[3]);
- yield return regs[3];
- }
- }
-
- public IEnumerable Trace(string input, int breakpoint) {
- var lines = input.Split("\n");
- var ipReg = int.Parse(lines.First().Split(" ")[1]);
- var program = lines.Skip(1).Select(Compile).ToArray();
- var regs = new long[] { 0, 0, 0, 0, 0, 0 };
-
- while (true) {
- if (regs[ipReg] == breakpoint) {
- yield return regs;
- }
- program[regs[ipReg]](regs);
- regs[ipReg]++;
- }
- }
-
- Action Compile(string line) {
- var parts = line.Split(" ");
- var op = parts[0];
- var args = parts.Skip(1).Select(long.Parse).ToArray();
- return op switch {
- "addr" => regs => regs[args[2]] = regs[args[0]] + regs[args[1]],
- "addi" => regs => regs[args[2]] = regs[args[0]] + args[1],
- "mulr" => regs => regs[args[2]] = regs[args[0]] * regs[args[1]],
- "muli" => regs => regs[args[2]] = regs[args[0]] * args[1],
- "banr" => regs => regs[args[2]] = regs[args[0]] & regs[args[1]],
- "bani" => regs => regs[args[2]] = regs[args[0]] & args[1],
- "borr" => regs => regs[args[2]] = regs[args[0]] | regs[args[1]],
- "bori" => regs => regs[args[2]] = regs[args[0]] | args[1],
- "setr" => regs => regs[args[2]] = regs[args[0]],
- "seti" => regs => regs[args[2]] = args[0],
- "gtir" => regs => regs[args[2]] = args[0] > regs[args[1]] ? 1 : 0,
- "gtri" => regs => regs[args[2]] = regs[args[0]] > args[1] ? 1 : 0,
- "gtrr" => regs => regs[args[2]] = regs[args[0]] > regs[args[1]] ? 1 : 0,
- "eqir" => regs => regs[args[2]] = args[0] == regs[args[1]] ? 1 : 0,
- "eqri" => regs => regs[args[2]] = regs[args[0]] == args[1] ? 1 : 0,
- "eqrr" => regs => regs[args[2]] = regs[args[0]] == regs[args[1]] ? 1 : 0,
- _ => throw new ArgumentException()
- };
- }
-}
diff --git a/2018/Day21/input.in b/2018/Day21/input.in
deleted file mode 100644
index 157525118..000000000
Binary files a/2018/Day21/input.in and /dev/null differ
diff --git a/2018/Day21/input.refout b/2018/Day21/input.refout
deleted file mode 100644
index 10dd1ba29..000000000
--- a/2018/Day21/input.refout
+++ /dev/null
@@ -1,2 +0,0 @@
-16311888
-1413889
diff --git a/2018/Day22/README.md b/2018/Day22/README.md
deleted file mode 100644
index 37a01eb08..000000000
--- a/2018/Day22/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-## --- Day 22: Mode Maze ---
-This is it, your final stop: the year -483. It's snowing and dark outside; the only light you can see is coming from a small cottage in the distance. You make your way there and knock on the door.
-
-A portly man with a large, white beard answers the door and invites you inside. For someone living near the North Pole in -483, he must not get many visitors, but he doesn't act surprised to see you. Instead, he offers you some milk and cookies.
-
-Read the [full puzzle](https://adventofcode.com/2018/day/22).
\ No newline at end of file
diff --git a/2018/Day22/Solution.cs b/2018/Day22/Solution.cs
deleted file mode 100644
index 4cbd7a6b5..000000000
--- a/2018/Day22/Solution.cs
+++ /dev/null
@@ -1,155 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text.RegularExpressions;
-
-namespace AdventOfCode.Y2018.Day22;
-
-[ProblemName("Mode Maze")]
-class Solution : Solver {
-
- public object PartOne(string input) {
- var (targetX, targetY, regionType) = Parse(input);
- var riskLevel = 0;
- for (var y = 0; y <= targetY; y++) {
- for (var x = 0; x <= targetX; x++) {
- riskLevel += (int)regionType(x, y);
- }
- }
- return riskLevel;
- }
-
-
- public object PartTwo(string input) {
- var (targetX, targetY, regionType) = Parse(input);
- var q = new PQueue<((int x, int y) pos, Tool tool, int t)>();
- var seen = new HashSet<((int x, int y), Tool tool)>();
-
- IEnumerable<((int x, int y) pos, Tool tool, int dt)> Neighbours((int x, int y) pos, Tool tool) {
- yield return regionType(pos.x, pos.y) switch {
- RegionType.Rocky => (pos, tool == Tool.ClimbingGear ? Tool.Torch : Tool.ClimbingGear, 7),
- RegionType.Narrow => (pos, tool == Tool.Torch ? Tool.Nothing : Tool.Torch, 7),
- RegionType.Wet => (pos, tool == Tool.ClimbingGear ? Tool.Nothing : Tool.ClimbingGear, 7),
- _ => throw new ArgumentException()
- };
-
- foreach (var dx in new[] { -1, 0, 1 }) {
- foreach (var dy in new[] { -1, 0, 1 }) {
- if (Math.Abs(dx) + Math.Abs(dy) != 1) {
- continue;
- }
-
- var posNew = (x: pos.x + dx, y: pos.y + dy);
- if (posNew.x < 0 || posNew.y < 0) {
- continue;
- }
-
- switch (regionType(posNew.x, posNew.y)) {
- case RegionType.Rocky when tool == Tool.ClimbingGear || tool == Tool.Torch:
- case RegionType.Narrow when tool == Tool.Torch || tool == Tool.Nothing:
- case RegionType.Wet when tool == Tool.ClimbingGear || tool == Tool.Nothing:
- yield return (posNew, tool, 1);
- break;
- }
- }
- }
- }
-
- q.Enqueue(0, ((0, 0), Tool.Torch, 0));
-
- while (q.Any()) {
- var state = q.Dequeue();
- var (pos, tool, t) = state;
-
- if (pos.x == targetX && pos.y == targetY && tool == Tool.Torch) {
- return t;
- }
-
- var hash = (pos, tool);
- if (seen.Contains(hash)) {
- continue;
- }
-
- seen.Add(hash);
-
- foreach( var (newPos, newTool, dt) in Neighbours(pos, tool)) {
- q.Enqueue(
- t + dt + Math.Abs(newPos.x - targetX) + Math.Abs(newPos.y - targetY),
- (newPos, newTool, t + dt)
- );
- }
-
- }
-
- throw new Exception();
- }
-
- (int targetX, int targetY, Func regionType) Parse(string input) {
- var lines = input.Split("\n");
- var depth = Regex.Matches(lines[0], @"\d+").Select(x => int.Parse(x.Value)).Single();
- var target = Regex.Matches(lines[1], @"\d+").Select(x => int.Parse(x.Value)).ToArray();
- var (targetX, targetY) = (target[0], target[1]);
-
- var m = 20183;
-
- var erosionLevelCache = new Dictionary<(int, int), int>();
- int erosionLevel(int x, int y) {
- var key = (x, y);
- if (!erosionLevelCache.ContainsKey(key)) {
- if (x == targetX && y == targetY) {
- erosionLevelCache[key] = depth;
- } else if (x == 0 && y == 0) {
- erosionLevelCache[key] = depth;
- } else if (x == 0) {
- erosionLevelCache[key] = ((y * 48271) + depth) % m;
- } else if (y == 0) {
- erosionLevelCache[key] = ((x * 16807) + depth) % m;
- } else {
- erosionLevelCache[key] = ((erosionLevel(x, y - 1) * erosionLevel(x - 1, y)) + depth) % m;
- }
- }
- return erosionLevelCache[key];
- }
-
- RegionType regionType(int x, int y) {
- return (RegionType)(erosionLevel(x, y) % 3);
- }
-
- return (targetX, targetY, regionType);
- }
-}
-enum RegionType {
- Rocky = 0,
- Wet = 1,
- Narrow = 2
-}
-
-enum Tool {
- Nothing,
- Torch,
- ClimbingGear
-}
-
-class PQueue {
- SortedDictionary> d = new SortedDictionary>();
- public bool Any() {
- return d.Any();
- }
-
- public void Enqueue(int p, T t) {
- if (!d.ContainsKey(p)) {
- d[p] = new Queue();
- }
- d[p].Enqueue(t);
- }
-
- public T Dequeue() {
- var p = d.Keys.First();
- var items = d[p];
- var t = items.Dequeue();
- if (!items.Any()) {
- d.Remove(p);
- }
- return t;
- }
-}
diff --git a/2018/Day22/input.in b/2018/Day22/input.in
deleted file mode 100644
index b30a77446..000000000
Binary files a/2018/Day22/input.in and /dev/null differ
diff --git a/2018/Day22/input.refout b/2018/Day22/input.refout
deleted file mode 100644
index 3f363443a..000000000
--- a/2018/Day22/input.refout
+++ /dev/null
@@ -1,2 +0,0 @@
-11462
-1054
diff --git a/2018/Day23/README.md b/2018/Day23/README.md
deleted file mode 100644
index 9557f08ef..000000000
--- a/2018/Day23/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-## --- Day 23: Experimental Emergency Teleportation ---
-Using your torch to search the darkness of the rocky cavern, you finally locate the man's friend: a small *reindeer*.
-
-You're not sure how it got so far in this cave. It looks sick - too sick to walk - and too heavy for you to carry all the way back. Sleighs won't be invented for another 1500 years, of course.
-
-Read the [full puzzle](https://adventofcode.com/2018/day/23).
\ No newline at end of file
diff --git a/2018/Day23/Solution.cs b/2018/Day23/Solution.cs
deleted file mode 100644
index cdd5e0fda..000000000
--- a/2018/Day23/Solution.cs
+++ /dev/null
@@ -1,178 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Numerics;
-using System.Text.RegularExpressions;
-
-namespace AdventOfCode.Y2018.Day23;
-
-[ProblemName("Experimental Emergency Teleportation")]
-class Solution : Solver {
-
- int Dist((int x, int y, int z) a, (int x, int y, int z) b) => Math.Abs(a.x - b.x) + Math.Abs(a.y - b.y) + Math.Abs(a.z - b.z);
-
- public object PartOne(string input) {
- var drones = Parse(input);
- var maxRange = drones.Select(drone => drone.r).Max();
- var maxDrone = drones.Single(drone => drone.r == maxRange);
- return drones.Count(drone => Dist(drone.pos, maxDrone.pos) <= maxRange);
- }
-
- IEnumerable<(int x, int y, int z)> Corners(Drone[] drones) => (
- from drone in drones
- from dx in new[] { -1, 0, 1 }
- from dy in new[] { -1, 0, 1 }
- from dz in new[] { -1, 0, 1 }
- where dx * dx + dy * dy + dz * dz == 1
- select (drone.pos.x + dx * drone.r, drone.pos.y + dy * drone.r, drone.pos.z + dz * drone.r)
- ).ToArray();
-
- Drone[] Parse(string input) => (
- from line in input.Split("\n")
- let parts = Regex.Matches(line, @"-?\d+").Select(x => int.Parse(x.Value)).ToArray()
- select new Drone((parts[0], parts[1], parts[2]), parts[3])
- ).ToArray();
-
- public object PartTwo(string input) {
- var drones = Parse(input);
- var minX = drones.Select(drone => drone.pos.x).Min();
- var minY = drones.Select(drone => drone.pos.y).Min();
- var minZ = drones.Select(drone => drone.pos.z).Min();
-
- var maxX = drones.Select(drone => drone.pos.x).Max();
- var maxY = drones.Select(drone => drone.pos.y).Max();
- var maxZ = drones.Select(drone => drone.pos.z).Max();
-
- return Solve(new Box((minX, minY, minZ), (maxX - minX + 1, maxY - minY + 1, maxZ - minZ + 1)), drones).pt;
- }
-
- (int drones, int pt) Solve(Box box, Drone[] drones) {
-
- var q = new PQueue<(int, int), (Box box, Drone[] drones)>();
- q.Enqueue((0, 0), (box, drones));
-
- while (q.Any()) {
- (box, drones) = q.Dequeue();
-
- if (box.Size() == 1) {
- return (drones.Count(drone => drone.Contains(box)), box.Dist());
- } else {
- foreach (var subBox in box.Divide()) {
- var intersectingDrones = drones.Where(drone => drone.Intersects(subBox)).ToArray();
- q.Enqueue((-intersectingDrones.Count(), subBox.Dist()), (subBox, intersectingDrones));
- }
- }
- }
- throw new Exception();
- }
-
-}
-
-class Box {
- public readonly (int x, int y, int z) min;
- public readonly (int x, int y, int z) max;
- private readonly (int sx, int sy, int sz) size;
- public Box((int x, int y, int z) min, (int sx, int sy, int sz) size) {
- this.min = min;
- this.max = (min.x + size.sx - 1, min.y + size.sy - 1, min.z + size.sz - 1);
- this.size = size;
- }
-
- public IEnumerable<(int x, int y, int z)> Corners() {
- yield return (min.x, min.y, min.z);
- yield return (max.x, min.y, min.z);
- yield return (min.x, max.y, min.z);
- yield return (max.x, max.y, min.z);
-
- yield return (min.x, min.y, max.z);
- yield return (max.x, min.y, max.z);
- yield return (min.x, max.y, max.z);
- yield return (max.x, max.y, max.z);
- }
-
- public IEnumerable Divide() {
- var sx = size.sx / 2;
- var tx = size.sx - sx;
- var sy = size.sy / 2;
- var ty = size.sy - sy;
- var sz = size.sz / 2;
- var tz = size.sz - sz;
-
- return new[]{
- new Box((min.x, min.y, min.z ), (sx, sy, sz)),
- new Box((min.x + sx, min.y, min.z ), (tx, sy, sz)),
- new Box((min.x, min.y + sy, min.z ), (sx, ty, sz)),
- new Box((min.x + sx, min.y + sy, min.z ), (tx, ty, sz)),
-
- new Box((min.x, min.y, min.z + sz), (sx, sy, tz)),
- new Box((min.x + sx, min.y, min.z + sz), (tx, sy, tz)),
- new Box((min.x, min.y + sy, min.z + sz), (sx, ty, tz)),
- new Box((min.x + sx, min.y + sy, min.z + sz), (tx, ty, tz)),
-
- }.Where(box => box.size.sx > 0 && box.size.sy > 0 && box.size.sz > 0);
- }
-
- public int Dist() {
- return Corners().Select(pt => Math.Abs(pt.x) + Math.Abs(pt.y) + Math.Abs(pt.z)).Min();
- }
-
- public BigInteger Size() {
- return (BigInteger)size.sx * (BigInteger)size.sy * (BigInteger)size.sz;
- }
-}
-
-class Drone {
- public readonly (int x, int y, int z) pos;
- public readonly int r;
- public readonly Box box;
- public Drone((int x, int y, int z) pos, int r) {
- this.pos = pos;
- this.r = r;
- box = new Box((pos.x - r, pos.y - r, pos.z - r), (2 * r + 1, 2 * r + 1, 2 * r + 1));
- }
-
- public bool Intersects(Box box) {
- var dx = Math.Max(0, Math.Max(box.min.x - pos.x, pos.x - box.max.x));
- var dy = Math.Max(0, Math.Max(box.min.y - pos.y, pos.y - box.max.y));
- var dz = Math.Max(0, Math.Max(box.min.z - pos.z, pos.z - box.max.z));
-
- return Math.Abs(dx) + Math.Abs(dy) + Math.Abs(dz) <= r;
- }
-
- public bool Contains(Box box) {
- return box
- .Corners()
- .All(pt => Math.Abs(pt.x - pos.x) + Math.Abs(pt.y - pos.y) + Math.Abs(pt.z - pos.z) <= r);
- }
-}
-
-class PQueue where K : IComparable {
- SortedDictionary> d = new SortedDictionary>();
- int c = 0;
- public bool Any() {
- return d.Any();
- }
-
- public void Enqueue(K p, T t) {
- if (!d.ContainsKey(p)) {
- d[p] = new Queue();
- }
- d[p].Enqueue(t);
- c++;
- }
-
- public T Dequeue() {
- c--;
- var p = d.Keys.First();
- var items = d[p];
- var t = items.Dequeue();
- if (!items.Any()) {
- d.Remove(p);
- }
- return t;
- }
-
- public int Count() {
- return c;
- }
-}
diff --git a/2018/Day23/input.in b/2018/Day23/input.in
deleted file mode 100644
index caf7024a6..000000000
Binary files a/2018/Day23/input.in and /dev/null differ
diff --git a/2018/Day23/input.refout b/2018/Day23/input.refout
deleted file mode 100644
index c19db2c2e..000000000
--- a/2018/Day23/input.refout
+++ /dev/null
@@ -1,2 +0,0 @@
-219
-83779034
diff --git a/2018/Day24/README.md b/2018/Day24/README.md
deleted file mode 100644
index 8b9e7ab6f..000000000
--- a/2018/Day24/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-## --- Day 24: Immune System Simulator 20XX ---
-After [a weird buzzing noise](https://www.youtube.com/watch?v=NDVjLt_QHL8&t=7), you appear back at the man's cottage. He seems relieved to see his friend, but quickly notices that the little reindeer caught some kind of cold while out exploring.
-
-The portly man explains that this reindeer's immune system isn't similar to regular reindeer immune systems:
-
-Read the [full puzzle](https://adventofcode.com/2018/day/24).
\ No newline at end of file
diff --git a/2018/Day24/Solution.cs b/2018/Day24/Solution.cs
deleted file mode 100644
index 8f00a5a55..000000000
--- a/2018/Day24/Solution.cs
+++ /dev/null
@@ -1,140 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text.RegularExpressions;
-
-namespace AdventOfCode.Y2018.Day24;
-
-[ProblemName("Immune System Simulator 20XX")]
-class Solution : Solver {
-
- (bool immuneSystem, long units) Fight(string input, int boost) {
- var army = Parse(input);
- foreach (var g in army) {
- if (g.immuneSystem) {
- g.damage += boost;
- }
- }
- var attack = true;
- while (attack) {
- attack = false;
- var remainingTarget = new HashSet(army);
- var targets = new Dictionary();
- foreach (var g in army.OrderByDescending(g => (g.effectivePower, g.initiative))) {
- var maxDamage = remainingTarget.Select(t => g.DamageDealtTo(t)).Max();
- if (maxDamage > 0) {
- var possibleTargets = remainingTarget.Where(t => g.DamageDealtTo(t) == maxDamage);
- targets[g] = possibleTargets.OrderByDescending(t => (t.effectivePower, t.initiative)).First();
- remainingTarget.Remove(targets[g]);
- }
- }
- foreach (var g in targets.Keys.OrderByDescending(g => g.initiative)) {
- if (g.units > 0) {
- var target = targets[g];
- var damage = g.DamageDealtTo(target);
- if (damage > 0 && target.units > 0) {
- var dies = damage / target.hp;
- target.units = Math.Max(0, target.units - dies);
- if (dies > 0) {
- attack = true;
- }
- }
- }
- }
- army = army.Where(g => g.units > 0).ToList();
- }
- return (army.All(x => x.immuneSystem), army.Select(x => x.units).Sum());
- }
-
- public object PartOne(string input) => Fight(input, 0).units;
-
- public object PartTwo(string input) {
- var l = 0;
- var h = int.MaxValue / 2;
- while (h - l > 1) {
- var m = (h + l) / 2;
- if (Fight(input, m).immuneSystem) {
- h = m;
- } else {
- l = m;
- }
- }
- return Fight(input, h).units;
- }
-
- List Parse(string input) {
- var lines = input.Split("\n");
- var immuneSystem = false;
- var res = new List();
- foreach (var line in lines)
- if (line == "Immune System:") {
- immuneSystem = true;
- } else if (line == "Infection:") {
- immuneSystem = false;
- } else if (line != "") {
- //643 units each with 9928 hit points (immune to fire; weak to slashing, bludgeoning) with an attack that does 149 fire damage at initiative 14
- var rx = @"(\d+) units each with (\d+) hit points(.*)with an attack that does (\d+)(.*)damage at initiative (\d+)";
- var m = Regex.Match(line, rx);
- if (m.Success) {
- Group g = new Group();
- g.immuneSystem = immuneSystem;
- g.units = int.Parse(m.Groups[1].Value);
- g.hp = int.Parse(m.Groups[2].Value);
- g.damage = int.Parse(m.Groups[4].Value);
- g.attackType = m.Groups[5].Value.Trim();
- g.initiative = int.Parse(m.Groups[6].Value);
- var st = m.Groups[3].Value.Trim();
- if (st != "") {
- st = st.Substring(1, st.Length - 2);
- foreach (var part in st.Split(";")) {
- var k = part.Split(" to ");
- var set = new HashSet(k[1].Split(", "));
- var w = k[0].Trim();
- if (w == "immune") {
- g.immuneTo = set;
- } else if (w == "weak") {
- g.weakTo = set;
- } else {
- throw new Exception();
- }
- }
- }
- res.Add(g);
- } else {
- throw new Exception();
- }
-
- }
- return res;
- }
-}
-
-class Group {
- //4 units each with 9798 hit points (immune to bludgeoning) with an attack that does 1151 fire damage at initiative 9
- public bool immuneSystem;
- public long units;
- public int hp;
- public int damage;
- public int initiative;
- public string attackType;
- public HashSet immuneTo = new HashSet();
- public HashSet weakTo = new HashSet();
-
- public long effectivePower {
- get {
- return units * damage;
- }
- }
-
- public long DamageDealtTo(Group target) {
- if (target.immuneSystem == immuneSystem) {
- return 0;
- } else if (target.immuneTo.Contains(attackType)) {
- return 0;
- } else if (target.weakTo.Contains(attackType)) {
- return effectivePower * 2;
- } else {
- return effectivePower;
- }
- }
-}
diff --git a/2018/Day24/input.in b/2018/Day24/input.in
deleted file mode 100644
index 211b05595..000000000
Binary files a/2018/Day24/input.in and /dev/null differ
diff --git a/2018/Day24/input.refout b/2018/Day24/input.refout
deleted file mode 100644
index 346246eb9..000000000
--- a/2018/Day24/input.refout
+++ /dev/null
@@ -1,2 +0,0 @@
-33551
-760
diff --git a/2018/Day25/README.md b/2018/Day25/README.md
deleted file mode 100644
index 9d1c5fc54..000000000
--- a/2018/Day25/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-## --- Day 25: Four-Dimensional Adventure ---
-The reindeer's symptoms are getting worse, and neither you nor the white-bearded man have a solution. At least the reindeer has a warm place to rest: a small bed near where you're sitting.
-
-As you reach down, the reindeer looks up at you, accidentally bumping a button on your wrist-mounted device with its nose in the process - a button labeled *"help"*.
-
-Read the [full puzzle](https://adventofcode.com/2018/day/25).
\ No newline at end of file
diff --git a/2018/Day25/Solution.cs b/2018/Day25/Solution.cs
deleted file mode 100644
index dc882125d..000000000
--- a/2018/Day25/Solution.cs
+++ /dev/null
@@ -1,44 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-
-namespace AdventOfCode.Y2018.Day25;
-
-[ProblemName("Four-Dimensional Adventure")]
-class Solution : Solver {
-
- public object PartOne(string input) {
- var sets = new List>();
-
- foreach (var line in input.Split("\n")) {
- var set = new HashSet();
- set.Add(line.Split(",").Select(int.Parse).ToArray());
- sets.Add(set);
- }
-
- foreach (var set in sets.ToList()) {
- var pt = set.Single();
- var closeSets = new List>();
- foreach (var setB in sets) {
- foreach (var ptB in setB) {
- if (Dist(pt, ptB) <= 3) {
- closeSets.Add(setB);
- }
- }
- }
- var mergedSet = new HashSet();
- foreach (var setB in closeSets) {
- foreach (var ptB in setB) {
- mergedSet.Add(ptB);
- }
- sets.Remove(setB);
- }
- sets.Add(mergedSet);
- }
-
- return sets.Count;
- }
-
- int Dist(int[] a, int[] b) => Enumerable.Range(0, a.Length).Select(i => Math.Abs(a[i] - b[i])).Sum();
-
-}
diff --git a/2018/Day25/input.in b/2018/Day25/input.in
deleted file mode 100644
index 9f40980a4..000000000
Binary files a/2018/Day25/input.in and /dev/null differ
diff --git a/2018/Day25/input.refout b/2018/Day25/input.refout
deleted file mode 100644
index fae513888..000000000
--- a/2018/Day25/input.refout
+++ /dev/null
@@ -1 +0,0 @@
-381
diff --git a/2018/README.md b/2018/README.md
deleted file mode 100644
index 1d7ec08e1..000000000
--- a/2018/README.md
+++ /dev/null
@@ -1,4 +0,0 @@
-# Advent of Code (2018)
-Check out https://adventofcode.com/2018.
-
-
diff --git a/2018/SplashScreen.cs b/2018/SplashScreen.cs
deleted file mode 100644
index 56bcdf187..000000000
--- a/2018/SplashScreen.cs
+++ /dev/null
@@ -1,170 +0,0 @@
-using System;
-
-namespace AdventOfCode.Y2018;
-
-class SplashScreenImpl : SplashScreen {
-
- public void Show() {
-
- var color = Console.ForegroundColor;
- Write(0xcc00, false, " ▄█▄ ▄▄█ ▄ ▄ ▄▄▄ ▄▄ ▄█▄ ▄▄▄ ▄█ ▄▄ ▄▄▄ ▄▄█ ▄▄▄\n █▄█ █ █ █ █ █▄█ █ █ █ █ █ █▄ ");
- Write(0xcc00, false, " █ █ █ █ █ █▄█\n █ █ █▄█ ▀▄▀ █▄▄ █ █ █▄ █▄█ █ █▄ █▄█ █▄█ █▄▄ 0x0000 | 2018\n ");
- Write(0xcc00, false, " \n ");
- Write(0xcccccc, false, ". . . . . 25 ");
- Write(0xffff66, false, "**\n ");
- Write(0xcccccc, false, ". . . . ");
- Write(0x886655, false, "\\ / ");
- Write(0xcccccc, false, ". 24 ");
- Write(0xffff66, false, "**\n ");
- Write(0xcccccc, false, ". . ");
- Write(0x886655, false, "\\_\\_\\|_/__/ ");
- Write(0xcccccc, false, "23 ");
- Write(0xffff66, false, "**\n ");
- Write(0xcccccc, false, ". . . ");
- Write(0xff0000, true, "o");
- Write(0x886655, false, "-_/");
- Write(0xcccccc, false, ".()");
- Write(0x886655, false, "__------- ");
- Write(0xcccccc, false, "22 ");
- Write(0xffff66, false, "**\n ");
- Write(0xcccccc, false, ". . ");
- Write(0xffff66, true, "* ");
- Write(0x886655, false, "\\____ ");
- Write(0xcccccc, false, "21 ");
- Write(0xffff66, false, "**\n ");
- Write(0xcccccc, false, ". ");
- Write(0xff0000, false, "|");
- Write(0xcccccc, false, "\\| \\_");
- Write(0x886655, false, "\\_ ");
- Write(0xcccccc, false, "___ / 20 ");
- Write(0xffff66, false, "**\n ");
- Write(0xcccccc, false, ". |");
- Write(0xff0000, false, "\\| ");
- Write(0x886655, false, "/ | || ");
- Write(0xcccccc, false, "19 ");
- Write(0xffff66, false, "**\n ");
- Write(0xcccccc, false, ". ");
- Write(0x66ff, false, "_________");
- Write(0xff0000, false, "|");
- Write(0xcccccc, false, "\\|");
- Write(0x66ff, false, "_________ ");
- Write(0x886655, false, "/ | || ");
- Write(0xcccccc, false, "18 ");
- Write(0xffff66, false, "**\n ");
- Write(0x66ff, false, "___----- ");
- Write(0xcccccc, false, "########### ##### ");
- Write(0x66ff, false, "-----___ ");
- Write(0xcccccc, false, "17 ");
- Write(0xffff66, false, "**\n ");
- Write(0x66ff, false, "___--- ");
- Write(0xcccccc, false, "### ##### ######### ##### ");
- Write(0x66ff, false, "---___ ");
- Write(0xcccccc, false, "16 ");
- Write(0xffff66, false, "**\n ");
- Write(0xcccccc, false, ") )) ) ) __");
- Write(0xff0000, false, "__ ");
- Write(0xcccccc, false, "15 ");
- Write(0xffff66, false, "**\n ");
- Write(0xff0000, false, ".-");
- Write(0xcccccc, false, "(");
- Write(0xff0000, false, "-");
- Write(0xcccccc, false, "((");
- Write(0xff0000, false, "-. ");
- Write(0x9900, false, ".--");
- Write(0xcccccc, false, "(");
- Write(0x9900, false, "-");
- Write(0xcccccc, false, "(");
- Write(0x9900, false, "-. ");
- Write(0xff0000, false, "/ ");
- Write(0xcccccc, false, "_");
- Write(0xff0000, false, "\\ ");
- Write(0xcccccc, false, "\\ 14 ");
- Write(0xffff66, false, "**\n ");
- Write(0xff0000, false, "'------'_ ");
- Write(0x9900, false, "'------'_ ");
- Write(0xff0000, false, "|");
- Write(0xcccccc, false, "/| |/");
- Write(0xff0000, false, "| ");
- Write(0xcccccc, false, "13 ");
- Write(0xffff66, false, "**\n ");
- Write(0xff0000, false, "| | ) ");
- Write(0x9900, false, "| | ) ");
- Write(0xcccccc, false, "|_| ");
- Write(0xff0000, false, "|/");
- Write(0xcccccc, false, "| 12 ");
- Write(0xffff66, false, "**\n ");
- Write(0xff0000, false, "| |/ ");
- Write(0x9900, false, "| |/ ");
- Write(0xcccccc, false, "|/");
- Write(0xff0000, false, "| ");
- Write(0xcccccc, false, "11 ");
- Write(0xffff66, false, "**\n ");
- Write(0xff0000, false, "'------' ");
- Write(0x9900, false, "'------' ");
- Write(0xff0000, false, "|/");
- Write(0xcccccc, false, "| 10 ");
- Write(0xffff66, false, "**\n ");
- Write(0xff0000, false, "_ __ ");
- Write(0xcccccc, false, "|/");
- Write(0xff0000, false, "| ");
- Write(0xcccccc, false, " 9 ");
- Write(0xffff66, false, "**\n ");
- Write(0xff0000, false, ".---_ _ ");
- Write(0x880000, false, "| ");
- Write(0xff0000, false, "|\\__");
- Write(0x880000, false, "/");
- Write(0xff0000, false, "_/) |/");
- Write(0xcccccc, false, "| 8 ");
- Write(0xffff66, false, "**\n ");
- Write(0xff0000, false, "/ ");
- Write(0x880000, false, "/ ");
- Write(0xff0000, false, "/\\| ");
- Write(0x999999, false, "__ ");
- Write(0x880000, false, ") ");
- Write(0xff0000, false, ")__ ");
- Write(0x880000, false, "_|");
- Write(0xff0000, false, "_| / ");
- Write(0xcccccc, false, "|/");
- Write(0xff0000, false, "| ");
- Write(0xcccccc, false, " 7 ");
- Write(0xffff66, false, "**\n ");
- Write(0xff0000, false, "/ ");
- Write(0x880000, false, "/ | ");
- Write(0xff0000, false, "\\ ");
- Write(0xffff66, true, "* ");
- Write(0x999999, false, "/ / \\ ");
- Write(0x880000, false, "( ");
- Write(0xff0000, false, "( \\_");
- Write(0x880000, false, "/");
- Write(0xff0000, false, "_/ / |/");
- Write(0xcccccc, false, "| 6 ");
- Write(0xffff66, false, "**\n ");
- Write(0xff0000, false, "/ ");
- Write(0x880000, false, "/ \\ ");
- Write(0xff0000, false, "\\ ");
- Write(0x999999, false, "| | \\/ ");
- Write(0x880000, false, "\\_");
- Write(0xff0000, false, "\\____________/ ");
- Write(0xcccccc, false, "|_| 5 ");
- Write(0xffff66, false, "**\n ");
- Write(0xff0000, false, "/ ");
- Write(0x880000, false, "/ / \\ ");
- Write(0xff0000, false, "\\ ");
- Write(0x999999, false, "\\_\\______X_____X_____X_, ");
- Write(0xcccccc, false, " 4 ");
- Write(0xffff66, false, "**\n ");
- Write(0xcccccc, false, "./~~~~~~~~~~~\\. 3 ");
- Write(0xffff66, false, "**\n ");
- Write(0xcccccc, false, "( .\",^. -\". '.~ ) 2 ");
- Write(0xffff66, false, "**\n ");
- Write(0xcccccc, false, "_'~~~~~~~~~~~~~'_________ ___ __ _ _ _ _ 1 ");
- Write(0xffff66, false, "**\n \n");
-
- Console.ForegroundColor = color;
- Console.WriteLine();
- }
-
- private static void Write(int rgb, bool bold, string text){
- Console.Write($"\u001b[38;2;{(rgb>>16)&255};{(rgb>>8)&255};{rgb&255}{(bold ? ";1" : "")}m{text}");
- }
-}
\ No newline at end of file
diff --git a/2018/calendar.svg b/2018/calendar.svg
deleted file mode 100644
index 341b34a67..000000000
--- a/2018/calendar.svg
+++ /dev/null
@@ -1,46 +0,0 @@
-
\ No newline at end of file
diff --git a/2019/Day01/README.md b/2019/Day01/README.md
deleted file mode 100644
index 0cca1558b..000000000
--- a/2019/Day01/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-## --- Day 1: The Tyranny of the Rocket Equation ---
-Santa has become stranded at the edge of the Solar System while delivering presents to other planets! To accurately calculate his position in space, safely align his warp drive, and return to Earth in time to save Christmas, he needs you to bring him measurements from fifty stars.
-
-Collect stars by solving puzzles. Two puzzles will be made available on each day in the Advent calendar; the second puzzle is unlocked when you complete the first. Each puzzle grants one star. Good luck!
-
-_Visit the website for the full story and [full puzzle](https://adventofcode.com/2019/day/1) description._
diff --git a/2019/Day01/Solution.cs b/2019/Day01/Solution.cs
deleted file mode 100644
index 9a68bfd44..000000000
--- a/2019/Day01/Solution.cs
+++ /dev/null
@@ -1,28 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-
-namespace AdventOfCode.Y2019.Day01;
-
-[ProblemName("The Tyranny of the Rocket Equation")]
-class Solution : Solver {
-
- public object PartOne(string input) => Solve(input, false);
- public object PartTwo(string input) => Solve(input, true);
-
- int Solve(string input, bool recursive) {
- var weights = new Queue(input.Split("\n").Select(x => int.Parse(x)));
- var res = 0;
- while (weights.Any()) {
- var weight = weights.Dequeue();
- var fuel = (int)(Math.Floor(weight / 3.0) - 2);
- if (fuel > 0) {
- if (recursive) {
- weights.Enqueue(fuel);
- }
- res += fuel;
- }
- }
- return res;
- }
-}
diff --git a/2019/Day01/input.in b/2019/Day01/input.in
deleted file mode 100644
index 2db97c2a8..000000000
Binary files a/2019/Day01/input.in and /dev/null differ
diff --git a/2019/Day01/input.refout b/2019/Day01/input.refout
deleted file mode 100644
index 5a56d38f4..000000000
--- a/2019/Day01/input.refout
+++ /dev/null
@@ -1,2 +0,0 @@
-3465154
-5194864
\ No newline at end of file
diff --git a/2019/Day02/README.md b/2019/Day02/README.md
deleted file mode 100644
index d7c41c9ef..000000000
--- a/2019/Day02/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-## --- Day 2: 1202 Program Alarm ---
-On the way to your [gravity assist](https://en.wikipedia.org/wiki/Gravity_assist) around the Moon, your ship computer beeps angrily about a "[1202 program alarm](https://www.hq.nasa.gov/alsj/a11/a11.landing.html#1023832)". On the radio, an Elf is already explaining how to handle the situation: "Don't worry, that's perfectly norma--" The ship computer [bursts into flames](https://en.wikipedia.org/wiki/Halt_and_Catch_Fire).
-
-You notify the Elves that the computer's [magic smoke](https://en.wikipedia.org/wiki/Magic_smoke) seems to have escaped. "That computer ran *Intcode* programs like the gravity assist program it was working on; surely there are enough spare parts up there to build a new Intcode computer!"
-
-Read the [full puzzle](https://adventofcode.com/2019/day/2).
\ No newline at end of file
diff --git a/2019/Day02/Solution.cs b/2019/Day02/Solution.cs
deleted file mode 100644
index 0cae0cb68..000000000
--- a/2019/Day02/Solution.cs
+++ /dev/null
@@ -1,32 +0,0 @@
-using System;
-
-namespace AdventOfCode.Y2019.Day02;
-
-[ProblemName("1202 Program Alarm")]
-class Solution : Solver {
-
- public object PartOne(string input) => ExecIntCode(new IntCodeMachine(input), 12, 2);
-
- public object PartTwo(string input) {
- var icm = new IntCodeMachine(input);
-
- for (var sum = 0; ; sum++) {
- for (var verb = 0; verb <= sum; verb++) {
- var noun = sum - verb;
- var res = ExecIntCode(icm, noun, verb);
- if (res == 19690720) {
- return 100 * noun + verb;
- }
- }
- }
- throw new Exception();
- }
-
- long ExecIntCode(IntCodeMachine icm, int noun, int verb) {
- icm.Reset();
- icm.memory[1] = noun;
- icm.memory[2] = verb;
- icm.Run();
- return icm.memory[0];
- }
-}
diff --git a/2019/Day02/input.in b/2019/Day02/input.in
deleted file mode 100644
index 3cff00467..000000000
Binary files a/2019/Day02/input.in and /dev/null differ
diff --git a/2019/Day02/input.refout b/2019/Day02/input.refout
deleted file mode 100644
index b5d16152e..000000000
--- a/2019/Day02/input.refout
+++ /dev/null
@@ -1,2 +0,0 @@
-3850704
-6718
diff --git a/2019/Day03/README.md b/2019/Day03/README.md
deleted file mode 100644
index a2d766739..000000000
--- a/2019/Day03/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-## --- Day 3: Crossed Wires ---
-The gravity assist was successful, and you're well on your way to the Venus refuelling station. During the rush back on Earth, the fuel management system wasn't completely installed, so that's next on the priority list.
-
-Opening the front panel reveals a jumble of wires. Specifically, *two wires* are connected to a central port and extend outward on a grid. You trace the path each wire takes as it leaves the central port, one wire per line of text (your puzzle input).
-
-Read the [full puzzle](https://adventofcode.com/2019/day/3).
\ No newline at end of file
diff --git a/2019/Day03/Solution.cs b/2019/Day03/Solution.cs
deleted file mode 100644
index 86942e933..000000000
--- a/2019/Day03/Solution.cs
+++ /dev/null
@@ -1,50 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-
-namespace AdventOfCode.Y2019.Day03;
-
-[ProblemName("Crossed Wires")]
-class Solution : Solver {
-
- public object PartOne(string input) => Solve(input, (x) => Math.Abs(x.irow) + Math.Abs(x.icol));
-
- public object PartTwo(string input) => Solve(input, (x) => x.distance1 + x.distance2);
-
- int Solve(string input, Func<(int irow, int icol, int distance1, int distance2), int> distance) {
- var paths = input.Split("\n");
- var trace1 = Trace(paths[0]);
- var trace2 = Trace(paths[1]);
-
- var distances =
- from pos in trace1.Keys
- where trace2.ContainsKey(pos)
- select distance((pos.irow, pos.icol, trace1[pos], trace2[pos]));
- return distances.Min();
- }
-
- Dictionary<(int irow, int icol), int> Trace(string path) {
- var res = new Dictionary<(int irow, int icol), int>();
-
- var (irow, icol, distance) = (0, 0, 0);
- foreach (var step in path.Split(",")) {
- var (drow, dcol) = step[0] switch {
- 'U' => (-1, 0),
- 'D' => (1, 0),
- 'R' => (0, -1),
- 'L' => (0, 1),
- _ => throw new ArgumentException()
- };
-
- for (var i = 0; i < int.Parse(step.Substring(1)); i++) {
- (irow, icol, distance) = (irow + drow, icol + dcol, distance + 1);
-
- if (!res.ContainsKey((irow, icol))) {
- res[(irow, icol)] = distance;
- }
- }
- }
-
- return res;
- }
-}
diff --git a/2019/Day03/input.in b/2019/Day03/input.in
deleted file mode 100644
index e840a410a..000000000
Binary files a/2019/Day03/input.in and /dev/null differ
diff --git a/2019/Day03/input.refout b/2019/Day03/input.refout
deleted file mode 100644
index a89ad14a2..000000000
--- a/2019/Day03/input.refout
+++ /dev/null
@@ -1,2 +0,0 @@
-1519
-14358
diff --git a/2019/Day04/README.md b/2019/Day04/README.md
deleted file mode 100644
index 1145b177d..000000000
--- a/2019/Day04/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-## --- Day 4: Secure Container ---
-You arrive at the Venus fuel depot only to discover it's protected by a password. The Elves had written the password on a sticky note, but someone threw it out.
-
-However, they do remember a few key facts about the password:
-
-Read the [full puzzle](https://adventofcode.com/2019/day/4).
\ No newline at end of file
diff --git a/2019/Day04/Solution.cs b/2019/Day04/Solution.cs
deleted file mode 100644
index d32906c8c..000000000
--- a/2019/Day04/Solution.cs
+++ /dev/null
@@ -1,43 +0,0 @@
-using System.Collections.Generic;
-using System.Linq;
-using System.Text.RegularExpressions;
-
-namespace AdventOfCode.Y2019.Day04;
-
-[ProblemName("Secure Container")]
-class Solution : Solver {
-
- public object PartOne(string input) => Solve(input, true);
- public object PartTwo(string input) => Solve(input, false);
- private int Solve(string input, bool trippletsAllowed) {
-
- var args = input.Split("-").Select(int.Parse).ToArray();
- return (
- from i in Enumerable.Range(args[0], args[1] - args[0] + 1)
- where OK(i.ToString(), trippletsAllowed)
- select i
- ).Count();
- }
-
- private bool OK(string password, bool trippletsAllowed) {
-
- if (string.Join("", password.OrderBy(ch => ch)) != password) {
- return false;
- }
-
- return (
- from sequence in Split(password)
- where sequence.Length >= 2 && (trippletsAllowed || sequence.Length == 2)
- select sequence
- ).Any();
- }
-
- private IEnumerable Split(string st) {
- var ich = 0;
- while (ich < st.Length) {
- var sequence = Regex.Match(st.Substring(ich), @$"[{st[ich]}]+").Value;
- yield return sequence;
- ich += sequence.Length;
- }
- }
-}
diff --git a/2019/Day04/input.in b/2019/Day04/input.in
deleted file mode 100644
index 079b7dd74..000000000
Binary files a/2019/Day04/input.in and /dev/null differ
diff --git a/2019/Day04/input.refout b/2019/Day04/input.refout
deleted file mode 100644
index 20393657f..000000000
--- a/2019/Day04/input.refout
+++ /dev/null
@@ -1,2 +0,0 @@
-910
-598
diff --git a/2019/Day05/README.md b/2019/Day05/README.md
deleted file mode 100644
index b3908d680..000000000
--- a/2019/Day05/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-## --- Day 5: Sunny with a Chance of Asteroids ---
-You're starting to sweat as the ship makes its way toward Mercury. The Elves suggest that you get the air conditioner working by upgrading your ship computer to support the Thermal Environment Supervision Terminal.
-
-The Thermal Environment Supervision Terminal (TEST) starts by running a *diagnostic program* (your puzzle input). The TEST diagnostic program will run on [your existing Intcode computer](2) after a few modifications:
-
-Read the [full puzzle](https://adventofcode.com/2019/day/5).
\ No newline at end of file
diff --git a/2019/Day05/Solution.cs b/2019/Day05/Solution.cs
deleted file mode 100644
index a1ef9d7bb..000000000
--- a/2019/Day05/Solution.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-using System.Linq;
-
-namespace AdventOfCode.Y2019.Day05;
-
-[ProblemName("Sunny with a Chance of Asteroids")]
-class Solution : Solver {
-
- public object PartOne(string input) => new IntCodeMachine(input).Run(1).Last();
-
- public object PartTwo(string input) => new IntCodeMachine(input).Run(5).Last();
-
-}
diff --git a/2019/Day05/input.in b/2019/Day05/input.in
deleted file mode 100644
index 0d4db2def..000000000
Binary files a/2019/Day05/input.in and /dev/null differ
diff --git a/2019/Day05/input.refout b/2019/Day05/input.refout
deleted file mode 100644
index 813b792fa..000000000
--- a/2019/Day05/input.refout
+++ /dev/null
@@ -1,2 +0,0 @@
-13294380
-11460760
diff --git a/2019/Day06/README.md b/2019/Day06/README.md
deleted file mode 100644
index 44651a79a..000000000
--- a/2019/Day06/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-## --- Day 6: Universal Orbit Map ---
-You've landed at the Universal Orbit Map facility on Mercury. Because navigation in space often involves transferring between orbits, the orbit maps here are useful for finding efficient routes between, for example, you and Santa. You download a map of the local orbits (your puzzle input).
-
-Except for the universal Center of Mass (`COM`), every object in space is in orbit around exactly one other object. An [orbit](https://en.wikipedia.org/wiki/Orbit) looks roughly like this:
-
-Read the [full puzzle](https://adventofcode.com/2019/day/6).
\ No newline at end of file
diff --git a/2019/Day06/Solution.cs b/2019/Day06/Solution.cs
deleted file mode 100644
index 581199813..000000000
--- a/2019/Day06/Solution.cs
+++ /dev/null
@@ -1,48 +0,0 @@
-using System.Collections.Generic;
-using System.Linq;
-using ChildToParent = System.Collections.Generic.Dictionary;
-
-namespace AdventOfCode.Y2019.Day06;
-
-[ProblemName("Universal Orbit Map")]
-class Solution : Solver {
-
- public object PartOne(string input) {
- var childToParent = ParseTree(input);
- return (
- from node in childToParent.Keys
- select GetAncestors(childToParent, node).Count()
- ).Sum();
- }
-
- public object PartTwo(string input) {
- var childToParent = ParseTree(input);
- var ancestors1 = new Stack(GetAncestors(childToParent, "YOU"));
- var ancestors2 = new Stack(GetAncestors(childToParent, "SAN"));
- while (ancestors1.Peek() == ancestors2.Peek()) {
- ancestors1.Pop();
- ancestors2.Pop();
- }
- return ancestors1.Count + ancestors2.Count;
- }
-
- ChildToParent ParseTree(string input) =>
- input
- .Split("\n")
- .Select(line => line.Split(")"))
- .ToDictionary(
- parent_child => parent_child[1],
- parent_child => parent_child[0]
- );
-
- IEnumerable GetAncestors(ChildToParent childToParent, string node) {
- for (
- var parent = childToParent[node];
- parent != null;
- parent = childToParent.GetValueOrDefault(parent, null)
- ) {
- yield return parent;
- }
-
- }
-}
diff --git a/2019/Day06/input.in b/2019/Day06/input.in
deleted file mode 100644
index f2e87ab51..000000000
Binary files a/2019/Day06/input.in and /dev/null differ
diff --git a/2019/Day06/input.refout b/2019/Day06/input.refout
deleted file mode 100644
index bbdadbd31..000000000
--- a/2019/Day06/input.refout
+++ /dev/null
@@ -1,2 +0,0 @@
-147807
-229
diff --git a/2019/Day07/README.md b/2019/Day07/README.md
deleted file mode 100644
index d25f07a2a..000000000
--- a/2019/Day07/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-## --- Day 7: Amplification Circuit ---
-Based on the navigational maps, you're going to need to send more power to your ship's thrusters to reach Santa in time. To do this, you'll need to configure a series of [amplifiers](https://en.wikipedia.org/wiki/Amplifier) already installed on the ship.
-
-There are five amplifiers connected in series; each one receives an input signal and produces an output signal. They are connected such that the first amplifier's output leads to the second amplifier's input, the second amplifier's output leads to the third amplifier's input, and so on. The first amplifier's input value is `0`, and the last amplifier's output leads to your ship's thrusters.
-
-Read the [full puzzle](https://adventofcode.com/2019/day/7).
\ No newline at end of file
diff --git a/2019/Day07/Solution.cs b/2019/Day07/Solution.cs
deleted file mode 100644
index d2454634a..000000000
--- a/2019/Day07/Solution.cs
+++ /dev/null
@@ -1,63 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-
-namespace AdventOfCode.Y2019.Day07;
-
-[ProblemName("Amplification Circuit")]
-class Solution : Solver {
-
- public object PartOne(string prg) => Solve(prg, false, new[] { 0, 1, 2, 3, 4 });
- public object PartTwo(string prg) => Solve(prg, true, new[] { 5, 6, 7, 8, 9 });
-
- long Solve(string prg, bool loop, int[] prgids) {
- var amps = Enumerable.Range(0, 5).Select(x => new IntCodeMachine(prg)).ToArray();
- var max = 0L;
-
- foreach (var perm in Permutations(prgids)) {
- max = Math.Max(max, ExecAmps(amps, perm, loop));
- }
- return max;
- }
-
- long ExecAmps(IntCodeMachine[] amps, int[] prgid, bool loop) {
-
- for (var i = 0; i < amps.Length; i++) {
- amps[i].Reset();
- amps[i].input.Enqueue(prgid[i]);
- }
-
- var data = new[] { 0L };
-
- while (true) {
- for (var i = 0; i < amps.Length; i++) {
- data = amps[i].Run(data).ToArray();
- }
- if (amps.All(amp => amp.Halted())) {
- return data.Last();
- }
- if (!loop) {
- data = new long[0];
- }
- }
- }
-
- IEnumerable Permutations(T[] rgt) {
-
- IEnumerable PermutationsRec(int i) {
- if (i == rgt.Length) {
- yield return rgt.ToArray();
- }
-
- for (var j = i; j < rgt.Length; j++) {
- (rgt[i], rgt[j]) = (rgt[j], rgt[i]);
- foreach (var perm in PermutationsRec(i + 1)) {
- yield return perm;
- }
- (rgt[i], rgt[j]) = (rgt[j], rgt[i]);
- }
- }
-
- return PermutationsRec(0);
- }
-}
diff --git a/2019/Day07/input.in b/2019/Day07/input.in
deleted file mode 100644
index 85edf7132..000000000
Binary files a/2019/Day07/input.in and /dev/null differ
diff --git a/2019/Day07/input.refout b/2019/Day07/input.refout
deleted file mode 100644
index 7f3e0e4d4..000000000
--- a/2019/Day07/input.refout
+++ /dev/null
@@ -1,2 +0,0 @@
-262086
-5371621
diff --git a/2019/Day08/README.md b/2019/Day08/README.md
deleted file mode 100644
index 50bec7cf7..000000000
--- a/2019/Day08/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-## --- Day 8: Space Image Format ---
-The Elves' spirits are lifted when they realize you have an opportunity to reboot one of their Mars rovers, and so they are curious if you would spend a brief sojourn on Mars. You land your ship near the rover.
-
-When you reach the rover, you discover that it's already in the process of rebooting! It's just waiting for someone to enter a [BIOS](https://en.wikipedia.org/wiki/BIOS) password. The Elf responsible for the rover takes a picture of the password (your puzzle input) and sends it to you via the Digital Sending Network.
-
-Read the [full puzzle](https://adventofcode.com/2019/day/8).
\ No newline at end of file
diff --git a/2019/Day08/Solution.cs b/2019/Day08/Solution.cs
deleted file mode 100644
index a982c96e9..000000000
--- a/2019/Day08/Solution.cs
+++ /dev/null
@@ -1,44 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-
-namespace AdventOfCode.Y2019.Day08;
-
-[ProblemName("Space Image Format")]
-class Solution : Solver {
-
- public object PartOne(string input) {
- var zeroMin = int.MaxValue;
- var checksum = 0;
- foreach (var layer in Layers(input)) {
- var zero = layer.Count(item => item == 0);
- var ones = layer.Count(item => item == 1);
- var twos = layer.Count(item => item == 2);
-
- if (zeroMin > zero) {
- zeroMin = zero;
- checksum = ones * twos;
- }
- }
- return checksum;
- }
-
- public object PartTwo(string input) {
- var img = new char[6 * 25];
- foreach (var layer in Layers(input).Reverse()) {
- for (var i = 0; i < img.Length; i++) {
- img[i] = layer[i] switch {
- 0 => ' ',
- 1 => '#',
- _ => img[i]
- };
- }
- }
- return string.Join("",
- img.Chunk(25).Select(line => string.Join("", line)+"\n")
- ).Ocr();
- }
-
- int[][] Layers(string input) =>
- input.Select(ch => ch - '0').Chunk(6 * 25).ToArray();
-}
diff --git a/2019/Day08/input.in b/2019/Day08/input.in
deleted file mode 100644
index 546534d70..000000000
Binary files a/2019/Day08/input.in and /dev/null differ
diff --git a/2019/Day08/input.refout b/2019/Day08/input.refout
deleted file mode 100644
index 2aaf4ceb8..000000000
--- a/2019/Day08/input.refout
+++ /dev/null
@@ -1,2 +0,0 @@
-1620
-BCYEF
diff --git a/2019/Day09/README.md b/2019/Day09/README.md
deleted file mode 100644
index e063ad056..000000000
--- a/2019/Day09/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-## --- Day 9: Sensor Boost ---
-You've just said goodbye to the rebooted rover and left Mars when you receive a faint distress signal coming from the asteroid belt. It must be the Ceres monitoring station!
-
-In order to lock on to the signal, you'll need to boost your sensors. The Elves send up the latest *BOOST* program - Basic Operation Of System Test.
-
-Read the [full puzzle](https://adventofcode.com/2019/day/9).
\ No newline at end of file
diff --git a/2019/Day09/Solution.cs b/2019/Day09/Solution.cs
deleted file mode 100644
index 512a66f72..000000000
--- a/2019/Day09/Solution.cs
+++ /dev/null
@@ -1,10 +0,0 @@
-using System.Linq;
-
-namespace AdventOfCode.Y2019.Day09;
-
-[ProblemName("Sensor Boost")]
-class Solution : Solver {
-
- public object PartOne(string input) => new IntCodeMachine(input).Run(1).Single();
- public object PartTwo(string input) => new IntCodeMachine(input).Run(2).Single();
-}
diff --git a/2019/Day09/input.in b/2019/Day09/input.in
deleted file mode 100644
index 53b584655..000000000
Binary files a/2019/Day09/input.in and /dev/null differ
diff --git a/2019/Day09/input.refout b/2019/Day09/input.refout
deleted file mode 100644
index 2ac7a16ec..000000000
--- a/2019/Day09/input.refout
+++ /dev/null
@@ -1,2 +0,0 @@
-3454977209
-50120
diff --git a/2019/Day10/README.md b/2019/Day10/README.md
deleted file mode 100644
index 049647f0e..000000000
--- a/2019/Day10/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-## --- Day 10: Monitoring Station ---
-You fly into the asteroid belt and reach the Ceres monitoring station. The Elves here have an emergency: they're having trouble tracking all of the asteroids and can't be sure they're safe.
-
-The Elves would like to build a new monitoring station in a nearby area of space; they hand you a map of all of the asteroids in that region (your puzzle input).
-
-Read the [full puzzle](https://adventofcode.com/2019/day/10).
\ No newline at end of file
diff --git a/2019/Day10/Solution.cs b/2019/Day10/Solution.cs
deleted file mode 100644
index 7466e0e9e..000000000
--- a/2019/Day10/Solution.cs
+++ /dev/null
@@ -1,90 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using AsteroidsByDir = System.Collections.Generic.Dictionary<
-(int drow, int dcol), System.Collections.Generic.List<(int irow, int icol)>
->;
-
-namespace AdventOfCode.Y2019.Day10;
-
-[ProblemName("Monitoring Station")]
-class Solution : Solver {
-
- public object PartOne(string input) => SelectStationPosition(input).asteroidsByDir.Count;
-
- public object PartTwo(string input) {
- var asteroid = Destroy(input).ElementAt(199);
- return (asteroid.icol * 100 + asteroid.irow);
- }
-
- IEnumerable<(int irow, int icol)> Destroy(string input) {
- var (station, asteroidsByDir) = SelectStationPosition(input);
-
- foreach (var dir in asteroidsByDir.Keys.ToArray()) {
- asteroidsByDir[dir] = asteroidsByDir[dir]
- .OrderBy(a => Math.Abs(a.irow - station.irow) + Math.Abs(a.icol - station.icol))
- .ToList();
- }
-
- foreach (var dir in Rotate(asteroidsByDir.Keys)) {
- if (asteroidsByDir.ContainsKey(dir)) {
- var asteroid = asteroidsByDir[dir].First();
- asteroidsByDir[dir].RemoveAt(0);
-
- yield return asteroid;
-
- if (!asteroidsByDir[dir].Any()) {
- asteroidsByDir.Remove(dir);
- }
- }
- }
- }
-
- IEnumerable<(int drow, int dcol)> Rotate(IEnumerable<(int drow, int dcol)> dirs) {
- var ordered = dirs.OrderBy(dir => -Math.Atan2(dir.dcol, dir.drow)).ToList();
- for (var i = 0; ; i++) {
- yield return ordered[i % ordered.Count];
- }
- }
-
- ((int irow, int icol) station, AsteroidsByDir asteroidsByDir) SelectStationPosition(string input) {
-
- var res = ((0, 0), asteroidsByDir: new AsteroidsByDir());
- var asteroids = Asteroids(input);
-
- foreach (var station in asteroids) {
- var asteroidsByDir = new AsteroidsByDir();
- foreach (var asteroid in asteroids) {
- if (station != asteroid) {
- var (rowDir, colDir) = (asteroid.irow - station.irow, asteroid.icol - station.icol);
- var gcd = Math.Abs(Gcd(rowDir, colDir));
- var dir = (rowDir / gcd, colDir / gcd);
-
- if (!asteroidsByDir.ContainsKey(dir)) {
- asteroidsByDir[dir] = new List<(int irow, int icol)>();
- }
- asteroidsByDir[dir].Add(asteroid);
- }
- }
- if (asteroidsByDir.Count > res.asteroidsByDir.Count) {
- res = (station, asteroidsByDir);
- }
- }
-
- return res;
- }
-
- List<(int irow, int icol)> Asteroids(string input) {
- var map = input.Split("\n");
- var (crow, ccol) = (map.Length, map[0].Length);
-
- return (
- from irow in Enumerable.Range(0, crow)
- from icol in Enumerable.Range(0, ccol)
- where map[irow][icol] == '#'
- select (irow, icol)
- ).ToList();
- }
-
- int Gcd(int a, int b) => b == 0 ? a : Gcd(b, a % b);
-}
diff --git a/2019/Day10/input.in b/2019/Day10/input.in
deleted file mode 100644
index 546434ef7..000000000
Binary files a/2019/Day10/input.in and /dev/null differ
diff --git a/2019/Day10/input.refout b/2019/Day10/input.refout
deleted file mode 100644
index 56ad1f634..000000000
--- a/2019/Day10/input.refout
+++ /dev/null
@@ -1,2 +0,0 @@
-269
-612
diff --git a/2019/Day11/README.md b/2019/Day11/README.md
deleted file mode 100644
index b9a2b021d..000000000
--- a/2019/Day11/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-## --- Day 11: Space Police ---
-On the way to Jupiter, you're [pulled over](https://www.youtube.com/watch?v=KwY28rpyKDE) by the *Space Police*.
-
-"Attention, unmarked spacecraft! You are in violation of Space Law! All spacecraft must have a clearly visible *registration identifier*! You have 24 hours to comply or be sent to [Space Jail](https://www.youtube.com/watch?v=BVn1oQL9sWg&t=5)!"
-
-Read the [full puzzle](https://adventofcode.com/2019/day/11).
\ No newline at end of file
diff --git a/2019/Day11/Solution.cs b/2019/Day11/Solution.cs
deleted file mode 100644
index 87690b1dd..000000000
--- a/2019/Day11/Solution.cs
+++ /dev/null
@@ -1,53 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-
-namespace AdventOfCode.Y2019.Day11;
-
-[ProblemName("Space Police")]
-class Solution : Solver {
-
- public object PartOne(string input) => Run(input, 0).Count;
-
- public object PartTwo(string input) {
- var dict = Run(input, 1);
- var irowMin = dict.Keys.Select(pos => pos.irow).Min();
- var icolMin = dict.Keys.Select(pos => pos.icol).Min();
- var irowMax = dict.Keys.Select(pos => pos.irow).Max();
- var icolMax = dict.Keys.Select(pos => pos.icol).Max();
- var crow = irowMax - irowMin + 1;
- var ccol = icolMax - icolMin + 1;
- var st = "";
- for (var irow = 0; irow < crow; irow++) {
- for (var icol = 0; icol < ccol; icol++) {
- st += " #"[dict.GetValueOrDefault((irowMin + irow, icolMin + icol), 0)];
- }
- st += "\n";
- }
-
- return st.Ocr();
- }
-
- Dictionary<(int irow, int icol), int> Run(string input, int startColor) {
- var mtx = new Dictionary<(int irow, int icol), int>();
- (int irow, int icol) pos = (0, 0);
- (int drow, int dcol) dir = (-1, 0);
- mtx[(0, 0)] = startColor;
- var icm = new IntCodeMachine(input);
- while (true) {
- var output = icm.Run(mtx.GetValueOrDefault(pos, 0));
- if (icm.Halted()) {
- return mtx;
- }
- mtx[pos] = (int)output[0];
- dir = output[1] switch {
- 0 => (-dir.dcol, dir.drow),
- 1 => (dir.dcol, -dir.drow),
- _ => throw new ArgumentException()
- };
- pos = (pos.irow + dir.drow, pos.icol + dir.dcol);
- }
- }
-
-
-}
diff --git a/2019/Day11/input.in b/2019/Day11/input.in
deleted file mode 100644
index bffe73d76..000000000
Binary files a/2019/Day11/input.in and /dev/null differ
diff --git a/2019/Day11/input.refout b/2019/Day11/input.refout
deleted file mode 100644
index 0c8e20614..000000000
--- a/2019/Day11/input.refout
+++ /dev/null
@@ -1,2 +0,0 @@
-1785
-HJALJZFH
diff --git a/2019/Day12/README.md b/2019/Day12/README.md
deleted file mode 100644
index 28ab5b8a6..000000000
--- a/2019/Day12/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-## --- Day 12: The N-Body Problem ---
-The space near Jupiter is not a very safe place; you need to be careful of a [big distracting red spot](https://en.wikipedia.org/wiki/Great_Red_Spot), extreme [radiation](https://en.wikipedia.org/wiki/Magnetosphere_of_Jupiter), and a [whole lot of moons](https://en.wikipedia.org/wiki/Moons_of_Jupiter#List) swirling around. You decide to start by tracking the four largest moons: *Io*, *Europa*, *Ganymede*, and *Callisto*.
-
-After a brief scan, you calculate the *position of each moon* (your puzzle input). You just need to *simulate their motion* so you can avoid them.
-
-Read the [full puzzle](https://adventofcode.com/2019/day/12).
\ No newline at end of file
diff --git a/2019/Day12/Solution.cs b/2019/Day12/Solution.cs
deleted file mode 100644
index 8466500f3..000000000
--- a/2019/Day12/Solution.cs
+++ /dev/null
@@ -1,66 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text.RegularExpressions;
-
-namespace AdventOfCode.Y2019.Day12;
-
-[ProblemName("The N-Body Problem")]
-class Solution : Solver {
-
- public object PartOne(string input) => (
- from planet in Simulate(input).ElementAt(999)
- let pot = planet.pos.Select(Math.Abs).Sum()
- let kin = planet.vel.Select(Math.Abs).Sum()
- select pot * kin
- ).Sum();
-
- public object PartTwo(string input) {
- var statesByDim = new long[3];
- for (var dim = 0; dim < 3; dim++) {
- var states = new HashSet<(int,int,int,int,int,int,int,int)>();
- foreach (var planets in Simulate(input)) {
- var state = (planets[0].pos[dim], planets[1].pos[dim], planets[2].pos[dim], planets[3].pos[dim],
- planets[0].vel[dim], planets[1].vel[dim], planets[2].vel[dim], planets[3].vel[dim]);
- if (states.Contains(state)) {
- break;
- }
- states.Add(state);
- }
- statesByDim[dim] = states.Count;
- }
-
- return Lcm(statesByDim[0], Lcm(statesByDim[1], statesByDim[2]));
- }
-
- long Lcm(long a, long b) => a * b / Gcd(a, b);
- long Gcd(long a, long b) => b == 0 ? a : Gcd(b, a % b);
-
- IEnumerable<(int[] pos, int[] vel)[]> Simulate(string input) {
- var planets = (
- from line in input.Split("\n")
- let m = Regex.Matches(line, @"-?\d+")
- let pos = (from v in m select int.Parse(v.Value)).ToArray()
- let vel = new int[3]
- select (pos, vel)
- ).ToArray();
-
- while (true) {
- foreach (var planetA in planets) {
- foreach (var planetB in planets) {
- for (var dim = 0; dim < 3; dim++) {
- planetA.vel[dim] += Math.Sign(planetB.pos[dim] - planetA.pos[dim]);
- }
- }
- }
-
- foreach (var planet in planets) {
- for (var dim = 0; dim < 3; dim++) {
- planet.pos[dim] += planet.vel[dim];
- }
- }
-
- yield return planets;
- }
- }
-}
diff --git a/2019/Day12/input.in b/2019/Day12/input.in
deleted file mode 100644
index 0e1994f1a..000000000
Binary files a/2019/Day12/input.in and /dev/null differ
diff --git a/2019/Day12/input.refout b/2019/Day12/input.refout
deleted file mode 100644
index add4bb6d5..000000000
--- a/2019/Day12/input.refout
+++ /dev/null
@@ -1,2 +0,0 @@
-5517
-303070460651184
diff --git a/2019/Day13/README.md b/2019/Day13/README.md
deleted file mode 100644
index dfb52a5c1..000000000
--- a/2019/Day13/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-## --- Day 13: Care Package ---
-As you ponder the solitude of space and the ever-increasing three-hour roundtrip for messages between you and Earth, you notice that the Space Mail Indicator Light is blinking. To help keep you sane, the Elves have sent you a care package.
-
-It's a new game for the ship's [arcade cabinet](https://en.wikipedia.org/wiki/Arcade_cabinet)! Unfortunately, the arcade is *all the way* on the other end of the ship. Surely, it won't be hard to build your own - the care package even comes with schematics.
-
-Read the [full puzzle](https://adventofcode.com/2019/day/13).
\ No newline at end of file
diff --git a/2019/Day13/Solution.cs b/2019/Day13/Solution.cs
deleted file mode 100644
index fd7dc2c81..000000000
--- a/2019/Day13/Solution.cs
+++ /dev/null
@@ -1,58 +0,0 @@
-using System.Collections.Generic;
-using System.Linq;
-
-namespace AdventOfCode.Y2019.Day13;
-
-[ProblemName("Care Package")]
-class Solution : Solver {
-
- public object PartOne(string input) {
- var icm = new IntCodeMachine(input);
- var output = icm.Run();
- var chunks = Chunk(output, 3);
- return chunks.Count(x => x[2] == 2);
- }
-
- public object PartTwo(string input) {
- var icm = new IntCodeMachine(input);
- icm.memory[0] = 2;
- var score = 0;
- var icolBall = -1;
- var icolPaddle = -1;
- var dir = 0;
- while (true) {
- var output = icm.Run(dir);
- var chunks = Chunk(output, 3);
- foreach (var chunk in chunks) {
- var (icol, irow, block) = (chunk[0], chunk[1], chunk[2]);
- if ((icol, irow) == (-1, 0)) {
- score = (int)block;
- } if (block == 3) {
- icolPaddle = (int)icol;
- } else if (block == 4) {
- icolBall = (int)icol;
- }
- }
-
- if (icm.Halted()) {
- break;
- }
-
- dir =
- icolBall < icolPaddle ? -1 :
- icolBall > icolPaddle ? 1 :
- 0;
-
- }
- return score;
- }
-
- public T[][] Chunk(IEnumerable source, int chunksize) {
- var res = new List();
- while (source.Any()) {
- res.Add(source.Take(chunksize).ToArray());
- source = source.Skip(chunksize);
- }
- return res.ToArray();
- }
-}
diff --git a/2019/Day13/input.in b/2019/Day13/input.in
deleted file mode 100644
index 157e70a9d..000000000
Binary files a/2019/Day13/input.in and /dev/null differ
diff --git a/2019/Day13/input.refout b/2019/Day13/input.refout
deleted file mode 100644
index 71679c029..000000000
--- a/2019/Day13/input.refout
+++ /dev/null
@@ -1,2 +0,0 @@
-363
-17159
diff --git a/2019/Day14/README.md b/2019/Day14/README.md
deleted file mode 100644
index 49e4fe406..000000000
--- a/2019/Day14/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-## --- Day 14: Space Stoichiometry ---
-As you approach the rings of Saturn, your ship's *low fuel* indicator turns on. There isn't any fuel here, but the rings have plenty of raw material. Perhaps your ship's Inter-Stellar Refinery Union brand *nanofactory* can turn these raw materials into fuel.
-
-You ask the nanofactory to produce a list of the *reactions* it can perform that are relevant to this process (your puzzle input). Every reaction turns some quantities of specific *input chemicals* into some quantity of an *output chemical*. Almost every *chemical* is produced by exactly one reaction; the only exception, `ORE`, is the raw material input to the entire process and is not produced by a reaction.
-
-Read the [full puzzle](https://adventofcode.com/2019/day/14).
\ No newline at end of file
diff --git a/2019/Day14/Solution.cs b/2019/Day14/Solution.cs
deleted file mode 100644
index d6585263c..000000000
--- a/2019/Day14/Solution.cs
+++ /dev/null
@@ -1,77 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-
-namespace AdventOfCode.Y2019.Day14;
-
-[ProblemName("Space Stoichiometry")]
-class Solution : Solver {
-
- public object PartOne(string input) => Parse(input)(1);
- public object PartTwo(string input) {
- var oreForFuel = Parse(input);
-
- var ore = 1000000000000L;
-
- var fuel = 1L;
- while (true) {
- // newFuel <= the amount we can produce with the given ore
- // since (double)ore / oreForFuel(fuel) >= 1, fuel becomes
- // a better estimation in each iteration until it reaches
- // the maximum
-
- var newFuel = (int)((double)ore / oreForFuel(fuel) * fuel);
-
- if (newFuel == fuel) {
- return newFuel;
- }
- fuel = newFuel;
- }
- }
-
- Func Parse(string productionRules) {
- (string chemical, long amount) ParseReagent(string st) {
- var parts = st.Split(" ");
- return (parts[1], long.Parse(parts[0]));
- }
-
- var reactions = (
- from rule in productionRules.Split("\n")
- let inout = rule.Split(" => ")
- let input = inout[0].Split(", ").Select(ParseReagent).ToArray()
- let output = ParseReagent(inout[1])
- select (output, input)
- ).ToDictionary(inout => inout.output.chemical, inout => inout);
-
- return (fuel) => {
-
- var ore = 0L;
- var inventory = reactions.Keys.ToDictionary(chemical => chemical, _ => 0L);
- var productionList = new Queue<(string chemical, long amount)>();
- productionList.Enqueue(("FUEL", fuel));
-
- while (productionList.Any()) {
- var (chemical, amount) = productionList.Dequeue();
- if (chemical == "ORE") {
- ore += amount;
- } else {
- var reaction = reactions[chemical];
-
- var useFromInventory = Math.Min(amount, inventory[chemical]);
- amount -= useFromInventory;
- inventory[chemical] -= useFromInventory;
-
- if (amount > 0) {
- var multiplier = (long)Math.Ceiling((decimal)amount / reaction.output.amount);
- inventory[chemical] = Math.Max(0, multiplier * reaction.output.amount - amount);
-
- foreach (var reagent in reaction.input) {
- productionList.Enqueue((reagent.chemical, reagent.amount * multiplier));
- }
- }
- }
- }
- return ore;
- };
- }
-}
diff --git a/2019/Day14/input.in b/2019/Day14/input.in
deleted file mode 100644
index 929a13c2c..000000000
Binary files a/2019/Day14/input.in and /dev/null differ
diff --git a/2019/Day14/input.refout b/2019/Day14/input.refout
deleted file mode 100644
index 05d75e2eb..000000000
--- a/2019/Day14/input.refout
+++ /dev/null
@@ -1,2 +0,0 @@
-892207
-1935265
diff --git a/2019/Day15/README.md b/2019/Day15/README.md
deleted file mode 100644
index 0f0aa0e4e..000000000
--- a/2019/Day15/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-## --- Day 15: Oxygen System ---
-Out here in deep space, many things can go wrong. Fortunately, many of those things have indicator lights. Unfortunately, one of those lights is lit: the oxygen system for part of the ship has failed!
-
-According to the readouts, the oxygen system must have failed days ago after a rupture in oxygen tank two; that section of the ship was automatically sealed once oxygen levels went dangerously low. A single remotely-operated repair droid is your only option for fixing the oxygen system.
-
-Read the [full puzzle](https://adventofcode.com/2019/day/15).
\ No newline at end of file
diff --git a/2019/Day15/Solution.cs b/2019/Day15/Solution.cs
deleted file mode 100644
index 10fc69062..000000000
--- a/2019/Day15/Solution.cs
+++ /dev/null
@@ -1,53 +0,0 @@
-using System.Collections.Generic;
-using System.Collections.Immutable;
-using System.Linq;
-
-namespace AdventOfCode.Y2019.Day15;
-
-[ProblemName("Oxygen System")]
-class Solution : Solver {
-
- enum Tile {
- Wall = 0,
- Empty = 1,
- O2 = 2,
- }
-
- public object PartOne(string input) {
- var iicm = new ImmutableIntCodeMachine(input);
- return Bfs(iicm).First(s => s.tile == Tile.O2).path.Count;
- }
-
- public object PartTwo(string input) {
- var iicm = Bfs(new ImmutableIntCodeMachine(input)).First(s => s.tile == Tile.O2).iicm;
- return Bfs(iicm).Last().path.Count;
- }
-
- IEnumerable<(ImmutableIntCodeMachine iicm, ImmutableList path, Tile tile)> Bfs(ImmutableIntCodeMachine startIicm) {
-
- (int dx, int dy)[] dirs = new[] { (0, -1), (0, 1), (-1, 0), (1, 0) };
-
- var seen = new HashSet<(int x, int y)> { (0, 0) };
- var q = new Queue<(ImmutableIntCodeMachine iicm, ImmutableList path, int x, int y)>();
- q.Enqueue((startIicm, ImmutableList.Empty, 0, 0));
- while (q.Any()) {
- var current = q.Dequeue();
-
- for (var i = 0; i < dirs.Length; i++) {
- var (nextX, nextY) = (current.x + dirs[i].dx, current.y + dirs[i].dy);
-
- if (!seen.Contains((nextX, nextY))) {
- seen.Add((nextX, nextY));
- var nextPath = current.path.Add(i + 1);
- var (nextIicm, output) = current.iicm.Run(i + 1);
-
- var tile = (Tile)output.Single();
- if (tile != Tile.Wall) {
- yield return (nextIicm, nextPath, tile);
- q.Enqueue((nextIicm, nextPath, nextX, nextY));
- }
- }
- }
- }
- }
-}
diff --git a/2019/Day15/input.in b/2019/Day15/input.in
deleted file mode 100644
index 62aa67426..000000000
Binary files a/2019/Day15/input.in and /dev/null differ
diff --git a/2019/Day15/input.refout b/2019/Day15/input.refout
deleted file mode 100644
index bef97500d..000000000
--- a/2019/Day15/input.refout
+++ /dev/null
@@ -1,2 +0,0 @@
-258
-372
\ No newline at end of file
diff --git a/2019/Day16/README.md b/2019/Day16/README.md
deleted file mode 100644
index 719505721..000000000
--- a/2019/Day16/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-## --- Day 16: Flawed Frequency Transmission ---
-You're 3/4ths of the way through the [gas giants](https://en.wikipedia.org/wiki/Gas_giant). Not only do roundtrip signals to Earth take five hours, but the signal quality is quite bad as well. You can clean up the signal with the Flawed Frequency Transmission algorithm, or *FFT*.
-
-As input, FFT takes a list of numbers. In the signal you received (your puzzle input), each number is a single digit: data like `15243` represents the sequence `1`, `5`, `2`, `4`, `3`.
-
-Read the [full puzzle](https://adventofcode.com/2019/day/16).
\ No newline at end of file
diff --git a/2019/Day16/Solution.cs b/2019/Day16/Solution.cs
deleted file mode 100644
index 9fd68ea3a..000000000
--- a/2019/Day16/Solution.cs
+++ /dev/null
@@ -1,146 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Numerics;
-
-namespace AdventOfCode.Y2019.Day16;
-
-[ProblemName("Flawed Frequency Transmission")]
-class Solution : Solver {
-
- public object PartOne(string input) {
-
- int[] Fft(int[] digits) {
- IEnumerable Pattern(int digit) {
- var repeat = digit + 1;
- while (true) {
- foreach (var item in new[] { 0, 1, 0, -1 }) {
- for (var i = 0; i < repeat; i++) {
- yield return item;
- }
- }
- }
- }
-
- return (
- from i in Enumerable.Range(0, digits.Length)
- let pattern = Pattern(i).Skip(1)
- let dotProduct = (from p in digits.Zip(pattern) select p.First * p.Second).Sum()
- select Math.Abs(dotProduct) % 10
- ).ToArray();
- }
-
- var digits = input.Select(ch => int.Parse(ch.ToString())).ToArray();
-
- for (var i = 0; i < 100; i++) {
- digits = Fft(digits);
- }
-
- return string.Join("", digits.Take(8));
- }
-
- public object PartTwo(string input) {
- /*
- Let's introduce the following matrix:
- FFT = [
- 1, 0, -1, 0, 1, 0, -1, 0, ...
- 0, 1, 1, 0, 0, -1, -1, 0, ...
- 0, 0, 1, 1, 1, 0, 0, 0, ...
- 0, 0, 0, 1, 1, 1, 1, 0, ...
- 0, 0, 0, 0, 1, 1, 1, 1, ...
- 0, 0, 0, 0, 0, 1, 1, 1, ...
- 0, 0, 0, 0, 0, 0, 1, 1, ...
- 0, 0, 0, 0, 0, 0, 0, 1, ...
- ...
- ]
-
- A single FFT step of the data stored in vector x is just a matrix multiplication FFT . x
- We get repeated FFT steps with multiplying with the proper power of FFT: FFT^2, FFT^3, ... FFT^100.
-
- Looking at the FFT matrix, we notice that the bottom right corner is always an upper triangular filled with 1s:
- A = [
- 1, 1, 1, 1, ...
- 0, 1, 1, 1, ...
- 0, 0, 1, 1, ...
- 0, 0, 0, 1, ...
- ....
- ]
- The problem asks for output components that correspond to multiplication with rows in this area.
-
- Examining A's powers reveal that the the first row can be:
- the numbers from 1-n,
- A^2 = [
- 1, 2, 3, 4, ...
- 0, 1, 2, 3, ...
- 0, 0, 1, 3, ...
- 0, 0, 0, 1, ...
- ....
- ]
- the sum of numbers from 1-n
- A^3 = [
- 1, 3, 6, 10, ...
- 0, 1, 3, 6, ...
- 0, 0, 1, 3, ...
- 0, 0, 0, 1, ...
- ....
- ]
- the sum of the sum of numbers from 1-n
- A^4 = [
- 1, 4, 10, 20, ...
- 0, 1, 4, 10, ...
- 0, 0, 1, 4, ...
- 0, 0, 0, 1, ...
- ....
- ]
- etc.
- And we get the second, third... rows with shifting the previous one.
-
- Using the properties of binomial coefficients we get that the items of the first row of A^k are
- (A^k)_1_j = choose(j - 1 + k - 1, k - 1)
-
- see https://math.stackexchange.com/questions/234304/sum-of-the-sum-of-the-sum-of-the-first-n-natural-numbers
-
- and we can compute the items from left to right with
- choose(m + 1, n) = choose(m, n) * (m + 1) / (m + 1 - n)
-
- specifically
- (A^k)_1_(j + 1) =
- choose(j + k - 1, k - 1) =
- choose(j - 1 + k - 1, k - 1) * (j + k - 1) / j =
- (A^k)_1_j * (j + k - 1) / j
-
- let B = A^100 and so k - 1 = 99.
- B_1_(j + 1) = B_1_j * (j + 99) / j
- and
- B_i_j = B_1_(j - i + 1)
-
- we need to compute [B]_{1..7} * xs % 10, where xs is the digits of input repeated 10000 times shifted with t
- */
-
- var xs = input.Select(ch => int.Parse(ch.ToString())).ToArray();
- var res = "";
-
- var t = int.Parse(input.Substring(0, 7));
- var crow = 8;
- var ccol = input.Length * 10000 - t;
-
- var bijMods = new int[ccol + 1];
- var bij = new BigInteger(1);
- for (var j = 1; j <= ccol; j++) {
- bijMods[j] = (int)(bij % 10);
- bij = bij * (j + 99) / j;
- }
-
- for (var i = 1; i <= crow; i++) {
- var s = 0;
- for (var j = i; j <= ccol; j++) {
- var x = xs[(t + j - 1) % input.Length];
- s += x * bijMods[j - i + 1];
- }
- res += (s % 10).ToString();
- }
-
- return res;
- }
-
-}
diff --git a/2019/Day16/input.in b/2019/Day16/input.in
deleted file mode 100644
index 745b563e4..000000000
Binary files a/2019/Day16/input.in and /dev/null differ
diff --git a/2019/Day16/input.refout b/2019/Day16/input.refout
deleted file mode 100644
index ce012da97..000000000
--- a/2019/Day16/input.refout
+++ /dev/null
@@ -1,2 +0,0 @@
-76795888
-84024125
diff --git a/2019/Day17/README.md b/2019/Day17/README.md
deleted file mode 100644
index 4bd898a5d..000000000
--- a/2019/Day17/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-## --- Day 17: Set and Forget ---
-An early warning system detects an incoming [solar flare](https://en.wikipedia.org/wiki/Solar_flare) and automatically activates the ship's electromagnetic shield. Unfortunately, this has cut off the Wi-Fi for many small robots that, unaware of the impending danger, are now trapped on exterior scaffolding on the unsafe side of the shield. To rescue them, you'll have to act quickly!
-
-The only tools at your disposal are some wired cameras and a small vacuum robot currently asleep at its charging station. The video quality is poor, but the vacuum robot has a needlessly bright LED that makes it easy to spot no matter where it is.
-
-Read the [full puzzle](https://adventofcode.com/2019/day/17).
\ No newline at end of file
diff --git a/2019/Day17/Solution.cs b/2019/Day17/Solution.cs
deleted file mode 100644
index 07dd75fb3..000000000
--- a/2019/Day17/Solution.cs
+++ /dev/null
@@ -1,160 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Collections.Immutable;
-using System.Linq;
-
-namespace AdventOfCode.Y2019.Day17;
-
-[ProblemName("Set and Forget")]
-class Solution : Solver {
-
- public object PartOne(string input) {
- var mx = Screenshot(input);
-
- var crow = mx.Length;
- var ccol = mx[0].Length;
- var cross = ".#.\n###\n.#.".Split("\n");
-
- bool crossing(int irow, int icol) => (
- from drow in new[] { -1, 0, 1 }
- from dcol in new[] { -1, 0, 1 }
- select cross[1 + drow][1 + dcol] == mx[irow + drow][icol + dcol]
- ).All(x => x);
-
- return (
- from irow in Enumerable.Range(1, crow - 2)
- from icol in Enumerable.Range(1, ccol - 2)
- where crossing(irow, icol)
- select icol * irow
- ).Sum();
- }
-
- public object PartTwo(string input) {
- var program = GeneratePrograms(Path(input)).First();
-
- var icm = new IntCodeMachine(input);
- icm.memory[0] = 2;
- return icm.Run(program).Last();
- }
-
- string[] Screenshot(string input) {
- var icm = new IntCodeMachine(input);
- var output = icm.Run();
- return output.ToAscii().Split("\n").Where(x => !string.IsNullOrWhiteSpace(x)).ToArray();
- }
-
- IEnumerable GeneratePrograms(string path) {
-
- IEnumerable<(ImmutableList indices, ImmutableList functions)> GenerateRec(string path, ImmutableList functions) {
- if (path.Length == 0) {
- yield return (ImmutableList.Empty, functions);
- }
-
- for (var i = 0; i < functions.Count; i++) {
- var function = functions[i];
-
- if (path.StartsWith(function)) {
-
- var pathT = path.Substring(function.Length);
- foreach (var res in GenerateRec(pathT, functions)) {
- yield return (res.indices.Insert(0, i), res.functions);
- }
- }
- }
-
- if (functions.Count < 3) {
- for (var length = 1; length <= path.Length; length++) {
- var function = path[0..length].ToString();
- var functionsT = functions.Add(function);
- var idx = functions.Count;
- var pathT = path.Substring(function.Length);
- foreach (var res in GenerateRec(pathT, functionsT)) {
- yield return (res.indices.Insert(0, idx), res.functions);
- }
- }
- }
- }
-
- foreach (var (indices, functions) in GenerateRec(path, ImmutableList.Empty)) {
-
- var compressed = functions.Select(Compress).ToArray();
- if (indices.Count <= 20 && compressed.All(c => c.Length <= 20)) {
-
- var main = string.Join(",", indices.Select(i => "ABC"[i]));
- yield return $"{main}\n{compressed[0]}\n{compressed[1]}\n{compressed[2]}\nn\n";
- }
-
- }
- }
-
- string Compress(string st) {
- var steps = new List();
- var l = 0;
- for (var i = 0; i < st.Length; i++) {
- var ch = st[i];
-
- if (l > 0 && ch != 'F') {
- steps.Add(l.ToString());
- l = 0;
- }
- if (ch == 'R' || ch == 'L') {
- steps.Add(ch.ToString());
- } else {
- l++;
- }
- }
- if (l > 0) {
- steps.Add(l.ToString());
- }
- return string.Join(",", steps);
- }
-
- string Path(string input) {
- var mx = Screenshot(input);
- var crow = mx.Length;
- var ccol = mx[0].Length;
-
- var (pos, dir) = FindRobot(mx);
- char look((int irow, int icol) pos) {
- var (irow, icol) = pos;
- return irow < 0 || irow >= crow || icol < 0 || icol >= ccol ? '.' : mx[irow][icol];
- }
-
- var path = "";
- var finished = false;
- while (!finished) {
- finished = true;
- foreach (var (nextDir, step) in new[]{
- ((drow: dir.drow, dcol: dir.dcol), "F"),
- ((drow: -dir.dcol, dcol: dir.drow), "LF"),
- ((drow: dir.dcol, dcol: -dir.drow), "RF")
- }) {
- var nextPos = (pos.irow + nextDir.drow, pos.icol + nextDir.dcol);
- if (look(nextPos) == '#') {
- path += step;
- pos = nextPos;
- dir = nextDir;
- finished = false;
- break;
- }
- }
- }
- return path;
- }
-
- ((int irow, int icol) pos, (int drow, int dcol) dir) FindRobot(string[] mx) => (
- from irow in Enumerable.Range(0, mx.Length)
- from icol in Enumerable.Range(0, mx[0].Length)
- let ch = mx[irow][icol]
- where "^v<>".Contains(ch)
- let dir = mx[irow][icol] switch
- {
- '^' => (-1, 0),
- 'v' => (1, 0),
- '<' => (0, -1),
- '>' => (0, 1),
- _ => throw new Exception()
- }
- select ((irow, icol), dir)
- ).First();
-}
diff --git a/2019/Day17/input.in b/2019/Day17/input.in
deleted file mode 100644
index b98176f73..000000000
Binary files a/2019/Day17/input.in and /dev/null differ
diff --git a/2019/Day17/input.refout b/2019/Day17/input.refout
deleted file mode 100644
index 9927dccba..000000000
--- a/2019/Day17/input.refout
+++ /dev/null
@@ -1,2 +0,0 @@
-8520
-926819
diff --git a/2019/Day18/README.md b/2019/Day18/README.md
deleted file mode 100644
index 21878042c..000000000
--- a/2019/Day18/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-## --- Day 18: Many-Worlds Interpretation ---
-As you approach Neptune, a planetary security system detects you and activates a giant [tractor beam](https://en.wikipedia.org/wiki/Tractor_beam) on [Triton](https://en.wikipedia.org/wiki/Triton_(moon))! You have no choice but to land.
-
-A scan of the local area reveals only one interesting feature: a massive underground vault. You generate a map of the tunnels (your puzzle input). The tunnels are too narrow to move diagonally.
-
-Read the [full puzzle](https://adventofcode.com/2019/day/18).
\ No newline at end of file
diff --git a/2019/Day18/Solution.cs b/2019/Day18/Solution.cs
deleted file mode 100644
index 3396fd994..000000000
--- a/2019/Day18/Solution.cs
+++ /dev/null
@@ -1,204 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Collections.Immutable;
-using System.Linq;
-
-namespace AdventOfCode.Y2019.Day18;
-
-
-class Maze {
- string[] maze;
- public Maze(string st) {
- this.maze = st.Split("\n");
- }
- int ccol => maze[0].Length;
- int crow => maze.Length;
- Dictionary positionCache = new Dictionary();
- Dictionary<(char, char), int> distanceCache = new Dictionary<(char, char), int>();
-
- public char Look((int irow, int icol) pos) {
- var (irow, icol) = pos;
- if (irow < 0 || irow >= crow || icol < 0 || icol >= ccol) {
- return '#';
- }
- return maze[irow][icol];
-
- }
-
- public (int irow, int icol) Find(char ch) {
- if (!positionCache.ContainsKey(ch)) {
- for (var irow = 0; irow < crow; irow++) {
- for (var icol = 0; icol < ccol; icol++) {
- if (maze[irow][icol] == ch) {
- positionCache[ch] = (irow, icol);
- return positionCache[ch];
- }
- }
- }
- throw new Exception();
- } else {
- return positionCache[ch];
- }
- }
-
-
- public int Distance(char chA, char chB) {
- var key = (chA, chB);
- if (!distanceCache.ContainsKey(key)) {
- distanceCache[key] = ComputeDistance(chA, chB);
- }
- return distanceCache[key];
- }
-
- int ComputeDistance(char chA, char chB) {
- var pos = Find(chA);
- if (chA == chB) {
- return 0;
- }
- var q = new Queue<((int irow, int icol) pos, int dist)>();
- int dist = 0;
- q.Enqueue((pos, dist));
-
- var seen = new HashSet<(int irow, int icol)>();
- seen.Add(pos);
- while (q.Any()) {
- (pos, dist) = q.Dequeue();
-
- foreach (var (drow, dcol) in new[] { (-1, 0), (1, 0), (0, -1), (0, 1) }) {
- var posT = (pos.irow + drow, pos.icol + dcol);
- var ch = Look(posT);
-
- if (seen.Contains(posT) || ch == '#') {
- continue;
- }
-
- seen.Add(posT);
- var distT = dist + 1;
-
- if (ch == chB) {
- return distT;
- } else {
- q.Enqueue((posT, distT));
- }
- }
- }
- throw new Exception();
- }
-}
-
-[ProblemName("Many-Worlds Interpretation")]
-class Solution : Solver {
-
- public object PartOne(string input) {
- var maze = new Maze(input);
-
-
- var dependencies = GenerateDependencies(maze);
- return Solve(maze);
- }
-
-
- public object PartTwo(string input) {
- var d = 0;
- foreach (var subMaze in GenerateSubMazes(input)) {
- var maze = new Maze(subMaze);
-
- var dependencies = GenerateDependencies(maze);
- d += Solve(maze);
- }
- return d;
- }
-
- IEnumerable