From e00edb74259ff2a268ae77971049ca709235ac7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20Schw=C3=B6rer?= Date: Sat, 2 Nov 2019 20:19:34 +0100 Subject: [PATCH] Preparations for AdventOfCode section --- www/internals/adventofcode.php | 128 + www/internals/blog.php | 12 +- www/internals/euler.php | 2 +- www/pages/admin.php | 3 + www/pages/blog_view.php | 33 +- www/statics/aoc/2018/01-1.linq | 6 + www/statics/aoc/2018/01-2.linq | 9 + www/statics/aoc/2018/01_challenge.txt | 53 + www/statics/aoc/2018/01_input.txt | 1015 ++++++ www/statics/aoc/2018/02-1.linq | 8 + www/statics/aoc/2018/02-2.linq | 11 + www/statics/aoc/2018/02_challenge.txt | 43 + www/statics/aoc/2018/02_input.txt | 250 ++ www/statics/aoc/2018/03-1.linq | 17 + www/statics/aoc/2018/03-2.linq | 22 + www/statics/aoc/2018/03_challenge.txt | 53 + www/statics/aoc/2018/03_input.txt | 1367 ++++++++ www/statics/aoc/2018/04-1.linq | 79 + www/statics/aoc/2018/04-2.linq | 85 + www/statics/aoc/2018/04_challenge.txt | 60 + www/statics/aoc/2018/04_input.txt | 1186 +++++++ www/statics/aoc/2018/05-1.linq | 10 + www/statics/aoc/2018/05-2.linq | 22 + www/statics/aoc/2018/05_challenge.txt | 42 + www/statics/aoc/2018/05_input.txt | 1 + www/statics/aoc/2018/06-1.linq | 35 + www/statics/aoc/2018/06-2.linq | 25 + www/statics/aoc/2018/06_challenge.txt | 87 + www/statics/aoc/2018/06_input.txt | 50 + www/statics/aoc/2018/07-1.linq | 35 + www/statics/aoc/2018/07-2.linq | 61 + www/statics/aoc/2018/07_challenge.txt | 75 + www/statics/aoc/2018/07_input.txt | 101 + www/statics/aoc/2018/08-1.linq | 29 + www/statics/aoc/2018/08-2.linq | 31 + www/statics/aoc/2018/08_challenge.txt | 54 + www/statics/aoc/2018/08_input.txt | 1 + www/statics/aoc/2018/09-1.linq | 36 + www/statics/aoc/2018/09-2.linq | 55 + www/statics/aoc/2018/09_challenge.txt | 58 + www/statics/aoc/2018/09_input.txt | 1 + www/statics/aoc/2018/10-1.linq | 56 + www/statics/aoc/2018/10-2.linq | 56 + www/statics/aoc/2018/10_challenge.txt | 149 + www/statics/aoc/2018/10_input.txt | 337 ++ www/statics/aoc/2018/11-1.linq | 20 + www/statics/aoc/2018/11-2.linq | 34 + www/statics/aoc/2018/11_challenge.txt | 70 + www/statics/aoc/2018/11_input.txt | 1 + www/statics/aoc/2018/12-1.linq | 44 + www/statics/aoc/2018/12-2.linq | 60 + www/statics/aoc/2018/12_challenge.txt | 74 + www/statics/aoc/2018/12_input.txt | 34 + www/statics/aoc/2018/13-1.linq | 229 ++ www/statics/aoc/2018/13-2.linq | 234 ++ www/statics/aoc/2018/13_challenge.txt | 206 ++ www/statics/aoc/2018/13_input.txt | 150 + www/statics/aoc/2018/14-1.linq | 27 + www/statics/aoc/2018/14-2.linq | 33 + www/statics/aoc/2018/14_challenge.txt | 52 + www/statics/aoc/2018/14_input.txt | 1 + www/statics/aoc/2018/15-1.linq | 277 ++ www/statics/aoc/2018/15-2.linq | 287 ++ www/statics/aoc/2018/15_challenge.txt | 369 +++ www/statics/aoc/2018/15_input.txt | 32 + www/statics/aoc/2018/16-1.linq | 75 + www/statics/aoc/2018/16-2.linq | 113 + www/statics/aoc/2018/16_challenge.txt | 76 + www/statics/aoc/2018/16_input.txt | 4152 +++++++++++++++++++++++++ www/statics/aoc/2018/17-1.linq | 173 ++ www/statics/aoc/2018/17-2.linq | 180 ++ www/statics/aoc/2018/17_challenge.txt | 161 + www/statics/aoc/2018/17_input.txt | 1117 +++++++ www/statics/aoc/2018/18-1.linq | 99 + www/statics/aoc/2018/18-2.linq | 129 + www/statics/aoc/2018/18_challenge.txt | 161 + www/statics/aoc/2018/18_input.txt | 50 + www/statics/aoc/2018/19-1.linq | 55 + www/statics/aoc/2018/19-2.linq | 149 + www/statics/aoc/2018/19_challenge.txt | 51 + www/statics/aoc/2018/19_input.txt | 37 + www/statics/aoc/2018/20-1.linq | 268 ++ www/statics/aoc/2018/20-2.linq | 268 ++ www/statics/aoc/2018/20_challenge.txt | 144 + www/statics/aoc/2018/20_input.txt | 1 + www/statics/aoc/2018/21-1.linq | 97 + www/statics/aoc/2018/21-2.linq | 112 + www/statics/aoc/2018/21_challenge.txt | 29 + www/statics/aoc/2018/21_input.txt | 32 + www/statics/aoc/2018/22-1.linq | 50 + www/statics/aoc/2018/22-2.linq | 88 + www/statics/aoc/2018/22_challenge.txt | 336 ++ www/statics/aoc/2018/22_input.txt | 2 + www/statics/aoc/2018/23-1.linq | 16 + www/statics/aoc/2018/23-2.linq | 77 + www/statics/aoc/2018/23_challenge.txt | 60 + www/statics/aoc/2018/23_input.txt | 1000 ++++++ www/statics/aoc/2018/24-1.linq | 140 + www/statics/aoc/2018/24-2.linq | 148 + www/statics/aoc/2018/24_challenge.txt | 311 ++ www/statics/aoc/2018/24_input.txt | 23 + www/statics/aoc/2018/25-1.linq | 44 + www/statics/aoc/2018/25_challenge.txt | 89 + www/statics/aoc/2018/25_input.txt | 1177 +++++++ www/statics/aoc/__all.php | 37 + www/statics/blog/__all.php | 2 + 106 files changed, 19401 insertions(+), 11 deletions(-) create mode 100644 www/internals/adventofcode.php create mode 100644 www/statics/aoc/2018/01-1.linq create mode 100644 www/statics/aoc/2018/01-2.linq create mode 100644 www/statics/aoc/2018/01_challenge.txt create mode 100644 www/statics/aoc/2018/01_input.txt create mode 100644 www/statics/aoc/2018/02-1.linq create mode 100644 www/statics/aoc/2018/02-2.linq create mode 100644 www/statics/aoc/2018/02_challenge.txt create mode 100644 www/statics/aoc/2018/02_input.txt create mode 100644 www/statics/aoc/2018/03-1.linq create mode 100644 www/statics/aoc/2018/03-2.linq create mode 100644 www/statics/aoc/2018/03_challenge.txt create mode 100644 www/statics/aoc/2018/03_input.txt create mode 100644 www/statics/aoc/2018/04-1.linq create mode 100644 www/statics/aoc/2018/04-2.linq create mode 100644 www/statics/aoc/2018/04_challenge.txt create mode 100644 www/statics/aoc/2018/04_input.txt create mode 100644 www/statics/aoc/2018/05-1.linq create mode 100644 www/statics/aoc/2018/05-2.linq create mode 100644 www/statics/aoc/2018/05_challenge.txt create mode 100644 www/statics/aoc/2018/05_input.txt create mode 100644 www/statics/aoc/2018/06-1.linq create mode 100644 www/statics/aoc/2018/06-2.linq create mode 100644 www/statics/aoc/2018/06_challenge.txt create mode 100644 www/statics/aoc/2018/06_input.txt create mode 100644 www/statics/aoc/2018/07-1.linq create mode 100644 www/statics/aoc/2018/07-2.linq create mode 100644 www/statics/aoc/2018/07_challenge.txt create mode 100644 www/statics/aoc/2018/07_input.txt create mode 100644 www/statics/aoc/2018/08-1.linq create mode 100644 www/statics/aoc/2018/08-2.linq create mode 100644 www/statics/aoc/2018/08_challenge.txt create mode 100644 www/statics/aoc/2018/08_input.txt create mode 100644 www/statics/aoc/2018/09-1.linq create mode 100644 www/statics/aoc/2018/09-2.linq create mode 100644 www/statics/aoc/2018/09_challenge.txt create mode 100644 www/statics/aoc/2018/09_input.txt create mode 100644 www/statics/aoc/2018/10-1.linq create mode 100644 www/statics/aoc/2018/10-2.linq create mode 100644 www/statics/aoc/2018/10_challenge.txt create mode 100644 www/statics/aoc/2018/10_input.txt create mode 100644 www/statics/aoc/2018/11-1.linq create mode 100644 www/statics/aoc/2018/11-2.linq create mode 100644 www/statics/aoc/2018/11_challenge.txt create mode 100644 www/statics/aoc/2018/11_input.txt create mode 100644 www/statics/aoc/2018/12-1.linq create mode 100644 www/statics/aoc/2018/12-2.linq create mode 100644 www/statics/aoc/2018/12_challenge.txt create mode 100644 www/statics/aoc/2018/12_input.txt create mode 100644 www/statics/aoc/2018/13-1.linq create mode 100644 www/statics/aoc/2018/13-2.linq create mode 100644 www/statics/aoc/2018/13_challenge.txt create mode 100644 www/statics/aoc/2018/13_input.txt create mode 100644 www/statics/aoc/2018/14-1.linq create mode 100644 www/statics/aoc/2018/14-2.linq create mode 100644 www/statics/aoc/2018/14_challenge.txt create mode 100644 www/statics/aoc/2018/14_input.txt create mode 100644 www/statics/aoc/2018/15-1.linq create mode 100644 www/statics/aoc/2018/15-2.linq create mode 100644 www/statics/aoc/2018/15_challenge.txt create mode 100644 www/statics/aoc/2018/15_input.txt create mode 100644 www/statics/aoc/2018/16-1.linq create mode 100644 www/statics/aoc/2018/16-2.linq create mode 100644 www/statics/aoc/2018/16_challenge.txt create mode 100644 www/statics/aoc/2018/16_input.txt create mode 100644 www/statics/aoc/2018/17-1.linq create mode 100644 www/statics/aoc/2018/17-2.linq create mode 100644 www/statics/aoc/2018/17_challenge.txt create mode 100644 www/statics/aoc/2018/17_input.txt create mode 100644 www/statics/aoc/2018/18-1.linq create mode 100644 www/statics/aoc/2018/18-2.linq create mode 100644 www/statics/aoc/2018/18_challenge.txt create mode 100644 www/statics/aoc/2018/18_input.txt create mode 100644 www/statics/aoc/2018/19-1.linq create mode 100644 www/statics/aoc/2018/19-2.linq create mode 100644 www/statics/aoc/2018/19_challenge.txt create mode 100644 www/statics/aoc/2018/19_input.txt create mode 100644 www/statics/aoc/2018/20-1.linq create mode 100644 www/statics/aoc/2018/20-2.linq create mode 100644 www/statics/aoc/2018/20_challenge.txt create mode 100644 www/statics/aoc/2018/20_input.txt create mode 100644 www/statics/aoc/2018/21-1.linq create mode 100644 www/statics/aoc/2018/21-2.linq create mode 100644 www/statics/aoc/2018/21_challenge.txt create mode 100644 www/statics/aoc/2018/21_input.txt create mode 100644 www/statics/aoc/2018/22-1.linq create mode 100644 www/statics/aoc/2018/22-2.linq create mode 100644 www/statics/aoc/2018/22_challenge.txt create mode 100644 www/statics/aoc/2018/22_input.txt create mode 100644 www/statics/aoc/2018/23-1.linq create mode 100644 www/statics/aoc/2018/23-2.linq create mode 100644 www/statics/aoc/2018/23_challenge.txt create mode 100644 www/statics/aoc/2018/23_input.txt create mode 100644 www/statics/aoc/2018/24-1.linq create mode 100644 www/statics/aoc/2018/24-2.linq create mode 100644 www/statics/aoc/2018/24_challenge.txt create mode 100644 www/statics/aoc/2018/24_input.txt create mode 100644 www/statics/aoc/2018/25-1.linq create mode 100644 www/statics/aoc/2018/25_challenge.txt create mode 100644 www/statics/aoc/2018/25_input.txt create mode 100644 www/statics/aoc/__all.php diff --git a/www/internals/adventofcode.php b/www/internals/adventofcode.php new file mode 100644 index 0000000..1db47dd --- /dev/null +++ b/www/internals/adventofcode.php @@ -0,0 +1,128 @@ + [ 'url-aoc'=>'https://adventofcode.com/2018/day/', 'blog-id' => 23, 'github' => 'https://github.com/Mikescher/AdventOfCode2018' ], + '2019' => [ 'url-aoc'=>'https://adventofcode.com/2019/day/', 'blog-id' => 24, 'github' => 'https://github.com/Mikescher/AdventOfCode2019' ], + ]; + + const LANGUAGES = + [ + 'cs' => ['ext'=>'linq', 'css'=>'language-csharp', 'name'=>'C#'], + ]; + + public static function listAllFromAllYears() + { + $all = require (__DIR__ . '/../statics/aoc/__all.php'); + + array_walk($all, function(&$value, $year) { array_walk($value, function (&$innervalue) use ($year) { $innervalue = self::readSingle($year, $innervalue); }); }); + + return $all; + } + + public static function listSingleYear($year) + { + $all = require (__DIR__ . '/../statics/aoc/__all.php'); + + return array_map('self::readSingle', $all[$year]); + } + + public static function listYears() + { + $all = require (__DIR__ . '/../statics/aoc/__all.php'); + + return array_keys($all); + } + + public static function readSingle($year, $a) + { + $yeardata = self::YEARS[$year]; + + $n2p = str_pad($a['day'], 2, '0', STR_PAD_LEFT); + $a['day-padded'] = $n2p; + + $a['url'] = '/blog/' . $yeardata['blog-id'] . '/Advent_of_Code_' . $year . '/day-' . $n2p; + $a['canonical'] = "https://www.mikescher.com" . $a['url']; + + $a['url_aoc'] = $yeardata['url-aoc'] . $a['day']; // adventofcode.com/{year}/day/{day} + + $a['file_challenge'] = (__DIR__ . '/../statics/aoc/'.$year.'/'.$n2p.'_challenge.txt'); + $a['file_input'] = (__DIR__ . '/../statics/aoc/'.$year.'/'.$n2p.'_input.txt'); + + $solutionfiles = []; + + foreach ($a['languages'] as $language) + { + for ($i=1; $i <= $a['parts']; $i++) + { + $solutionfiles []= (__DIR__ . '/../statics/aoc/' . $year . '/' . $n2p . '-' . $i . '.' . self::LANGUAGES[$language]['ext']); + } + } + + $a['file_solutions'] = $solutionfiles; + + return $a; + } + + public static function getDayFromStrIdent($year, $ident) + { + $e = explode('-', $ident, 2); // day-xxx + if (count($e)!==2) return null; + + $i = intval($e[1], 10); + if ($i == 0) return null; + + return self::getSingleDay($year, $i); + } + + public static function getSingleDay($year, $day) + { + foreach (self::listSingleYear($year) as $aocd) { + if ($aocd['day'] == $day) return $aocd; + } + return null; + } + + public static function checkConsistency() + { + $warn = null; + + foreach (self::listAllFromAllYears() as $year => $yd) + { + $daylist = []; + $titlelist = []; + + if (!array_key_exists($year, self::YEARS)) return ['result'=>'err', 'message' => 'Invalid Year: ' . $year]; + + foreach ($yd as $aocdata) + { + if (in_array($aocdata['day'], $daylist)) return ['result'=>'err', 'message' => 'Duplicate day ' . $aocdata['day']]; + $daylist []= $aocdata['day']; + + if (in_array($aocdata['title'], $titlelist)) return ['result'=>'err', 'message' => 'Duplicate title ' . $aocdata['title']]; + $titlelist []= $aocdata['title']; + + if (count($aocdata['solutions']) !== $aocdata['parts']) return ['result'=>'err', 'message' => 'Not enough solution-values in day' . $aocdata['day']]; + if (count($aocdata['file_solutions']) !== $aocdata['parts']) return ['result'=>'err', 'message' => 'Not enough solution-files in day' . $aocdata['day']]; + + if (!file_exists($aocdata['file_challenge'])) return ['result'=>'err', 'message' => 'file_challenge not found ' . $aocdata['file_challenge']]; + if (!file_exists($aocdata['file_input'])) return ['result'=>'err', 'message' => 'file_input not found ' . $aocdata['file_input']]; + + foreach ($aocdata['file_solutions'] as $sfile) + { + if (!file_exists($sfile)) return ['result'=>'err', 'message' => 'file_solution[?] not found ' . $sfile]; + } + + foreach ($aocdata['languages'] as $lang) + { + if (!array_key_exists($lang, self::LANGUAGES)) return ['result'=>'err', 'message' => 'Unknown language ' . $lang]; + } + } + } + + if ($warn != null) return $warn; + return ['result'=>'ok', 'message' => '']; + } +} \ No newline at end of file diff --git a/www/internals/blog.php b/www/internals/blog.php index 1dbcca4..6ffb112 100644 --- a/www/internals/blog.php +++ b/www/internals/blog.php @@ -6,10 +6,10 @@ class Blog { $all = require (__DIR__ . '/../statics/blog/__all.php'); - return array_map('self::completeSingle', $all); + return array_map('self::readSingle', $all); } - private static function completeSingle($d) + private static function readSingle($d) { if ($d['cat']==='blog') $d['url'] = "/blog/" . $d['id'] . "/" . destructiveUrlEncode($d['title']); @@ -20,6 +20,8 @@ class Blog $d['file_fragment'] = __DIR__ . '/../statics/blog/' . $d['fragment']; + if (!array_key_exists('extras', $d)) $d['extras'] = []; + return $d; } @@ -66,6 +68,12 @@ class Blog // aok + } else if ($post['type'] === 'aoc') { + + if (!array_key_exists('aoc:year', $post['extras'])) return ['result'=>'err', 'message' => 'AdventOfCode metadata [aoc:year] missing: ' . $post['title']]; + + // aok + } else { return ['result'=>'err', 'message' => 'Unknown type ' . $post['type']]; diff --git a/www/internals/euler.php b/www/internals/euler.php index 181b85d..c6b3c04 100644 --- a/www/internals/euler.php +++ b/www/internals/euler.php @@ -34,7 +34,7 @@ class Euler public static function getEulerProblemFromStrIdent($ident) { - $e = explode('-', $ident, 2); + $e = explode('-', $ident, 2); // problem-xxx if (count($e)!==2) return null; $i = intval($e[1], 10); diff --git a/www/pages/admin.php b/www/pages/admin.php index 7602096..0f04a50 100644 --- a/www/pages/admin.php +++ b/www/pages/admin.php @@ -6,6 +6,7 @@ require_once (__DIR__ . '/../internals/highscores.php'); require_once (__DIR__ . '/../internals/alephnoteStatistics.php'); require_once (__DIR__ . '/../internals/blog.php'); require_once (__DIR__ . '/../internals/euler.php'); +require_once (__DIR__ . '/../internals/adventofcode.php'); require_once (__DIR__ . '/../internals/highscores.php'); require_once (__DIR__ . '/../internals/mikeschergitgraph.php'); require_once (__DIR__ . '/../internals/programs.php'); @@ -21,6 +22,7 @@ $consistency_books = Books::checkConsistency(); $consistency_egh = MikescherGitGraph::checkConsistency(); $consistency_progimg = Programs::checkThumbnails(); $consistency_bookimg = Books::checkThumbnails(); +$consistency_aoc = AdventOfCode::checkConsistency(); ?> Book thumbnails:
Blog data:
Euler data:
+
AdventOfCode data:
Programs data:
Books data:
diff --git a/www/pages/blog_view.php b/www/pages/blog_view.php index 4b96f86..e947462 100644 --- a/www/pages/blog_view.php +++ b/www/pages/blog_view.php @@ -9,12 +9,10 @@ $id = $OPTIONS['id']; $subview = $OPTIONS['subview']; $post = Blog::getBlogpost($id); - if ($post === NULL) httpError(404, 'Blogpost not found'); $isSubEuler = ($post['type'] === 'euler' && $subview !== ''); $isBaseEuler = ($post['type'] === 'euler'); - $eulerproblem = null; if ($isSubEuler) { @@ -23,13 +21,31 @@ if ($isSubEuler) } if ($eulerproblem === null) $isSubEuler = false; +$isSubAdventOfCode = ($post['type'] === 'aoc' && $subview !== ''); +$isAdventOfCode = ($post['type'] === 'aoc'); +$adventofcodeday = null; +if ($isSubAdventOfCode) +{ + require_once(__DIR__ . '/../internals/adventofcode.php'); + $adventofcodeday = AdventOfCode::getDayFromStrIdent($post['extras']['aoc:year'], $subview); +} +if ($adventofcodeday === null) $isSubAdventOfCode = false; + +$title = $post['title']; +if ($isSubEuler) $title = $eulerproblem['title']; +if ($isSubAdventOfCode) $title = $adventofcodeday['title']; + +$canonical = $post['canonical']; +if ($isSubEuler) $canonical = $eulerproblem['canonical']; +if ($isSubAdventOfCode) $canonical = $adventofcodeday['canonical']; + ?> - Mikescher.com - <?php echo ($isSubEuler ? $eulerproblem['title'] : $post['title']); ?> + Mikescher.com - <?php echo $title; ?> - '; ?> + '; ?> @@ -53,15 +69,16 @@ if ($eulerproblem === null) $isSubEuler = false; include (__DIR__ . '/../fragments/blogview_markdown.php'); - } elseif ($post['type'] === 'bfjoust') { - - include (__DIR__ . '/../fragments/blogview_bfjoust.php'); - } elseif ($post['type'] === 'euler') { if ($subview === '') include (__DIR__ . '/../fragments/blogview_euler_list.php'); else include (__DIR__ . '/../fragments/blogview_euler_single.php'); + } elseif ($post['type'] === 'aoc') { + + if ($subview === '') include (__DIR__ . '/../fragments/blogview_aoc_list.php'); + else include (__DIR__ . '/../fragments/blogview_aoc_single.php'); + } ?> diff --git a/www/statics/aoc/2018/01-1.linq b/www/statics/aoc/2018/01-1.linq new file mode 100644 index 0000000..12ee512 --- /dev/null +++ b/www/statics/aoc/2018/01-1.linq @@ -0,0 +1,6 @@ + + +File + .ReadAllLines(Path.Combine(Path.GetDirectoryName(Util.CurrentQueryPath), @"01_input.txt")) + .Select(int.Parse) + .Sum() \ No newline at end of file diff --git a/www/statics/aoc/2018/01-2.linq b/www/statics/aoc/2018/01-2.linq new file mode 100644 index 0000000..88e9788 --- /dev/null +++ b/www/statics/aoc/2018/01-2.linq @@ -0,0 +1,9 @@ + + +HashSet visited = new HashSet(); +int sum = 0; +foreach (var v in Enumerable.Repeat(File.ReadAllLines(Path.Combine(Path.GetDirectoryName(Util.CurrentQueryPath), @"01_input.txt")).Select(int.Parse), int.MaxValue).SelectMany(p=>p)) +{ + sum += v; + if (!visited.Add(sum)) { sum.Dump(); return; } +} \ No newline at end of file diff --git a/www/statics/aoc/2018/01_challenge.txt b/www/statics/aoc/2018/01_challenge.txt new file mode 100644 index 0000000..f7d09e9 --- /dev/null +++ b/www/statics/aoc/2018/01_challenge.txt @@ -0,0 +1,53 @@ +--- 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." + +"The bad news is that we are detecting roughly fifty anomalies throughout time; the device will indicate fixed anomalies with stars. The other bad news is that we only have one device and you're the best person for the job! Good lu--" She taps a button on the device and you suddenly feel like you're falling. To save Christmas, you need to get 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! + +After feeling like you've been falling for a few minutes, you look at the device's tiny screen. "Error: Device must be calibrated before first use. Frequency drift detected. Cannot maintain destination lock." Below the message, the device shows a sequence of changes in frequency (your puzzle input). A value like +6 means the current frequency increases by 6; a value like -3 means the current frequency decreases by 3. + +For example, if the device displays frequency changes of +1, -2, +3, +1, then starting from a frequency of zero, the following changes would occur: + + Current frequency 0, change of +1; resulting frequency 1. + Current frequency 1, change of -2; resulting frequency -1. + Current frequency -1, change of +3; resulting frequency 2. + Current frequency 2, change of +1; resulting frequency 3. + +In this example, the resulting frequency is 3. + +Here are other example situations: + + +1, +1, +1 results in 3 + +1, +1, -2 results in 0 + -1, -2, -3 results in -6 + +Starting with a frequency of zero, what is the resulting frequency after all of the changes in frequency have been applied? + +--- Part Two --- + +You notice that the device repeats the same frequency change list over and over. To calibrate the device, you need to find the first frequency it reaches twice. + +For example, using the same list of changes above, the device would loop as follows: + + Current frequency 0, change of +1; resulting frequency 1. + Current frequency 1, change of -2; resulting frequency -1. + Current frequency -1, change of +3; resulting frequency 2. + Current frequency 2, change of +1; resulting frequency 3. + (At this point, the device continues from the start of the list.) + Current frequency 3, change of +1; resulting frequency 4. + Current frequency 4, change of -2; resulting frequency 2, which has already been seen. + +In this example, the first frequency reached twice is 2. Note that your device might need to repeat its list of frequency changes many times before a duplicate frequency is found, and that duplicates might be found while in the middle of processing the list. + +Here are other examples: + + +1, -1 first reaches 0 twice. + +3, +3, +4, -2, -4 first reaches 10 twice. + -6, +3, +8, +5, -6 first reaches 5 twice. + +7, +7, -2, -7, -4 first reaches 14 twice. + +What is the first frequency your device reaches twice? diff --git a/www/statics/aoc/2018/01_input.txt b/www/statics/aoc/2018/01_input.txt new file mode 100644 index 0000000..56ca2ab --- /dev/null +++ b/www/statics/aoc/2018/01_input.txt @@ -0,0 +1,1015 @@ +-8 +-13 ++17 ++7 ++12 +-18 ++19 ++14 +-19 ++16 +-10 +-16 +-16 +-8 +-7 ++19 ++10 +-12 ++18 ++13 +-20 +-7 +-3 +-2 +-6 +-7 ++5 +-16 ++2 +-9 ++10 +-13 +-18 ++9 ++18 +-10 +-10 ++6 +-7 +-19 +-10 ++5 ++4 ++9 ++17 ++3 +-18 +-12 +-10 ++14 ++2 ++12 ++11 ++9 +-18 ++17 +-11 +-3 ++2 ++10 ++9 ++20 ++7 ++16 ++2 +-1 +-13 +-10 +-15 ++24 ++17 ++11 ++4 ++19 ++1 ++16 +-15 +-12 +-2 ++11 ++15 ++14 +-18 ++9 ++13 +-17 +-9 +-1 ++17 +-19 +-19 ++23 +-3 ++8 +-14 +-6 ++5 +-8 +-2 ++4 +-11 +-5 ++18 ++2 ++18 ++12 ++19 ++6 +-14 +-1 +-4 ++15 ++17 +-4 +-20 +-15 ++5 ++18 +-13 +-1 ++15 ++18 ++7 ++14 ++12 ++16 +-8 ++7 ++15 +-19 +-16 +-15 +-5 +-10 ++6 ++12 ++1 +-7 ++1 ++14 ++11 +-1 +-15 ++3 ++14 +-11 +-17 +-6 +-4 ++16 +-9 ++12 ++9 ++18 ++16 ++5 ++10 ++16 ++12 ++16 +-5 ++15 ++9 ++7 ++6 +-19 ++7 ++16 ++15 ++4 +-3 ++1 +-10 ++16 +-9 ++19 ++2 ++2 ++10 +-7 +-14 +-14 +-2 +-7 +-18 +-23 ++18 ++15 ++3 ++1 +-12 ++7 +-18 ++6 +-7 +-12 +-12 +-7 +-4 +-11 +-2 ++3 ++12 ++11 +-18 ++17 +-7 +-19 ++12 ++12 ++7 ++13 +-10 ++5 +-18 +-8 ++7 ++10 ++15 ++7 ++10 +-7 +-13 +-14 ++19 +-7 ++23 +-10 +-21 ++3 +-6 +-30 ++7 ++2 +-22 +-4 ++8 ++17 +-15 ++25 +-2 ++8 ++18 ++2 ++23 +-20 ++19 ++20 +-2 ++4 +-16 ++7 +-11 ++15 ++13 ++8 ++3 ++14 +-3 +-4 +-11 ++2 +-6 +-22 ++4 ++16 ++5 ++4 ++18 ++7 ++16 +-14 +-13 ++10 ++10 ++12 ++1 ++12 ++3 ++4 ++12 ++3 ++2 ++16 +-12 +-11 ++19 +-6 ++8 ++11 ++20 +-17 +-11 +-14 +-19 ++8 +-3 +-16 ++13 +-8 +-18 +-7 +-16 +-10 ++11 +-2 +-14 +-2 ++19 ++18 ++8 +-4 ++9 ++17 ++12 ++12 ++2 +-19 ++3 ++10 +-16 ++17 +-18 +-10 ++16 ++9 ++18 ++14 +-1 +-14 ++12 +-19 ++9 +-6 +-17 +-26 +-21 ++13 +-17 ++2 +-18 ++21 +-7 +-3 ++32 +-5 +-16 ++3 +-16 +-15 ++2 +-24 ++40 ++16 +-22 ++26 +-19 ++22 +-20 +-25 +-20 +-13 ++20 ++57 ++14 ++6 ++22 ++17 +-7 +-18 ++30 ++16 ++12 +-22 ++5 +-1 ++4 +-6 +-31 +-38 ++10 ++4 ++85 ++8 +-10 ++8 ++6 +-5 +-8 ++36 ++9 ++19 +-1 ++18 ++15 ++9 ++21 ++11 +-7 +-15 ++10 ++20 +-4 +-19 ++16 +-11 +-4 ++11 ++6 ++13 ++3 ++7 ++20 ++15 ++13 +-10 ++9 ++3 +-11 ++6 ++12 ++1 ++5 +-2 ++11 ++3 +-16 +-19 +-10 +-12 ++8 ++20 +-2 +-22 +-10 +-5 ++12 +-9 ++24 ++7 +-13 +-26 +-29 +-8 ++19 +-4 +-4 +-46 +-26 +-17 ++20 +-17 +-36 +-5 +-18 ++21 ++8 +-1 ++32 ++7 ++18 ++27 ++2 ++4 +-9 ++8 +-17 ++48 ++4 ++6 ++28 ++14 +-4 ++15 ++1 ++24 +-14 ++2 ++11 ++15 +-16 ++3 ++62 ++15 +-253 +-12 +-27 +-111 ++196 ++70135 +-1 ++17 ++13 ++8 +-17 +-13 +-11 +-4 +-9 +-13 ++1 +-8 +-14 ++10 +-3 +-2 ++15 ++8 +-1 ++2 ++4 +-1 ++6 +-7 ++17 ++4 +-17 ++19 ++1 ++5 +-19 +-18 +-11 ++14 +-13 ++2 +-16 ++9 +-5 ++16 +-13 +-9 +-3 ++8 ++2 ++7 +-19 +-2 ++6 +-9 +-12 ++11 ++7 +-12 +-18 +-3 ++5 +-6 ++20 ++3 +-11 +-13 ++3 +-12 +-15 +-7 ++10 +-2 ++20 ++13 +-1 +-3 ++16 +-18 +-5 ++15 ++5 +-4 ++3 +-2 ++4 ++7 ++24 ++9 ++26 +-4 ++17 ++2 +-17 +-12 +-5 ++24 ++4 ++16 +-4 ++7 ++7 ++20 ++1 +-5 ++16 +-17 +-13 ++3 +-14 ++12 ++7 +-13 +-15 ++3 ++13 ++19 +-6 +-7 +-9 ++17 ++1 +-17 +-19 ++17 +-11 ++4 ++2 ++10 ++25 +-5 ++20 +-14 ++9 ++3 ++11 +-15 ++18 +-16 ++12 ++15 +-10 ++3 +-12 ++17 ++11 +-4 ++3 +-11 ++16 ++2 +-4 +-7 ++19 +-13 ++4 +-18 +-14 +-17 +-4 ++7 ++11 ++8 ++16 ++14 +-15 +-1 ++19 ++15 ++7 ++11 ++13 +-3 ++1 +-16 +-19 +-8 ++9 +-12 +-19 +-7 ++15 ++9 ++3 ++15 +-10 ++19 +-5 ++11 ++9 +-3 ++1 +-12 +-8 +-10 ++5 ++2 +-1 ++18 +-10 ++21 ++17 ++18 +-16 ++6 +-5 +-16 ++18 ++6 ++16 +-3 +-9 ++7 ++19 +-15 ++9 +-6 +-8 ++10 ++20 ++4 +-2 +-8 +-9 ++4 ++12 +-14 ++10 ++2 +-11 +-7 ++1 +-13 ++8 ++9 +-3 ++10 ++5 +-6 +-1 ++19 ++2 ++20 ++3 ++11 +-8 +-7 ++3 +-12 ++4 ++11 +-14 ++17 ++16 ++7 ++10 ++17 +-3 ++1 ++1 +-7 ++11 ++18 ++8 +-3 +-10 ++15 +-9 ++6 +-8 +-9 ++16 +-17 ++9 ++6 ++5 ++8 ++11 ++12 +-17 +-9 ++12 ++13 ++6 +-8 ++14 +-17 +-5 ++9 ++16 ++3 +-8 ++12 ++14 +-19 +-3 +-11 +-10 +-10 ++3 ++22 +-12 +-19 ++14 +-6 +-12 ++1 +-19 ++8 ++13 ++4 +-23 +-3 ++10 +-20 ++14 +-11 +-2 +-16 +-5 +-16 +-8 ++1 +-7 ++4 ++5 +-10 +-14 +-14 +-10 ++9 +-18 ++10 ++19 +-6 +-2 ++16 ++16 +-4 ++21 ++12 +-14 ++22 ++13 +-19 +-5 ++2 +-17 ++21 +-11 +-9 +-20 +-2 +-15 +-4 ++7 +-6 +-5 +-3 +-6 ++11 ++10 +-17 +-8 ++6 +-1 +-29 +-21 ++5 +-7 +-16 +-1 +-14 ++20 ++10 ++10 +-3 +-1 +-20 ++12 +-9 ++3 ++1 +-10 +-15 +-5 +-2 ++6 +-24 +-15 +-21 +-3 +-12 +-9 ++7 ++10 +-20 +-19 +-1 ++22 ++12 ++5 +-3 ++14 +-42 ++4 ++13 +-9 ++46 ++19 ++3 ++11 ++2 ++30 +-12 ++29 ++13 +-41 ++15 +-13 +-16 +-9 ++20 +-35 +-27 +-100 ++1 ++2 ++7 +-1 +-29 ++8 +-40 +-1 +-13 +-24 +-3 +-21 ++2 +-22 ++16 ++14 ++22 +-3 ++5 +-17 ++11 ++19 +-28 ++54 ++6 +-10 +-3 ++10 ++19 +-135 +-31 +-19 +-10 +-6 ++18 ++18 +-15 ++12 ++14 +-7 +-9 +-5 +-7 ++10 ++20 ++13 +-2 +-4 +-1 +-32 +-12 ++84 ++42 ++36 +-106 ++26 +-61 ++16 ++48 +-102 +-64 +-16 ++18 +-25 ++31 ++309 ++24 ++178 ++70218 +-8 +-2 +-18 ++1 ++18 ++3 +-15 +-1 +-11 ++17 ++2 ++11 +-9 ++11 +-6 ++2 +-8 ++11 +-16 +-16 +-5 +-2 ++1 ++4 +-12 ++17 +-11 ++4 +-12 +-7 ++12 +-4 +-2 +-16 +-140560 \ No newline at end of file diff --git a/www/statics/aoc/2018/02-1.linq b/www/statics/aoc/2018/02-1.linq new file mode 100644 index 0000000..a28dc25 --- /dev/null +++ b/www/statics/aoc/2018/02-1.linq @@ -0,0 +1,8 @@ + + +File + .ReadAllLines(Path.Combine(Path.GetDirectoryName(Util.CurrentQueryPath), @"02_input.txt")) + .Select(s => (s.GroupBy(p => p).Any(g => g.Count() == 2) ? 1 : 0, s.GroupBy(p => p).Any(g => g.Count() == 3) ? 1 : 0)) + .Select(p => new[] { p.Item1, p.Item2 }) + .Aggregate((a, b) => new[] { a[0] + b[0], a[1] + b[1] }) + .Aggregate((a, b) => a * b) \ No newline at end of file diff --git a/www/statics/aoc/2018/02-2.linq b/www/statics/aoc/2018/02-2.linq new file mode 100644 index 0000000..a00706e --- /dev/null +++ b/www/statics/aoc/2018/02-2.linq @@ -0,0 +1,11 @@ + + +var data = File.ReadAllLines(Path.Combine(Path.GetDirectoryName(Util.CurrentQueryPath), @"02_input.txt")); + +data + .Select(d1 => data.Where(d2 => d1.Zip(d2.ToCharArray(), (a,b) => a!=b).Count(p=>p)==1 )) + .Where(p => p.Any()) + .Select(p => p.First()) + .Aggregate((a, b) => new string(a.Zip(b.ToCharArray(), (u,v)=>(u==v?u:'_')).ToArray()) ) + .Replace("_", "") + .Dump(); \ No newline at end of file diff --git a/www/statics/aoc/2018/02_challenge.txt b/www/statics/aoc/2018/02_challenge.txt new file mode 100644 index 0000000..e86f408 --- /dev/null +++ b/www/statics/aoc/2018/02_challenge.txt @@ -0,0 +1,43 @@ +--- 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!" + +"Wouldn't they have had enough fabric to fill several boxes in the warehouse? They'd be stored together, so the box IDs should be similar. Too bad it would take forever to search the warehouse for two similar box IDs..." They walk too far away to hear any more. + +Late at night, you sneak to the warehouse - who knows what kinds of paradoxes you could cause if you were discovered - and use your fancy wrist device to quickly scan every box and produce a list of the likely candidates (your puzzle input). + +To make sure you didn't miss any, you scan the likely candidate boxes again, counting the number that have an ID containing exactly two of any letter and then separately counting those with exactly three of any letter. You can multiply those two counts together to get a rudimentary checksum and compare it to what your device predicts. + +For example, if you see the following box IDs: + + abcdef contains no letters that appear exactly two or three times. + bababc contains two a and three b, so it counts for both. + abbcde contains two b, but no letter appears exactly three times. + abcccd contains three c, but no letter appears exactly two times. + aabcdd contains two a and two d, but it only counts once. + abcdee contains two e. + ababab contains three a and three b, but it only counts once. + +Of these box IDs, four of them contain a letter which appears exactly twice, and three of them contain a letter which appears exactly three times. Multiplying these together produces a checksum of 4 * 3 = 12. + +What is the checksum for your list of box IDs? + +--- Part Two --- + +Confident that your list of box IDs is complete, you're ready to find the boxes full of prototype fabric. + +The boxes will have IDs which differ by exactly one character at the same position in both strings. For example, given the following box IDs: + +abcde +fghij +klmno +pqrst +fguij +axcye +wvxyz + +The IDs abcde and axcye are close, but they differ by two characters (the second and fourth). However, the IDs fghij and fguij differ by exactly one character, the third (h and u). Those must be the correct boxes. + +What letters are common between the two correct box IDs? (In the example above, this is found by removing the differing character from either ID, producing fgij.) diff --git a/www/statics/aoc/2018/02_input.txt b/www/statics/aoc/2018/02_input.txt new file mode 100644 index 0000000..7325aed --- /dev/null +++ b/www/statics/aoc/2018/02_input.txt @@ -0,0 +1,250 @@ +ayitmcjvlhedbsyoqfzukjpxwt +agirmcjvlheybsyogfzuknpxxt +wgirmcjvlvedbsyoqfzujnpxwt +agizmcjvlhedbsyoqfzuenlxwt +aryrmcjvlheebsyoqfzuknpxwt +agirmcjelhedbsyoqfzukosxwt +azirmcjvlhedbsooqfzuknpxvt +agirmcjvffedbsyoqfzudnpxwt +agilmcjvlhedbsyrqfzuknpxrt +agirmcjvlhndbsyoofzukcpxwt +awirmcjvlhedbsyoqfzuknpxlz +aghrmcjmlhewbsyoqfzuknpxwt +apirmcjvlmedbsyoqfzcknpxwt +jgiricjvlhedbsyrqfzuknpxwt +abirmcjvlbedbsyoqfzuknpxwo +agirmcjvlhedbsyojfzuknpgkt +agicmclvlhedbmyoqfzuknpxwt +aslrzcjvlhedbsyoqfzuknpxwt +agiqmcjvlhedbsymqfzurnpxwt +agirmcjvlwedbsyoqfzuknfxmt +agiumcjvlhedbsyoqfzuknpbyt +xgirxcjvlwedbsyoqfzuknpxwt +bgtrvcjvlhedbsyoqfzuknpxwt +afirmcjvlpedbsyoqvzuknpxwt +agirmcjjvhedbsyoqfzukmpxwt +ggirmcjvlhedbsyoqfzukypxvt +agirmdjulhekbsyoqfzuknpxwt +agirmcjqlhedbsyoqfztknixwt +agirmcjvjhedbsyomfduknpxwt +agirmcjvlhedbgyoqfzuknpxtq +agirmvjvlhbdbsyfqfzuknpxwt +agirmcjvlhedbsyatfzbknpxwt +agirmcjvlrlybsyoqfzuknpxwt +agirmajvlhedbsqovfzuknpxwt +abinmcrvlhedbsyoqfzuknpxwt +agnrmcjvlhedbsyurfzuknpxwt +agirmpjvlhedbsyoqezuknpxct +agirmxjvlhedbsgoqjzuknpxwt +agirmcjvlhehbstoqfzuknpxht +qgirmcjvlhepcsyoqfzuknpxwt +tgirmcjvlhkdbsyoqszuknpxwt +agirmcjvdhedbscoqftuknpxwt +agbrmcjvlhedbsyoqfzukqpxwj +agurmcjvlhedbsyaqfzuknpxmt +agirmcjvohudbsyoqfmuknpxwt +agirmcjvlhekbsyoqfbuktpxwt +agirmcjvlhedhsyoqfzugnnxwt +agirmcjvlhedbsyjqyzuknpxft +agirmcjvlhedbsymufznknpxwt +agirmcjhlheubsyoqfzuknpxmt +agirmcjvlhwdbsywqfzwknpxwt +agirmcjvljedbsgqqfzuknpxwt +aglrmcjelhedbsyoqfzuknpxkt +agxrmcjvlhxdbsyoqfquknpxwt +agirmcjvnhedbsyoqfzuenfxwt +agirmcjvlhedbsyoqfzatnqxwt +agirmcvvlhedbsboqfzuknuxwt +agirncjvlhezbsyoqfzulnpxwt +agiamcjvdiedbsyoqfzuknpxwt +agirmcjvwhedbskoqfzhknpxwt +agiwmcjflhedbsyoqfzulnpxwt +agirmcjvlhedboyoqfzuknpjwl +agivmcjslhedbsyoqfzdknpxwt +agirmcjvlcedbsyoqfzukepxyt +akirmcjvlhjdbssoqfzuknpxwt +agvrmcjvldedmsyoqfzuknpxwt +agirecjvlhidbsyoqfzukbpxwt +abirmcjvlhjdbsyoqfkuknpxwt +agirmcjelhedbfyoqfzuknpxwj +agirmcjvlhedbbyoqrzukwpxwt +akirmcjvlhedbsyoyfzuknplwt +agirmcjvlhedbsydsfzuknpxwq +agirrcjvlhedbsyoqazuknpmwt +aeirmcjvlhedbsyoqfvuknpwwt +akirmcjvlhedbsyoqpzudnpxwt +agijmcjvlhedbsyuqfzunnpxwt +agirmcjilhedasyoqizuknpxwt +agirmczvlhzdbsyoqfzuknpxwx +agirmcjvlhehbsyoifzuknpxwo +agirwcjvlhedbsyoqfzuenpxst +agirmcjvlhedbsyoquzuknhxft +agirmcqvlkedbsyoqfzrknpxwt +agirmcqvlhenbsyoqfzuknpuwt +agirmcjvleedbsyoqfzhhnpxwt +agirmcjvlhembsyrqfauknpxwt +agirmcjvlhedbssoqflcknpxwt +aqirmcjvlnedbsyoqfzuknpxpt +agirmcjqlhedbxpoqfzuknpxwt +fgirmcjvlhedbsyoqfzukqpqwt +aggrmcjvlhpdbsyoqfzuknpxjt +agirmwjvlhedbsywqfzuknpzwt +agirmcailhembsyoqfzuknpxwt +aglrmcjvlhxdbsyoqfzuknpxet +xgirmcjvlhzdbsyoqfzukrpxwt +agvrmcjvuhedbsyoqfzuknpxgt +agikmcjvlhecbsyoqfzuknpxwr +agyrmcjvlhezbsyoqfouknpxwt +agirmcjvfhjdbsyokfzuknpxwt +agkrmjjvlhedtsyoqfzuknpxwt +agirmgjvlhedbiyoqfzuknpxwv +wcirmcjvlhedbsyoqfzuknpxwo +aairmcjvlhedbstoqfguknpxwt +hgirmcjvlhedwfyoqfzuknpxwt +agirmcjvmhfdbmyoqfzuknpxwt +agirmcjvlhvdbsioqfzuanpxwt +agrrmcjvgsedbsyoqfzuknpxwt +agirmcjvlqetbsysqfzuknpxwt +agirccjvlhedbsyoqfzuknkcwt +agirmqjvlhedbsdoqfzkknpxwt +agirmcjvlheobsyopfzuknpxwg +agirmcjolhedbsyofpzuknpxwt +agirmcjnlhedbsyoqkzukfpxwt +agiumcjvlheabsyoqfzuknpxbt +agipmcjvlhedbsyoqfzukupxwz +atirmcrvlhedbsyoqfnuknpxwt +agirmcjvnhedfkyoqfzuknpxwt +agirmrjvlhedboyoqfzvknpxwt +abhrmcjvlhedbtyoqfzuknpxwt +cbirmcjvlhedbfyoqfzuknpxwt +agirmcjvlhedbsyoqfmwknjxwt +ahirmcjvlhedbsloqfzuknpfwt +agarmjjvlhedbsyoqfzyknpxwt +ajirmcjvlhevjsyoqfzuknpxwt +agirmcjvlhpdbstoqfzuknpewt +agirmcsvlhedbsyoqfbupnpxwt +agirmcjvlhexbsyodfzukqpxwt +auiymcjblhedbsyoqfzuknpxwt +azirmcjvchedbsyoqfziknpxwt +aeirmcjvlhedvsyoqfzuonpxwt +agirmcjvlhedbfyoqfbukjpxwt +ygirmcjvlhidbsyoqfzukncxwt +agirmxpvlhedbsyoqffuknpxwt +ztirmcjvlhedosyoqfzuknpxwt +agirmcjvlhepbsyoqfzuenppwt +agirmcjvshedbsyoqnzaknpxwt +awirmcjvlhydbsyoqfzuknoxwt +ucirmcjvlhedbsyoqfjuknpxwt +agirmwjvlhkbbsyoqfzuknpxwt +agirmcjvldedbsyohfzuknpxzt +agirmcjvwhedbsyoqfznknpxgt +agiricjvlhedxqyoqfzuknpxwt +agirmcjvlhzdbjyoqfzukapxwt +agirmcgvlhedbsyoqfzuknaowt +agidmcjvlhedbsyoqayuknpxwt +agirmcjvlhedisnoqfzuknpxnt +wkjrmcjvlhedbsyoqfzuknpxwt +agirmcjvlhedbuyojfzukxpxwt +agkrmcjvlhedbsybqfzurnpxwt +agirmcjvghedbsyoqfzuknexwj +agirmcjvnhedbsyoqfzuznpxit +agirmcjvlbedbsyoqfiukwpxwt +agirlctvlheabsyoqfzuknpxwt +agirmcjzzhedbsyoqfzcknpxwt +akirmcjvlnedbsyoqfzlknpxwt +agirmdjvlhedpsyoqfzuknpjwt +agiyjcuvlhedbsyoqfzuknpxwt +agirmcbvltedysyoqfzuknpxwt +agirmcjvlhedfdyoqfzubnpxwt +agidmcjvlhedesfoqfzuknpxwt +aeirmcjvlhedqsyoqfxuknpxwt +agifmcjvlhedbsyoqfquknptwt +agidmcjvlhedbsyfqfzuknpxwb +agirvcjvlhedbsroqfzuknjxwt +agirmcqvlhddbsyoqfzuknpxwj +agirmcjvlhmdqsyoqizuknpxwt +atirmcjvltedbsyoqfzuknpxwz +agirxnjvlhedbsyoqfzuknpxkt +agihmcjvlhedbsyoqfzukepxqt +agirmcjvlhedbsmoqzsuknpxwt +agirycjvlhedbuyoqfwuknpxwt +agirmcjvlhedbsyoqfzfkrfxwt +agirzcjvlhedbsyoqfhuknpxnt +agigmcjvlhedbsqnqfzuknpxwt +agirmgzvlhedbsyoqfzuonpxwt +agirmcjvqhedbqyoqfzukqpxwt +anarmcjvlhedbsyocfzuknpxwt +agirmcjuihedbshoqfzuknpxwt +agirdckvlhedbsyoqfzxknpxwt +ugirmujvlhwdbsyoqfzuknpxwt +mgirmcjvlheobsyovfzuknpxwt +agirmcjvghedbsyoqfzufxpxwt +agirmcjvlhedbsyoinzuknuxwt +agirmzjvlhbdbsyoqfzlknpxwt +agivmcjvlhedbsconfzuknpxwt +agirmwfvlhedtsyoqfzuknpxwt +agirmcjvlhedbbyoqrzukncxwt +agirmcjvlhelbsyoqfzupnlxwt +agirmmjvluedqsyoqfzuknpxwt +agjrmcjvlhedbsyaqfcuknpxwt +agiwmcjvlhedbsyoqzzuknpswt +agirxcjvlhedbsyoqfyvknpxwt +agirmljvlhedbsyoqkzuknpxjt +agirmcjvchedbsyoqfzmknyxwt +agirmcjvlhedbsyovfzuynpxwl +agtrmcjvlhedysyoqfzuknexwt +agirmcjvmhedbslonfzuknpxwt +agirmcjfshedbsyoqfziknpxwt +agirmcjvlhedbsygqfzkknpbwt +agyrmcivlhedbsyovfzuknpxwt +agirmcjvghedbsyoqjzuknkxwt +agirmcjvlhedqsyoqfzukspxmt +ayirmcjvhhedbsyomfzuknpxwt +agirmcjvlnembsypqfzuknpxwt +agirmcjqlhedbsyuvfzuknpxwt +agirmcjvlhembsybqfzuknpxwa +agirjcfvlhedbsyoqfuuknpxwt +agirmcjvohedbsyowfzuknxxwt +agirmcjvlhedroyoqfzukncxwt +agrrmijvlhedbsyoqfnuknpxwt +agirmjjvlhsdbsyoqfzumnpxwt +agirrcjvnhedbsyoqfzuktpxwt +agirmcjvlzedjsyoqfzuknpdwt +agirmkjvlhedbsyoqfzxinpxwt +agirmcjvlhedbzyojfzuknpvwt +arirmcjvlheddsyoqfzuknrxwt +agirmcjvlhedbsyoqhzuanpxmt +agirmcjvluedbsyoqozuknwxwt +afirmcjwlhedxsyoqfzuknpxwt +agirmcjvlhefbsyoqfkuinpxwt +agirycjvltedbsypqfzuknpxwt +agirmrxvlhedbsyoqfzeknpxwt +agfrmcqvlhedbsyoqxzuknpxwt +agormcjvuhexbsyoqfzuknpxwt +agyrmcjvehddbsyoqfzuknpxwt +agirmcjvlheqbsynqfzgknpxwt +agirmcjvlhedbsloufwuknpxwt +tgirmcjvlwedbsyoqfzuknpqwt +agirmcjvlhesbzyogfzuknpxwt +agitmdjvlhedpsyoqfzuknpjwt +bgirmejvlhtdbsyoqfzuknpxwt +aginmcjvlhedzsyoqfzuknoxwt +agvrzcjvlhedbsuoqfzuknpxwt +agormcjvlhedbsyoqfzuknpodt +agirmcevlhedbgyojfzuknpxwt +agirmcjblhedboytqfzuknpxwt +qgibmcjvlhedbsyoqfzuknbxwt +agirmcjvlhedbsyoafzutnnxwt +agiamcjvchkdbsyoqfzuknpxwt +agirmcjvehedblyoqwzuknpxwt +agirmcpvlhwdbsyoafzuknpxwt +agirmcjvlhtdbsyoqfzumnpxtt +agirmcjalhegtsyoqfzuknpxwt +agirdijvlhedbsyoqfzutnpxwt +agirmckvlhgdbsyovfzuknpxwt +qgmrmcjvlkedbsyoqfzuknpxwt +agirjcjvlhodbsyoqfzuanpxwt +ajirmcjvlhedbpyoqftuknpxwt +cgirmcjvlhedbsyoqfiuonpxwt +ayirmcjvlhedbsyaqfzuknwxwt +agirmcjvlhedbdyoqbzwknpxwt diff --git a/www/statics/aoc/2018/03-1.linq b/www/statics/aoc/2018/03-1.linq new file mode 100644 index 0000000..1b2360f --- /dev/null +++ b/www/statics/aoc/2018/03-1.linq @@ -0,0 +1,17 @@ + + +File + .ReadAllLines(Path.Combine(Path.GetDirectoryName(Util.CurrentQueryPath), @"03_input.txt")) + .Where(l => !string.IsNullOrWhiteSpace(l)) + .Select(l => new + { + ID = int.Parse(l.Substring(1).Split(' ')[0]), + X = int.Parse(l.Split('@')[1].Split(':')[0].Split(',')[0].Trim()), + Y = int.Parse(l.Split('@')[1].Split(':')[0].Split(',')[1].Trim()), + W = int.Parse(l.Split('@')[1].Split(':')[1].Split('x')[0].Trim()), + H = int.Parse(l.Split('@')[1].Split(':')[1].Split('x')[1].Trim()), + }) + .SelectMany(l => Enumerable.Range(0, l.W).SelectMany(wx => Enumerable.Range(0, l.H).Select(hy => new { Coord=(l.X+wx, l.Y+hy), Source=l }))) + .GroupBy(p => p.Coord) + .Where(p => p.Count() > 1) + .Count() \ No newline at end of file diff --git a/www/statics/aoc/2018/03-2.linq b/www/statics/aoc/2018/03-2.linq new file mode 100644 index 0000000..1aba5fd --- /dev/null +++ b/www/statics/aoc/2018/03-2.linq @@ -0,0 +1,22 @@ + + +File + .ReadAllLines(Path.Combine(Path.GetDirectoryName(Util.CurrentQueryPath), @"03_input.txt")) + .Where(l => !string.IsNullOrWhiteSpace(l)) + .Select(l => new + { + ID = int.Parse(l.Substring(1).Split(' ')[0]), + X = int.Parse(l.Split('@')[1].Split(':')[0].Split(',')[0].Trim()), + Y = int.Parse(l.Split('@')[1].Split(':')[0].Split(',')[1].Trim()), + W = int.Parse(l.Split('@')[1].Split(':')[1].Split('x')[0].Trim()), + H = int.Parse(l.Split('@')[1].Split(':')[1].Split('x')[1].Trim()), + }) + .SelectMany(l => Enumerable.Range(0, l.W).SelectMany(wx => Enumerable.Range(0, l.H).Select(hy => new { Coord = (l.X + wx, l.Y + hy), Source = l }))) + .GroupBy(p => p.Coord) + .SelectMany(p => p.Select(q => new { Source = q.Source, Count = p.Count() })) + .GroupBy(p => p.Source.ID) + .Select(p => new { Source = p.First().Source, CountSum = p.Sum(q => q.Count) }) + .Where(p => p.CountSum == p.Source.W * p.Source.H) + .Single() + .Source + .ID \ No newline at end of file diff --git a/www/statics/aoc/2018/03_challenge.txt b/www/statics/aoc/2018/03_challenge.txt new file mode 100644 index 0000000..232ffea --- /dev/null +++ b/www/statics/aoc/2018/03_challenge.txt @@ -0,0 +1,53 @@ +--- 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. + +Each Elf has made a claim about which area of fabric would be ideal for Santa's suit. All claims have an ID and consist of a single rectangle with edges parallel to the edges of the fabric. Each claim's rectangle is defined as follows: + + The number of inches between the left edge of the fabric and the left edge of the rectangle. + The number of inches between the top edge of the fabric and the top edge of the rectangle. + The width of the rectangle in inches. + The height of the rectangle in inches. + +A claim like #123 @ 3,2: 5x4 means that claim ID 123 specifies a rectangle 3 inches from the left edge, 2 inches from the top edge, 5 inches wide, and 4 inches tall. Visually, it claims the square inches of fabric represented by # (and ignores the square inches of fabric represented by .) in the diagram below: + +........... +........... +...#####... +...#####... +...#####... +...#####... +........... +........... +........... + +The problem is that many of the claims overlap, causing two or more claims to cover part of the same areas. For example, consider the following claims: + +#1 @ 1,3: 4x4 +#2 @ 3,1: 4x4 +#3 @ 5,5: 2x2 + +Visually, these claim the following areas: + +........ +...2222. +...2222. +.11XX22. +.11XX22. +.111133. +.111133. +........ + +The four square inches marked with X are claimed by both 1 and 2. (Claim 3, while adjacent to the others, does not overlap either of them.) + +If the Elves all proceed with their own plans, none of them will have enough fabric. How many square inches of fabric are within two or more claims? + +--- Part Two --- + +Amidst the chaos, you notice that exactly one claim doesn't overlap by even a single square inch of fabric with any other claim. If you can somehow draw attention to it, maybe the Elves will be able to make Santa's suit after all! + +For example, in the claims above, only claim 3 is intact after all claims are made. + +What is the ID of the only claim that doesn't overlap? diff --git a/www/statics/aoc/2018/03_input.txt b/www/statics/aoc/2018/03_input.txt new file mode 100644 index 0000000..787b7db --- /dev/null +++ b/www/statics/aoc/2018/03_input.txt @@ -0,0 +1,1367 @@ +#1 @ 817,273: 26x26 +#2 @ 974,796: 18x19 +#3 @ 207,456: 14x29 +#4 @ 835,854: 14x11 +#5 @ 223,729: 23x21 +#6 @ 217,76: 25x21 +#7 @ 625,569: 23x25 +#8 @ 434,946: 16x17 +#9 @ 906,507: 10x26 +#10 @ 364,640: 26x10 +#11 @ 915,771: 12x29 +#12 @ 736,919: 20x26 +#13 @ 653,413: 21x25 +#14 @ 946,337: 21x22 +#15 @ 700,156: 28x29 +#16 @ 729,42: 20x27 +#17 @ 41,163: 25x28 +#18 @ 628,464: 15x15 +#19 @ 425,90: 15x17 +#20 @ 308,403: 27x23 +#21 @ 133,929: 23x12 +#22 @ 510,93: 9x5 +#23 @ 703,306: 13x17 +#24 @ 86,922: 15x29 +#25 @ 585,981: 25x18 +#26 @ 476,94: 22x19 +#27 @ 485,2: 14x11 +#28 @ 433,777: 10x14 +#29 @ 878,771: 25x11 +#30 @ 367,909: 11x10 +#31 @ 863,261: 18x12 +#32 @ 640,352: 16x21 +#33 @ 786,382: 29x25 +#34 @ 748,464: 10x19 +#35 @ 278,771: 20x6 +#36 @ 89,443: 19x12 +#37 @ 150,645: 23x19 +#38 @ 902,453: 20x10 +#39 @ 446,938: 11x29 +#40 @ 48,897: 11x20 +#41 @ 701,328: 21x21 +#42 @ 793,232: 27x28 +#43 @ 335,184: 29x15 +#44 @ 156,495: 27x16 +#45 @ 296,339: 11x25 +#46 @ 241,763: 11x19 +#47 @ 711,884: 11x21 +#48 @ 449,88: 11x14 +#49 @ 358,107: 27x27 +#50 @ 234,758: 15x25 +#51 @ 764,852: 13x12 +#52 @ 143,119: 21x15 +#53 @ 469,50: 14x28 +#54 @ 791,500: 12x21 +#55 @ 483,122: 18x26 +#56 @ 915,190: 21x27 +#57 @ 117,177: 21x22 +#58 @ 424,162: 22x25 +#59 @ 60,934: 28x20 +#60 @ 868,24: 21x21 +#61 @ 908,418: 19x26 +#62 @ 182,833: 20x13 +#63 @ 322,285: 24x15 +#64 @ 860,273: 24x20 +#65 @ 362,331: 11x13 +#66 @ 139,211: 15x25 +#67 @ 134,482: 22x18 +#68 @ 480,234: 13x23 +#69 @ 588,353: 10x27 +#70 @ 123,586: 27x27 +#71 @ 293,495: 15x13 +#72 @ 335,97: 26x16 +#73 @ 421,876: 20x21 +#74 @ 417,164: 20x26 +#75 @ 493,314: 18x25 +#76 @ 620,217: 25x20 +#77 @ 133,72: 19x14 +#78 @ 923,916: 20x17 +#79 @ 849,93: 19x29 +#80 @ 251,486: 24x18 +#81 @ 512,682: 18x16 +#82 @ 74,785: 10x10 +#83 @ 323,525: 16x10 +#84 @ 424,958: 22x17 +#85 @ 171,158: 10x28 +#86 @ 210,278: 14x21 +#87 @ 136,875: 22x25 +#88 @ 436,230: 25x14 +#89 @ 604,625: 22x20 +#90 @ 428,897: 17x11 +#91 @ 667,359: 16x26 +#92 @ 553,726: 13x18 +#93 @ 134,335: 18x19 +#94 @ 675,832: 27x28 +#95 @ 705,775: 22x19 +#96 @ 918,415: 24x16 +#97 @ 487,750: 28x18 +#98 @ 95,773: 16x27 +#99 @ 110,495: 21x17 +#100 @ 750,438: 18x27 +#101 @ 471,211: 11x28 +#102 @ 751,327: 14x19 +#103 @ 928,964: 21x17 +#104 @ 959,306: 18x28 +#105 @ 707,257: 28x20 +#106 @ 167,341: 23x14 +#107 @ 431,553: 18x12 +#108 @ 602,933: 7x5 +#109 @ 13,313: 12x21 +#110 @ 806,343: 15x12 +#111 @ 477,818: 28x17 +#112 @ 793,342: 16x17 +#113 @ 141,718: 24x28 +#114 @ 786,957: 22x28 +#115 @ 286,854: 24x19 +#116 @ 635,232: 13x21 +#117 @ 918,776: 18x20 +#118 @ 634,116: 19x26 +#119 @ 305,975: 13x18 +#120 @ 906,381: 16x21 +#121 @ 339,582: 15x15 +#122 @ 760,510: 22x14 +#123 @ 468,308: 16x26 +#124 @ 178,900: 12x13 +#125 @ 650,436: 29x16 +#126 @ 663,443: 29x15 +#127 @ 629,545: 15x26 +#128 @ 539,835: 12x26 +#129 @ 516,442: 11x29 +#130 @ 847,243: 27x24 +#131 @ 83,18: 26x18 +#132 @ 378,79: 29x18 +#133 @ 374,47: 19x28 +#134 @ 97,400: 22x19 +#135 @ 358,353: 12x16 +#136 @ 284,595: 16x25 +#137 @ 599,556: 10x21 +#138 @ 701,925: 24x29 +#139 @ 954,539: 25x18 +#140 @ 509,636: 25x14 +#141 @ 414,21: 26x19 +#142 @ 682,730: 23x26 +#143 @ 113,833: 10x24 +#144 @ 392,71: 23x15 +#145 @ 692,67: 26x24 +#146 @ 182,896: 20x23 +#147 @ 976,800: 5x4 +#148 @ 584,347: 15x26 +#149 @ 79,781: 23x19 +#150 @ 554,264: 24x17 +#151 @ 874,372: 18x14 +#152 @ 299,117: 12x19 +#153 @ 101,470: 16x18 +#154 @ 55,396: 13x10 +#155 @ 220,837: 28x14 +#156 @ 810,813: 15x17 +#157 @ 520,727: 17x27 +#158 @ 165,516: 27x24 +#159 @ 852,500: 11x12 +#160 @ 148,465: 29x16 +#161 @ 416,132: 11x24 +#162 @ 973,491: 26x22 +#163 @ 32,36: 10x17 +#164 @ 80,829: 22x27 +#165 @ 533,439: 18x24 +#166 @ 954,154: 12x24 +#167 @ 18,597: 29x25 +#168 @ 735,718: 10x13 +#169 @ 39,163: 13x11 +#170 @ 418,636: 13x21 +#171 @ 22,220: 17x25 +#172 @ 122,123: 24x12 +#173 @ 745,477: 17x20 +#174 @ 96,812: 23x18 +#175 @ 972,536: 19x27 +#176 @ 895,442: 29x20 +#177 @ 247,1: 26x24 +#178 @ 618,548: 13x12 +#179 @ 936,296: 14x28 +#180 @ 327,440: 10x24 +#181 @ 462,127: 17x28 +#182 @ 539,259: 21x23 +#183 @ 597,915: 22x22 +#184 @ 854,361: 29x23 +#185 @ 483,559: 21x12 +#186 @ 504,301: 23x25 +#187 @ 308,212: 25x15 +#188 @ 136,438: 14x16 +#189 @ 81,444: 21x15 +#190 @ 297,670: 13x23 +#191 @ 918,682: 29x16 +#192 @ 872,36: 10x11 +#193 @ 521,252: 27x12 +#194 @ 131,499: 29x25 +#195 @ 427,255: 25x11 +#196 @ 724,836: 10x14 +#197 @ 489,685: 13x22 +#198 @ 18,942: 20x10 +#199 @ 350,252: 19x22 +#200 @ 903,567: 23x16 +#201 @ 489,11: 14x26 +#202 @ 454,303: 24x14 +#203 @ 412,123: 12x18 +#204 @ 261,440: 15x13 +#205 @ 831,635: 27x27 +#206 @ 122,755: 14x29 +#207 @ 233,731: 19x15 +#208 @ 632,259: 17x19 +#209 @ 749,396: 23x26 +#210 @ 513,491: 19x15 +#211 @ 560,611: 16x6 +#212 @ 605,76: 28x15 +#213 @ 481,719: 26x23 +#214 @ 344,877: 18x17 +#215 @ 969,931: 19x17 +#216 @ 283,687: 23x12 +#217 @ 354,223: 28x27 +#218 @ 415,264: 28x14 +#219 @ 651,795: 10x10 +#220 @ 8,730: 21x10 +#221 @ 661,835: 29x15 +#222 @ 889,455: 16x20 +#223 @ 988,13: 11x10 +#224 @ 243,984: 19x15 +#225 @ 41,195: 25x28 +#226 @ 631,109: 13x25 +#227 @ 242,826: 26x24 +#228 @ 36,801: 14x16 +#229 @ 713,900: 22x25 +#230 @ 295,869: 23x10 +#231 @ 613,330: 25x13 +#232 @ 133,749: 11x28 +#233 @ 710,329: 18x27 +#234 @ 380,239: 10x29 +#235 @ 480,396: 17x27 +#236 @ 629,106: 27x27 +#237 @ 420,87: 27x10 +#238 @ 581,463: 3x16 +#239 @ 486,718: 12x17 +#240 @ 557,266: 9x9 +#241 @ 226,805: 17x15 +#242 @ 615,951: 20x19 +#243 @ 888,17: 17x26 +#244 @ 565,134: 23x20 +#245 @ 410,387: 12x29 +#246 @ 692,857: 14x13 +#247 @ 173,287: 25x10 +#248 @ 258,859: 29x11 +#249 @ 565,565: 26x15 +#250 @ 106,822: 27x23 +#251 @ 970,909: 17x17 +#252 @ 294,490: 25x11 +#253 @ 682,280: 21x20 +#254 @ 292,889: 28x22 +#255 @ 299,398: 4x5 +#256 @ 521,250: 10x20 +#257 @ 559,34: 28x13 +#258 @ 72,3: 24x14 +#259 @ 918,593: 11x27 +#260 @ 84,779: 17x11 +#261 @ 646,372: 26x23 +#262 @ 250,889: 27x14 +#263 @ 296,354: 26x22 +#264 @ 774,788: 11x20 +#265 @ 477,401: 27x26 +#266 @ 838,617: 11x28 +#267 @ 758,322: 12x11 +#268 @ 41,457: 24x11 +#269 @ 509,443: 12x14 +#270 @ 557,281: 16x26 +#271 @ 915,539: 13x18 +#272 @ 545,509: 28x17 +#273 @ 297,315: 23x24 +#274 @ 674,48: 28x17 +#275 @ 553,171: 15x16 +#276 @ 614,919: 25x16 +#277 @ 901,186: 21x22 +#278 @ 337,447: 21x17 +#279 @ 891,597: 24x24 +#280 @ 901,240: 15x17 +#281 @ 575,721: 21x20 +#282 @ 246,426: 25x13 +#283 @ 792,21: 13x24 +#284 @ 618,204: 15x23 +#285 @ 457,543: 24x27 +#286 @ 782,340: 21x27 +#287 @ 700,8: 25x25 +#288 @ 972,562: 13x12 +#289 @ 79,951: 14x15 +#290 @ 216,938: 20x11 +#291 @ 488,393: 27x18 +#292 @ 649,610: 25x24 +#293 @ 895,240: 27x12 +#294 @ 94,150: 21x12 +#295 @ 663,143: 11x24 +#296 @ 234,685: 25x17 +#297 @ 540,533: 17x24 +#298 @ 684,646: 15x16 +#299 @ 317,268: 28x18 +#300 @ 31,889: 18x24 +#301 @ 670,92: 23x28 +#302 @ 701,14: 20x11 +#303 @ 82,325: 14x15 +#304 @ 558,871: 18x27 +#305 @ 791,390: 27x29 +#306 @ 442,958: 16x15 +#307 @ 144,425: 18x28 +#308 @ 511,742: 18x20 +#309 @ 435,289: 23x18 +#310 @ 627,15: 15x23 +#311 @ 468,441: 16x21 +#312 @ 611,466: 28x22 +#313 @ 196,563: 16x11 +#314 @ 217,736: 26x12 +#315 @ 554,69: 19x28 +#316 @ 217,845: 10x25 +#317 @ 636,63: 12x16 +#318 @ 205,922: 19x28 +#319 @ 0,159: 12x20 +#320 @ 922,779: 5x13 +#321 @ 712,835: 22x18 +#322 @ 471,567: 18x11 +#323 @ 329,537: 16x11 +#324 @ 181,840: 19x18 +#325 @ 410,947: 16x25 +#326 @ 850,501: 23x18 +#327 @ 378,659: 13x11 +#328 @ 887,556: 16x25 +#329 @ 2,141: 22x26 +#330 @ 46,799: 24x28 +#331 @ 839,95: 20x21 +#332 @ 281,593: 21x19 +#333 @ 858,44: 13x19 +#334 @ 596,624: 10x29 +#335 @ 862,220: 16x15 +#336 @ 41,832: 21x13 +#337 @ 401,474: 29x19 +#338 @ 610,555: 28x25 +#339 @ 910,347: 24x24 +#340 @ 550,292: 19x17 +#341 @ 134,668: 20x13 +#342 @ 165,18: 14x15 +#343 @ 822,699: 27x15 +#344 @ 524,838: 26x23 +#345 @ 807,727: 22x13 +#346 @ 310,631: 20x23 +#347 @ 313,630: 25x16 +#348 @ 904,421: 17x21 +#349 @ 369,85: 13x10 +#350 @ 463,906: 18x16 +#351 @ 146,42: 17x27 +#352 @ 694,600: 16x18 +#353 @ 150,613: 26x29 +#354 @ 738,722: 26x15 +#355 @ 699,190: 13x27 +#356 @ 449,541: 26x12 +#357 @ 273,768: 29x22 +#358 @ 911,352: 29x13 +#359 @ 554,791: 12x25 +#360 @ 705,656: 15x23 +#361 @ 703,353: 10x20 +#362 @ 64,397: 14x10 +#363 @ 580,353: 29x11 +#364 @ 198,472: 15x11 +#365 @ 349,797: 12x16 +#366 @ 76,857: 18x17 +#367 @ 655,717: 24x14 +#368 @ 560,709: 16x21 +#369 @ 153,511: 22x27 +#370 @ 693,867: 12x21 +#371 @ 893,40: 12x22 +#372 @ 482,676: 21x14 +#373 @ 433,571: 20x20 +#374 @ 746,439: 13x21 +#375 @ 717,255: 24x21 +#376 @ 610,612: 26x26 +#377 @ 122,482: 18x17 +#378 @ 572,623: 13x23 +#379 @ 416,868: 27x29 +#380 @ 206,849: 16x19 +#381 @ 945,192: 20x12 +#382 @ 868,228: 23x22 +#383 @ 2,727: 25x18 +#384 @ 171,654: 26x26 +#385 @ 227,718: 14x14 +#386 @ 126,755: 25x21 +#387 @ 696,638: 20x18 +#388 @ 902,449: 26x12 +#389 @ 317,989: 21x11 +#390 @ 614,575: 19x29 +#391 @ 728,733: 27x18 +#392 @ 859,240: 19x23 +#393 @ 24,489: 27x25 +#394 @ 292,567: 26x18 +#395 @ 102,170: 17x12 +#396 @ 114,336: 11x10 +#397 @ 113,99: 12x11 +#398 @ 469,253: 22x11 +#399 @ 555,858: 26x21 +#400 @ 185,60: 28x29 +#401 @ 488,484: 20x20 +#402 @ 1,344: 25x20 +#403 @ 898,240: 26x18 +#404 @ 657,97: 24x21 +#405 @ 121,68: 21x24 +#406 @ 520,13: 19x10 +#407 @ 444,59: 18x17 +#408 @ 944,690: 28x22 +#409 @ 341,874: 23x27 +#410 @ 38,945: 13x24 +#411 @ 35,813: 23x21 +#412 @ 877,265: 14x10 +#413 @ 89,172: 11x18 +#414 @ 635,663: 23x28 +#415 @ 668,365: 28x19 +#416 @ 352,198: 20x17 +#417 @ 617,221: 10x22 +#418 @ 558,600: 23x24 +#419 @ 699,780: 20x25 +#420 @ 766,225: 28x29 +#421 @ 94,185: 21x10 +#422 @ 440,773: 5x12 +#423 @ 529,642: 15x17 +#424 @ 736,703: 23x19 +#425 @ 232,519: 10x25 +#426 @ 912,756: 18x16 +#427 @ 378,66: 13x28 +#428 @ 234,801: 25x26 +#429 @ 417,48: 12x14 +#430 @ 410,881: 21x23 +#431 @ 969,901: 13x17 +#432 @ 514,717: 13x27 +#433 @ 467,622: 17x21 +#434 @ 814,428: 21x18 +#435 @ 899,575: 29x12 +#436 @ 127,582: 17x17 +#437 @ 323,624: 19x17 +#438 @ 165,200: 23x19 +#439 @ 457,203: 21x21 +#440 @ 419,479: 10x25 +#441 @ 762,475: 22x10 +#442 @ 101,486: 22x14 +#443 @ 959,655: 19x23 +#444 @ 958,299: 22x21 +#445 @ 487,353: 27x19 +#446 @ 600,455: 14x25 +#447 @ 495,154: 13x17 +#448 @ 944,573: 24x27 +#449 @ 244,602: 14x22 +#450 @ 36,227: 10x21 +#451 @ 241,849: 18x29 +#452 @ 841,470: 11x19 +#453 @ 51,901: 13x13 +#454 @ 21,941: 17x18 +#455 @ 769,298: 18x18 +#456 @ 675,626: 23x26 +#457 @ 495,564: 16x16 +#458 @ 171,18: 15x28 +#459 @ 776,360: 10x28 +#460 @ 54,952: 10x29 +#461 @ 364,940: 13x23 +#462 @ 103,159: 25x25 +#463 @ 330,617: 15x15 +#464 @ 247,801: 22x16 +#465 @ 654,847: 20x18 +#466 @ 419,407: 23x24 +#467 @ 400,863: 13x27 +#468 @ 370,88: 14x22 +#469 @ 639,751: 18x18 +#470 @ 85,402: 17x15 +#471 @ 214,60: 10x26 +#472 @ 185,343: 24x14 +#473 @ 500,746: 16x14 +#474 @ 101,327: 24x23 +#475 @ 497,103: 22x11 +#476 @ 101,213: 26x11 +#477 @ 80,813: 21x22 +#478 @ 362,630: 12x29 +#479 @ 407,934: 11x25 +#480 @ 628,550: 12x15 +#481 @ 316,594: 10x20 +#482 @ 51,177: 12x27 +#483 @ 378,865: 14x22 +#484 @ 17,203: 27x17 +#485 @ 612,145: 23x21 +#486 @ 115,77: 13x16 +#487 @ 465,120: 12x12 +#488 @ 818,115: 29x16 +#489 @ 619,67: 21x10 +#490 @ 923,405: 12x29 +#491 @ 79,846: 13x10 +#492 @ 191,78: 17x25 +#493 @ 336,293: 19x25 +#494 @ 310,938: 12x15 +#495 @ 956,552: 22x25 +#496 @ 664,845: 22x17 +#497 @ 779,681: 11x20 +#498 @ 580,924: 25x28 +#499 @ 13,380: 17x22 +#500 @ 888,579: 23x12 +#501 @ 35,551: 18x20 +#502 @ 256,430: 10x20 +#503 @ 818,30: 14x29 +#504 @ 101,592: 29x12 +#505 @ 234,791: 26x20 +#506 @ 220,688: 13x25 +#507 @ 761,808: 20x19 +#508 @ 661,561: 21x23 +#509 @ 813,803: 16x16 +#510 @ 354,300: 11x16 +#511 @ 829,663: 13x14 +#512 @ 949,659: 16x10 +#513 @ 112,840: 28x13 +#514 @ 259,418: 16x29 +#515 @ 451,564: 17x24 +#516 @ 905,96: 18x25 +#517 @ 697,300: 14x23 +#518 @ 231,870: 28x23 +#519 @ 959,619: 28x21 +#520 @ 177,535: 17x25 +#521 @ 215,889: 17x12 +#522 @ 809,192: 15x24 +#523 @ 487,269: 28x19 +#524 @ 890,227: 19x12 +#525 @ 50,484: 19x13 +#526 @ 866,216: 23x24 +#527 @ 522,563: 13x20 +#528 @ 570,506: 23x15 +#529 @ 247,101: 25x17 +#530 @ 691,249: 28x15 +#531 @ 297,396: 10x12 +#532 @ 315,647: 14x16 +#533 @ 681,499: 28x16 +#534 @ 898,560: 22x22 +#535 @ 465,658: 27x27 +#536 @ 623,775: 15x24 +#537 @ 908,542: 16x13 +#538 @ 189,676: 11x11 +#539 @ 540,36: 21x10 +#540 @ 775,18: 28x12 +#541 @ 339,337: 29x10 +#542 @ 620,132: 26x25 +#543 @ 214,55: 22x29 +#544 @ 957,222: 10x17 +#545 @ 892,907: 29x13 +#546 @ 144,533: 12x23 +#547 @ 508,731: 22x10 +#548 @ 753,43: 19x14 +#549 @ 341,698: 27x14 +#550 @ 913,932: 27x23 +#551 @ 283,580: 25x28 +#552 @ 651,223: 19x10 +#553 @ 19,334: 11x17 +#554 @ 238,927: 15x25 +#555 @ 807,858: 25x13 +#556 @ 831,261: 19x29 +#557 @ 933,206: 25x29 +#558 @ 717,291: 16x13 +#559 @ 647,557: 27x17 +#560 @ 799,328: 26x25 +#561 @ 171,830: 24x12 +#562 @ 453,368: 10x27 +#563 @ 308,322: 28x28 +#564 @ 482,111: 11x20 +#565 @ 493,465: 18x25 +#566 @ 579,964: 23x17 +#567 @ 344,433: 24x22 +#568 @ 441,377: 24x16 +#569 @ 50,372: 13x15 +#570 @ 818,90: 26x13 +#571 @ 819,887: 26x15 +#572 @ 715,967: 29x19 +#573 @ 844,895: 18x10 +#574 @ 229,671: 25x21 +#575 @ 75,512: 20x20 +#576 @ 60,361: 25x25 +#577 @ 772,304: 27x14 +#578 @ 627,538: 14x11 +#579 @ 149,66: 27x28 +#580 @ 164,786: 14x27 +#581 @ 867,712: 16x17 +#582 @ 578,791: 21x11 +#583 @ 677,635: 28x24 +#584 @ 618,580: 21x19 +#585 @ 857,191: 24x26 +#586 @ 36,882: 20x21 +#587 @ 486,560: 18x29 +#588 @ 851,425: 16x28 +#589 @ 558,855: 23x23 +#590 @ 890,583: 14x28 +#591 @ 149,198: 23x10 +#592 @ 748,715: 26x26 +#593 @ 974,241: 21x22 +#594 @ 912,196: 25x21 +#595 @ 623,766: 21x28 +#596 @ 12,358: 10x28 +#597 @ 876,616: 20x26 +#598 @ 7,28: 12x24 +#599 @ 525,859: 27x13 +#600 @ 931,188: 12x28 +#601 @ 763,385: 20x29 +#602 @ 300,653: 18x18 +#603 @ 510,670: 23x15 +#604 @ 520,496: 11x21 +#605 @ 204,890: 16x11 +#606 @ 524,431: 24x18 +#607 @ 811,98: 21x20 +#608 @ 786,859: 24x13 +#609 @ 305,20: 11x12 +#610 @ 741,954: 13x18 +#611 @ 313,260: 17x13 +#612 @ 315,602: 27x20 +#613 @ 194,939: 29x27 +#614 @ 871,418: 12x18 +#615 @ 164,317: 13x15 +#616 @ 124,748: 22x20 +#617 @ 83,173: 14x20 +#618 @ 345,836: 20x11 +#619 @ 799,547: 12x10 +#620 @ 85,176: 18x12 +#621 @ 894,171: 27x22 +#622 @ 397,673: 25x11 +#623 @ 891,846: 12x28 +#624 @ 191,120: 20x23 +#625 @ 955,305: 24x25 +#626 @ 702,616: 10x17 +#627 @ 902,671: 16x24 +#628 @ 282,887: 10x20 +#629 @ 796,765: 15x12 +#630 @ 50,828: 26x24 +#631 @ 523,914: 25x22 +#632 @ 791,608: 21x11 +#633 @ 266,902: 25x11 +#634 @ 179,496: 10x13 +#635 @ 99,786: 15x18 +#636 @ 363,954: 23x15 +#637 @ 879,468: 19x20 +#638 @ 441,910: 18x28 +#639 @ 406,436: 23x23 +#640 @ 102,486: 20x23 +#641 @ 603,956: 29x16 +#642 @ 477,276: 26x26 +#643 @ 681,785: 24x14 +#644 @ 660,80: 16x29 +#645 @ 550,196: 29x29 +#646 @ 824,268: 23x18 +#647 @ 483,139: 19x21 +#648 @ 575,454: 27x29 +#649 @ 915,601: 24x10 +#650 @ 654,198: 26x16 +#651 @ 490,556: 25x22 +#652 @ 409,93: 23x23 +#653 @ 683,603: 22x11 +#654 @ 869,357: 12x19 +#655 @ 424,469: 19x23 +#656 @ 285,869: 12x21 +#657 @ 751,330: 27x16 +#658 @ 62,279: 15x28 +#659 @ 899,659: 10x22 +#660 @ 423,777: 29x13 +#661 @ 341,330: 14x23 +#662 @ 863,448: 16x20 +#663 @ 469,155: 26x27 +#664 @ 376,183: 20x19 +#665 @ 819,818: 10x13 +#666 @ 207,719: 26x24 +#667 @ 76,774: 10x15 +#668 @ 224,738: 16x15 +#669 @ 138,521: 11x22 +#670 @ 111,716: 19x28 +#671 @ 229,727: 25x11 +#672 @ 616,792: 20x28 +#673 @ 316,429: 13x17 +#674 @ 887,494: 24x21 +#675 @ 926,354: 28x11 +#676 @ 502,449: 29x21 +#677 @ 420,943: 24x28 +#678 @ 842,573: 14x25 +#679 @ 516,36: 10x21 +#680 @ 307,626: 20x18 +#681 @ 103,963: 24x29 +#682 @ 498,447: 27x10 +#683 @ 42,414: 10x24 +#684 @ 145,353: 24x24 +#685 @ 631,183: 23x22 +#686 @ 634,9: 18x27 +#687 @ 108,269: 19x11 +#688 @ 656,785: 17x19 +#689 @ 280,922: 21x14 +#690 @ 34,541: 18x29 +#691 @ 38,118: 25x28 +#692 @ 679,269: 12x23 +#693 @ 517,356: 5x7 +#694 @ 595,143: 22x23 +#695 @ 239,781: 29x15 +#696 @ 353,868: 11x12 +#697 @ 824,452: 24x19 +#698 @ 641,407: 19x23 +#699 @ 49,354: 26x20 +#700 @ 933,919: 28x16 +#701 @ 98,856: 22x14 +#702 @ 602,254: 29x12 +#703 @ 594,930: 23x21 +#704 @ 569,641: 24x19 +#705 @ 36,468: 28x29 +#706 @ 172,834: 17x22 +#707 @ 959,637: 11x22 +#708 @ 878,209: 29x29 +#709 @ 85,409: 25x11 +#710 @ 386,964: 19x15 +#711 @ 767,201: 17x13 +#712 @ 326,851: 18x27 +#713 @ 485,715: 14x17 +#714 @ 179,15: 21x13 +#715 @ 979,911: 10x20 +#716 @ 419,904: 20x24 +#717 @ 663,490: 28x24 +#718 @ 965,421: 12x14 +#719 @ 888,949: 23x29 +#720 @ 74,844: 14x11 +#721 @ 608,905: 21x18 +#722 @ 66,46: 28x12 +#723 @ 628,720: 22x25 +#724 @ 307,470: 15x23 +#725 @ 179,642: 25x26 +#726 @ 696,441: 24x19 +#727 @ 852,48: 13x14 +#728 @ 730,809: 24x17 +#729 @ 775,899: 7x8 +#730 @ 628,58: 12x12 +#731 @ 820,860: 29x23 +#732 @ 116,863: 21x18 +#733 @ 59,658: 27x12 +#734 @ 949,476: 27x23 +#735 @ 92,81: 19x24 +#736 @ 524,728: 10x18 +#737 @ 102,827: 23x25 +#738 @ 105,127: 24x17 +#739 @ 617,745: 25x26 +#740 @ 897,802: 27x22 +#741 @ 692,144: 22x16 +#742 @ 579,198: 29x12 +#743 @ 863,692: 19x25 +#744 @ 819,816: 15x10 +#745 @ 872,872: 13x22 +#746 @ 880,818: 22x10 +#747 @ 623,38: 19x29 +#748 @ 453,69: 26x20 +#749 @ 223,277: 11x26 +#750 @ 378,99: 20x25 +#751 @ 439,790: 25x21 +#752 @ 357,895: 17x22 +#753 @ 672,154: 17x20 +#754 @ 710,149: 29x10 +#755 @ 903,447: 16x11 +#756 @ 595,329: 27x19 +#757 @ 252,951: 10x17 +#758 @ 923,180: 24x23 +#759 @ 967,288: 16x29 +#760 @ 418,469: 19x14 +#761 @ 470,149: 12x19 +#762 @ 89,498: 29x19 +#763 @ 387,404: 21x26 +#764 @ 263,923: 11x26 +#765 @ 840,253: 23x18 +#766 @ 622,761: 10x11 +#767 @ 930,761: 21x24 +#768 @ 286,557: 14x25 +#769 @ 74,3: 19x12 +#770 @ 754,10: 13x10 +#771 @ 842,412: 27x27 +#772 @ 416,678: 26x29 +#773 @ 75,843: 27x28 +#774 @ 107,773: 12x21 +#775 @ 622,789: 14x24 +#776 @ 551,170: 19x27 +#777 @ 44,885: 12x11 +#778 @ 774,943: 29x18 +#779 @ 827,44: 26x20 +#780 @ 464,417: 26x17 +#781 @ 674,266: 21x14 +#782 @ 452,774: 15x14 +#783 @ 148,360: 15x20 +#784 @ 680,250: 19x18 +#785 @ 702,729: 25x24 +#786 @ 20,44: 24x27 +#787 @ 498,494: 27x20 +#788 @ 242,913: 29x17 +#789 @ 252,912: 28x10 +#790 @ 670,728: 17x28 +#791 @ 754,518: 24x21 +#792 @ 665,379: 13x15 +#793 @ 65,535: 22x17 +#794 @ 127,304: 26x15 +#795 @ 355,182: 24x13 +#796 @ 501,337: 15x16 +#797 @ 323,223: 12x23 +#798 @ 195,667: 15x18 +#799 @ 829,850: 22x22 +#800 @ 165,889: 28x12 +#801 @ 57,460: 15x22 +#802 @ 65,668: 28x28 +#803 @ 322,676: 16x26 +#804 @ 462,562: 19x14 +#805 @ 420,759: 14x22 +#806 @ 202,550: 20x22 +#807 @ 379,43: 22x29 +#808 @ 519,817: 10x25 +#809 @ 4,714: 16x18 +#810 @ 176,674: 24x15 +#811 @ 745,55: 27x21 +#812 @ 690,197: 20x10 +#813 @ 21,957: 14x24 +#814 @ 698,302: 25x20 +#815 @ 668,826: 11x18 +#816 @ 953,176: 11x12 +#817 @ 226,663: 17x13 +#818 @ 321,461: 10x11 +#819 @ 794,101: 14x27 +#820 @ 230,892: 23x29 +#821 @ 790,586: 10x26 +#822 @ 590,952: 14x20 +#823 @ 628,538: 26x23 +#824 @ 515,492: 13x17 +#825 @ 62,950: 25x16 +#826 @ 754,53: 22x17 +#827 @ 361,332: 19x12 +#828 @ 889,512: 20x28 +#829 @ 954,589: 29x29 +#830 @ 369,358: 16x25 +#831 @ 353,793: 14x19 +#832 @ 623,69: 28x10 +#833 @ 656,49: 22x23 +#834 @ 101,822: 10x28 +#835 @ 183,202: 18x23 +#836 @ 346,329: 16x15 +#837 @ 188,793: 26x21 +#838 @ 568,126: 16x12 +#839 @ 899,361: 12x29 +#840 @ 667,853: 29x14 +#841 @ 438,558: 25x25 +#842 @ 185,120: 12x15 +#843 @ 153,62: 15x10 +#844 @ 46,586: 21x17 +#845 @ 263,874: 26x29 +#846 @ 728,5: 26x20 +#847 @ 367,760: 12x27 +#848 @ 449,411: 17x20 +#849 @ 403,474: 25x13 +#850 @ 72,534: 23x15 +#851 @ 930,500: 23x24 +#852 @ 103,260: 23x19 +#853 @ 304,651: 24x21 +#854 @ 94,975: 14x16 +#855 @ 566,787: 29x26 +#856 @ 656,152: 16x16 +#857 @ 910,390: 4x8 +#858 @ 858,742: 26x25 +#859 @ 473,830: 16x26 +#860 @ 261,316: 22x14 +#861 @ 907,700: 20x10 +#862 @ 700,101: 18x13 +#863 @ 0,304: 21x26 +#864 @ 748,777: 27x28 +#865 @ 433,745: 23x26 +#866 @ 646,555: 25x24 +#867 @ 147,674: 25x10 +#868 @ 341,308: 24x26 +#869 @ 77,323: 26x16 +#870 @ 309,949: 27x28 +#871 @ 668,554: 24x19 +#872 @ 595,260: 12x10 +#873 @ 815,559: 28x26 +#874 @ 721,1: 12x26 +#875 @ 975,353: 16x16 +#876 @ 265,276: 16x29 +#877 @ 900,823: 17x24 +#878 @ 414,646: 15x18 +#879 @ 797,149: 27x17 +#880 @ 31,149: 11x25 +#881 @ 162,696: 11x24 +#882 @ 915,255: 18x17 +#883 @ 696,504: 15x12 +#884 @ 141,580: 28x18 +#885 @ 919,664: 19x15 +#886 @ 689,740: 12x29 +#887 @ 566,72: 21x14 +#888 @ 617,23: 24x16 +#889 @ 290,933: 28x27 +#890 @ 500,705: 27x17 +#891 @ 788,308: 24x21 +#892 @ 973,5: 21x18 +#893 @ 618,187: 25x26 +#894 @ 962,398: 17x25 +#895 @ 870,768: 15x10 +#896 @ 305,302: 23x26 +#897 @ 267,313: 15x11 +#898 @ 255,832: 28x13 +#899 @ 288,542: 13x29 +#900 @ 935,913: 18x23 +#901 @ 334,27: 24x17 +#902 @ 920,265: 28x19 +#903 @ 456,442: 14x28 +#904 @ 0,340: 28x23 +#905 @ 597,629: 17x11 +#906 @ 51,157: 16x21 +#907 @ 919,682: 27x19 +#908 @ 284,532: 14x10 +#909 @ 536,861: 23x14 +#910 @ 906,408: 20x20 +#911 @ 27,114: 25x19 +#912 @ 501,744: 16x23 +#913 @ 926,632: 24x20 +#914 @ 344,256: 22x15 +#915 @ 877,887: 19x13 +#916 @ 46,695: 12x22 +#917 @ 501,308: 18x10 +#918 @ 527,736: 20x10 +#919 @ 328,336: 29x29 +#920 @ 446,243: 15x25 +#921 @ 379,474: 28x10 +#922 @ 149,687: 20x17 +#923 @ 138,865: 28x27 +#924 @ 538,258: 18x19 +#925 @ 441,211: 22x14 +#926 @ 18,358: 17x21 +#927 @ 22,369: 12x21 +#928 @ 667,507: 10x17 +#929 @ 176,833: 23x20 +#930 @ 972,611: 15x23 +#931 @ 54,173: 12x15 +#932 @ 327,30: 15x10 +#933 @ 395,436: 24x12 +#934 @ 513,923: 19x24 +#935 @ 470,495: 29x26 +#936 @ 464,62: 12x17 +#937 @ 537,638: 25x27 +#938 @ 515,4: 22x13 +#939 @ 644,600: 28x23 +#940 @ 350,603: 21x10 +#941 @ 298,361: 12x21 +#942 @ 826,648: 25x26 +#943 @ 918,432: 29x25 +#944 @ 349,612: 18x13 +#945 @ 751,522: 16x14 +#946 @ 506,39: 25x21 +#947 @ 330,566: 21x29 +#948 @ 617,4: 14x23 +#949 @ 831,676: 26x25 +#950 @ 526,286: 12x19 +#951 @ 495,419: 14x16 +#952 @ 116,323: 13x26 +#953 @ 535,857: 14x28 +#954 @ 171,641: 14x21 +#955 @ 182,527: 10x11 +#956 @ 890,52: 22x14 +#957 @ 643,735: 17x18 +#958 @ 508,307: 12x23 +#959 @ 217,842: 17x11 +#960 @ 170,843: 12x26 +#961 @ 128,309: 21x26 +#962 @ 722,8: 11x10 +#963 @ 95,191: 24x28 +#964 @ 129,584: 6x12 +#965 @ 125,778: 23x29 +#966 @ 346,101: 28x11 +#967 @ 433,766: 25x24 +#968 @ 280,209: 27x20 +#969 @ 969,376: 23x24 +#970 @ 844,591: 14x28 +#971 @ 801,549: 7x5 +#972 @ 416,73: 21x26 +#973 @ 410,675: 18x17 +#974 @ 968,914: 14x24 +#975 @ 792,165: 17x12 +#976 @ 144,783: 12x15 +#977 @ 814,198: 18x12 +#978 @ 369,756: 15x24 +#979 @ 844,635: 15x26 +#980 @ 927,657: 4x5 +#981 @ 981,130: 11x16 +#982 @ 848,286: 15x20 +#983 @ 468,699: 21x21 +#984 @ 876,491: 24x10 +#985 @ 946,426: 25x27 +#986 @ 376,580: 16x19 +#987 @ 347,793: 18x29 +#988 @ 665,299: 29x14 +#989 @ 635,127: 15x14 +#990 @ 511,915: 25x19 +#991 @ 710,730: 27x25 +#992 @ 143,3: 22x16 +#993 @ 488,362: 25x23 +#994 @ 962,353: 14x25 +#995 @ 430,897: 24x20 +#996 @ 694,783: 13x10 +#997 @ 828,273: 14x22 +#998 @ 500,269: 21x22 +#999 @ 839,907: 21x23 +#1000 @ 767,14: 18x20 +#1001 @ 902,865: 16x27 +#1002 @ 143,967: 25x11 +#1003 @ 117,787: 26x28 +#1004 @ 874,27: 21x24 +#1005 @ 197,293: 26x13 +#1006 @ 359,581: 23x10 +#1007 @ 210,345: 19x28 +#1008 @ 771,817: 18x27 +#1009 @ 553,198: 28x26 +#1010 @ 928,750: 27x18 +#1011 @ 702,19: 15x17 +#1012 @ 620,940: 21x23 +#1013 @ 505,76: 18x26 +#1014 @ 563,948: 21x23 +#1015 @ 109,722: 28x19 +#1016 @ 173,317: 15x10 +#1017 @ 377,342: 12x13 +#1018 @ 486,668: 15x15 +#1019 @ 31,933: 17x26 +#1020 @ 296,491: 19x15 +#1021 @ 532,257: 19x24 +#1022 @ 800,330: 24x25 +#1023 @ 303,297: 12x25 +#1024 @ 349,775: 29x29 +#1025 @ 610,101: 20x15 +#1026 @ 13,218: 17x14 +#1027 @ 306,599: 26x16 +#1028 @ 974,299: 24x22 +#1029 @ 878,961: 16x24 +#1030 @ 146,708: 17x13 +#1031 @ 519,119: 27x14 +#1032 @ 769,888: 22x27 +#1033 @ 281,526: 23x29 +#1034 @ 221,760: 27x11 +#1035 @ 594,87: 17x26 +#1036 @ 979,125: 11x11 +#1037 @ 358,72: 22x27 +#1038 @ 291,10: 16x13 +#1039 @ 792,887: 20x18 +#1040 @ 681,599: 19x11 +#1041 @ 464,600: 12x25 +#1042 @ 928,503: 11x21 +#1043 @ 257,483: 13x12 +#1044 @ 489,294: 17x11 +#1045 @ 84,31: 21x12 +#1046 @ 700,31: 27x22 +#1047 @ 969,383: 20x16 +#1048 @ 685,160: 18x13 +#1049 @ 636,52: 28x17 +#1050 @ 566,347: 25x16 +#1051 @ 543,112: 19x19 +#1052 @ 108,797: 19x24 +#1053 @ 655,212: 16x16 +#1054 @ 4,291: 19x23 +#1055 @ 231,932: 26x15 +#1056 @ 406,793: 19x26 +#1057 @ 431,896: 18x12 +#1058 @ 341,694: 27x23 +#1059 @ 500,809: 22x11 +#1060 @ 949,393: 22x15 +#1061 @ 621,382: 24x18 +#1062 @ 322,664: 14x13 +#1063 @ 175,443: 29x22 +#1064 @ 484,147: 15x18 +#1065 @ 741,521: 12x29 +#1066 @ 837,919: 24x13 +#1067 @ 381,639: 27x22 +#1068 @ 921,648: 20x19 +#1069 @ 232,694: 14x27 +#1070 @ 836,296: 21x12 +#1071 @ 555,808: 28x25 +#1072 @ 57,903: 28x16 +#1073 @ 90,384: 15x23 +#1074 @ 109,159: 18x28 +#1075 @ 771,281: 18x23 +#1076 @ 245,90: 26x17 +#1077 @ 908,672: 14x14 +#1078 @ 940,162: 15x18 +#1079 @ 694,468: 14x24 +#1080 @ 599,987: 29x13 +#1081 @ 652,107: 25x22 +#1082 @ 668,576: 10x14 +#1083 @ 213,67: 12x18 +#1084 @ 295,445: 27x11 +#1085 @ 399,829: 18x14 +#1086 @ 891,27: 11x11 +#1087 @ 298,109: 16x26 +#1088 @ 867,426: 15x25 +#1089 @ 61,826: 10x15 +#1090 @ 714,651: 20x15 +#1091 @ 397,831: 17x15 +#1092 @ 169,159: 28x21 +#1093 @ 18,719: 16x12 +#1094 @ 338,514: 18x20 +#1095 @ 956,628: 19x10 +#1096 @ 260,485: 3x6 +#1097 @ 848,844: 16x11 +#1098 @ 234,618: 18x15 +#1099 @ 365,649: 21x26 +#1100 @ 289,340: 13x13 +#1101 @ 539,455: 18x27 +#1102 @ 364,333: 21x23 +#1103 @ 815,428: 28x27 +#1104 @ 443,912: 23x23 +#1105 @ 421,863: 10x27 +#1106 @ 964,313: 20x17 +#1107 @ 872,677: 19x28 +#1108 @ 541,239: 13x17 +#1109 @ 316,757: 22x15 +#1110 @ 304,851: 11x16 +#1111 @ 115,565: 22x29 +#1112 @ 929,172: 25x29 +#1113 @ 327,413: 14x22 +#1114 @ 916,420: 20x14 +#1115 @ 461,821: 25x21 +#1116 @ 222,369: 29x11 +#1117 @ 755,12: 16x16 +#1118 @ 601,558: 5x14 +#1119 @ 523,252: 3x12 +#1120 @ 492,937: 14x27 +#1121 @ 746,324: 29x21 +#1122 @ 860,298: 11x23 +#1123 @ 42,793: 23x23 +#1124 @ 715,945: 18x28 +#1125 @ 224,801: 29x21 +#1126 @ 890,442: 28x28 +#1127 @ 427,782: 21x14 +#1128 @ 442,551: 10x28 +#1129 @ 863,798: 17x18 +#1130 @ 650,133: 12x24 +#1131 @ 224,795: 24x26 +#1132 @ 661,376: 27x29 +#1133 @ 897,867: 14x16 +#1134 @ 12,958: 28x25 +#1135 @ 605,624: 29x21 +#1136 @ 493,322: 23x23 +#1137 @ 130,947: 21x24 +#1138 @ 765,696: 17x10 +#1139 @ 855,206: 18x28 +#1140 @ 887,816: 20x22 +#1141 @ 380,873: 6x10 +#1142 @ 231,539: 14x16 +#1143 @ 409,468: 10x28 +#1144 @ 473,555: 11x12 +#1145 @ 619,386: 27x21 +#1146 @ 56,968: 4x8 +#1147 @ 207,656: 17x11 +#1148 @ 58,495: 27x13 +#1149 @ 378,465: 29x18 +#1150 @ 233,963: 17x26 +#1151 @ 931,274: 20x27 +#1152 @ 391,428: 13x27 +#1153 @ 873,246: 14x20 +#1154 @ 448,289: 21x11 +#1155 @ 690,320: 20x14 +#1156 @ 419,551: 15x17 +#1157 @ 184,208: 25x27 +#1158 @ 778,511: 14x24 +#1159 @ 291,227: 11x12 +#1160 @ 722,247: 23x24 +#1161 @ 686,451: 18x18 +#1162 @ 612,811: 16x14 +#1163 @ 888,376: 16x15 +#1164 @ 85,162: 12x21 +#1165 @ 542,729: 18x22 +#1166 @ 116,864: 14x21 +#1167 @ 647,88: 24x20 +#1168 @ 586,617: 15x25 +#1169 @ 181,178: 21x26 +#1170 @ 954,229: 24x14 +#1171 @ 166,798: 9x8 +#1172 @ 636,200: 21x11 +#1173 @ 142,104: 22x22 +#1174 @ 973,925: 12x17 +#1175 @ 782,8: 10x18 +#1176 @ 11,324: 28x20 +#1177 @ 448,67: 11x24 +#1178 @ 59,278: 12x24 +#1179 @ 466,764: 13x17 +#1180 @ 890,783: 29x10 +#1181 @ 476,831: 10x23 +#1182 @ 875,346: 14x26 +#1183 @ 698,774: 11x27 +#1184 @ 793,334: 26x21 +#1185 @ 126,929: 22x26 +#1186 @ 715,63: 21x11 +#1187 @ 169,347: 21x21 +#1188 @ 522,564: 19x18 +#1189 @ 945,573: 15x11 +#1190 @ 889,756: 28x16 +#1191 @ 451,197: 26x22 +#1192 @ 449,633: 22x26 +#1193 @ 102,763: 19x11 +#1194 @ 214,846: 14x18 +#1195 @ 583,558: 15x18 +#1196 @ 446,587: 25x10 +#1197 @ 109,852: 22x29 +#1198 @ 149,326: 20x27 +#1199 @ 637,42: 23x28 +#1200 @ 878,151: 28x28 +#1201 @ 479,562: 28x27 +#1202 @ 367,866: 24x17 +#1203 @ 182,17: 11x7 +#1204 @ 217,734: 10x12 +#1205 @ 421,60: 21x16 +#1206 @ 742,900: 10x20 +#1207 @ 865,690: 21x27 +#1208 @ 22,231: 19x28 +#1209 @ 284,896: 4x6 +#1210 @ 498,336: 10x25 +#1211 @ 474,76: 26x27 +#1212 @ 313,287: 23x29 +#1213 @ 816,338: 10x28 +#1214 @ 727,818: 27x18 +#1215 @ 967,577: 21x20 +#1216 @ 99,722: 13x12 +#1217 @ 213,861: 18x18 +#1218 @ 654,49: 17x27 +#1219 @ 817,735: 19x13 +#1220 @ 825,72: 15x29 +#1221 @ 343,251: 10x13 +#1222 @ 771,860: 26x20 +#1223 @ 202,797: 11x12 +#1224 @ 145,782: 24x24 +#1225 @ 15,611: 21x19 +#1226 @ 629,427: 15x16 +#1227 @ 748,183: 20x28 +#1228 @ 94,86: 12x14 +#1229 @ 62,51: 21x13 +#1230 @ 218,649: 18x13 +#1231 @ 798,158: 14x16 +#1232 @ 178,541: 18x19 +#1233 @ 856,414: 17x23 +#1234 @ 962,252: 20x13 +#1235 @ 543,300: 25x18 +#1236 @ 263,293: 14x25 +#1237 @ 933,253: 14x19 +#1238 @ 345,816: 22x21 +#1239 @ 891,212: 11x25 +#1240 @ 157,148: 19x22 +#1241 @ 47,806: 19x10 +#1242 @ 148,3: 12x14 +#1243 @ 687,8: 22x29 +#1244 @ 969,252: 21x29 +#1245 @ 115,101: 6x6 +#1246 @ 378,724: 26x13 +#1247 @ 711,263: 27x22 +#1248 @ 790,156: 12x13 +#1249 @ 483,407: 28x13 +#1250 @ 621,193: 18x23 +#1251 @ 774,340: 20x15 +#1252 @ 935,769: 18x14 +#1253 @ 160,461: 18x14 +#1254 @ 383,865: 22x14 +#1255 @ 320,536: 17x25 +#1256 @ 795,868: 17x27 +#1257 @ 219,662: 14x11 +#1258 @ 701,109: 20x20 +#1259 @ 494,960: 26x18 +#1260 @ 307,184: 24x16 +#1261 @ 733,403: 29x13 +#1262 @ 117,113: 20x20 +#1263 @ 289,570: 12x12 +#1264 @ 641,277: 25x22 +#1265 @ 663,58: 23x14 +#1266 @ 848,229: 17x13 +#1267 @ 515,347: 15x29 +#1268 @ 950,194: 9x7 +#1269 @ 463,812: 23x29 +#1270 @ 367,708: 26x20 +#1271 @ 272,863: 25x11 +#1272 @ 444,951: 11x11 +#1273 @ 207,747: 28x19 +#1274 @ 242,9: 11x19 +#1275 @ 555,840: 15x25 +#1276 @ 853,121: 22x28 +#1277 @ 135,117: 20x19 +#1278 @ 804,759: 14x15 +#1279 @ 232,737: 28x29 +#1280 @ 663,81: 26x28 +#1281 @ 817,251: 26x11 +#1282 @ 629,717: 21x10 +#1283 @ 428,292: 22x23 +#1284 @ 649,202: 25x12 +#1285 @ 122,373: 18x21 +#1286 @ 130,717: 23x20 +#1287 @ 857,720: 16x24 +#1288 @ 420,52: 5x6 +#1289 @ 775,786: 20x17 +#1290 @ 13,827: 29x21 +#1291 @ 656,727: 14x18 +#1292 @ 913,961: 21x12 +#1293 @ 876,805: 19x18 +#1294 @ 892,835: 20x25 +#1295 @ 405,856: 24x22 +#1296 @ 703,660: 23x12 +#1297 @ 119,361: 14x13 +#1298 @ 936,634: 8x8 +#1299 @ 569,679: 18x26 +#1300 @ 626,424: 14x19 +#1301 @ 377,331: 22x25 +#1302 @ 424,934: 25x23 +#1303 @ 261,494: 22x26 +#1304 @ 455,397: 15x18 +#1305 @ 221,946: 25x10 +#1306 @ 395,25: 21x19 +#1307 @ 670,139: 16x20 +#1308 @ 218,932: 12x10 +#1309 @ 598,451: 14x17 +#1310 @ 820,332: 14x28 +#1311 @ 25,349: 22x16 +#1312 @ 672,454: 29x14 +#1313 @ 468,144: 25x23 +#1314 @ 650,654: 13x12 +#1315 @ 968,252: 12x26 +#1316 @ 411,54: 24x27 +#1317 @ 513,640: 6x5 +#1318 @ 727,380: 19x25 +#1319 @ 868,259: 12x19 +#1320 @ 470,585: 10x12 +#1321 @ 346,259: 15x19 +#1322 @ 125,332: 12x11 +#1323 @ 415,664: 16x24 +#1324 @ 606,112: 18x22 +#1325 @ 610,948: 23x10 +#1326 @ 43,684: 14x12 +#1327 @ 150,354: 22x27 +#1328 @ 881,33: 13x20 +#1329 @ 168,440: 16x15 +#1330 @ 33,418: 15x28 +#1331 @ 391,632: 22x23 +#1332 @ 524,946: 25x20 +#1333 @ 473,716: 16x19 +#1334 @ 855,128: 17x26 +#1335 @ 604,914: 18x11 +#1336 @ 686,134: 28x23 +#1337 @ 555,515: 11x19 +#1338 @ 562,677: 21x18 +#1339 @ 700,661: 13x14 +#1340 @ 416,795: 12x16 +#1341 @ 898,766: 27x25 +#1342 @ 294,752: 26x18 +#1343 @ 565,199: 24x17 +#1344 @ 463,263: 18x27 +#1345 @ 731,743: 20x11 +#1346 @ 797,103: 3x21 +#1347 @ 529,745: 26x27 +#1348 @ 754,765: 24x26 +#1349 @ 825,271: 13x24 +#1350 @ 904,109: 16x23 +#1351 @ 256,893: 11x16 +#1352 @ 947,236: 16x28 +#1353 @ 16,25: 17x10 +#1354 @ 964,569: 17x17 +#1355 @ 770,476: 25x28 +#1356 @ 108,786: 18x23 +#1357 @ 504,106: 6x3 +#1358 @ 389,956: 28x18 +#1359 @ 62,363: 10x23 +#1360 @ 121,205: 27x15 +#1361 @ 713,767: 18x16 +#1362 @ 971,536: 13x17 +#1363 @ 894,911: 24x3 +#1364 @ 2,591: 18x24 +#1365 @ 905,202: 28x11 +#1366 @ 306,844: 17x14 +#1367 @ 488,699: 27x18 diff --git a/www/statics/aoc/2018/04-1.linq b/www/statics/aoc/2018/04-1.linq new file mode 100644 index 0000000..c4504d5 --- /dev/null +++ b/www/statics/aoc/2018/04-1.linq @@ -0,0 +1,79 @@ + + + +var guards = new List<(int id, int awake, int[] minutes)>(); + +var data = File + .ReadAllLines(Path.Combine(Path.GetDirectoryName(Util.CurrentQueryPath), @"04_input.txt")) + .Where(p=>!string.IsNullOrWhiteSpace(p)) + .OrderBy(p=>p); + +int guard=-1; +int wakeup=0; +int wakesum=0; +bool awake=true; +int[] mins = new int[60]; +foreach (var line in data) +{ + int m = int.Parse(line.Substring(15,2)); + if (line.Contains("Guard")) + { + if (awake) + { + wakesum += (60 - wakeup); + for (int i = wakeup; i < 60; mins[i++] = 1) ; + } + + if (guard>=0)guards.Add((guard, wakesum, mins)); + + guard = int.Parse(line.Substring(26).Split(' ')[0]); + awake=true; + wakeup=0; + wakesum=0; + mins = new int[60]; + } + else if (line.Contains("falls asleep")) + { + awake = false; + wakesum += (m-wakeup); + for (int i = wakeup; i < m; mins[i++]=1); + } + else if (line.Contains("wakes up")) + { + awake = true; + wakeup=m; + } + else throw new Exception(); +} + + +guards + .GroupBy(g => g.id) + .Select(p => new + { + id = p.Key, + awake_total = p.Sum(q => q.awake), + asleep_total = p.Sum(q => 60 - q.awake), + mins = p.Select(q => q.minutes).Aggregate((a, b) => a.Zip(b, (u, v) => u + v).ToArray()) + }) + .Select(p => new + { + id = p.id, + awake_total = p.awake_total, + asleep_total = p.asleep_total, + mins = p.mins, + most_sleep_min = p.mins.Select((v, i) => (v, i)).OrderBy(q => q.v) + }) + .Select(p => new + { + id = p.id, + awake_total = p.awake_total, + asleep_total = p.asleep_total, + mins = p.mins, + most_sleep_min = p.most_sleep_min, + result = p.most_sleep_min.First().i * p.id + }) + .OrderByDescending(p => p.asleep_total) + .First() + .result + .Dump(); diff --git a/www/statics/aoc/2018/04-2.linq b/www/statics/aoc/2018/04-2.linq new file mode 100644 index 0000000..48028dd --- /dev/null +++ b/www/statics/aoc/2018/04-2.linq @@ -0,0 +1,85 @@ + + + +var guards = new List<(int id, int awake, int[] minutes)>(); + +var data = File + .ReadAllLines(Path.Combine(Path.GetDirectoryName(Util.CurrentQueryPath), @"04_input.txt")) + .Where(p=>!string.IsNullOrWhiteSpace(p)) + .OrderBy(p=>p); + +int guard=-1; +int wakeup=0; +int wakesum=0; +bool awake=true; +int[] mins = new int[60]; +foreach (var line in data) +{ + int m = int.Parse(line.Substring(15,2)); + if (line.Contains("Guard")) + { + if (awake) + { + wakesum += (60 - wakeup); + for (int i = wakeup; i < 60; mins[i++] = 1) ; + } + + if (guard>=0)guards.Add((guard, wakesum, mins)); + + guard = int.Parse(line.Substring(26).Split(' ')[0]); + awake=true; + wakeup=0; + wakesum=0; + mins = new int[60]; + } + else if (line.Contains("falls asleep")) + { + awake = false; + wakesum += (m-wakeup); + for (int i = wakeup; i < m; mins[i++]=1); + } + else if (line.Contains("wakes up")) + { + awake = true; + wakeup=m; + } + else throw new Exception(); +} + + +guards + .GroupBy(g => g.id) + .Select(p => new + { + id = p.Key, + awake_total = p.Sum(q => q.awake), + asleep_total = p.Sum(q => 60 - q.awake), + mins = p.Select(q => q.minutes).Aggregate((a, b) => a.Zip(b, (u, v) => u + v).ToArray()), + shifts = p.Count(), + }) + .Select(p => new + { + id = p.id, + awake_total = p.awake_total, + asleep_total = p.asleep_total, + shifts = p.shifts, + mins = p.mins, + most_wake_min = p.mins.Select((v, i) => (v, i)).OrderByDescending(q => q.v), + most_sleep_min = p.mins.Select((v, i) => new { v = p.shifts - v, i = i}).OrderByDescending(q => q.v) + }) + .Select(p => new + { + id = p.id, + awake_total = p.awake_total, + asleep_total = p.asleep_total, + shifts = p.shifts, + mins = p.mins, + most_sleep_min = p.most_sleep_min, + most_wake_min = p.most_wake_min, + result = p.most_wake_min.First().i * p.id, + result2 = p.most_sleep_min.First().i * p.id, + }) + .OrderByDescending(p => p.most_sleep_min.First().v) + //.First() + //.result + .Dump(); diff --git a/www/statics/aoc/2018/04_challenge.txt b/www/statics/aoc/2018/04_challenge.txt new file mode 100644 index 0000000..f1f301c --- /dev/null +++ b/www/statics/aoc/2018/04_challenge.txt @@ -0,0 +1,60 @@ +--- 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). + +For example, consider the following records, which have already been organized into chronological order: + +[1518-11-01 00:00] Guard #10 begins shift +[1518-11-01 00:05] falls asleep +[1518-11-01 00:25] wakes up +[1518-11-01 00:30] falls asleep +[1518-11-01 00:55] wakes up +[1518-11-01 23:58] Guard #99 begins shift +[1518-11-02 00:40] falls asleep +[1518-11-02 00:50] wakes up +[1518-11-03 00:05] Guard #10 begins shift +[1518-11-03 00:24] falls asleep +[1518-11-03 00:29] wakes up +[1518-11-04 00:02] Guard #99 begins shift +[1518-11-04 00:36] falls asleep +[1518-11-04 00:46] wakes up +[1518-11-05 00:03] Guard #99 begins shift +[1518-11-05 00:45] falls asleep +[1518-11-05 00:55] wakes up + +Timestamps are written using year-month-day hour:minute format. The guard falling asleep or waking up is always the one whose shift most recently started. Because all asleep/awake times are during the midnight hour (00:00 - 00:59), only the minute portion (00 - 59) is relevant for those events. + +Visually, these records show that the guards are asleep at these times: + +Date ID Minute + 000000000011111111112222222222333333333344444444445555555555 + 012345678901234567890123456789012345678901234567890123456789 +11-01 #10 .....####################.....#########################..... +11-02 #99 ........................................##########.......... +11-03 #10 ........................#####............................... +11-04 #99 ....................................##########.............. +11-05 #99 .............................................##########..... + +The columns are Date, which shows the month-day portion of the relevant day; ID, which shows the guard on duty that day; and Minute, which shows the minutes during which the guard was asleep within the midnight hour. (The Minute column's header shows the minute's ten's digit in the first row and the one's digit in the second row.) Awake is shown as ., and asleep is shown as #. + +Note that guards count as asleep on the minute they fall asleep, and they count as awake on the minute they wake up. For example, because Guard #10 wakes up at 00:25 on 1518-11-01, minute 25 is marked as awake. + +If you can figure out the guard most likely to be asleep at a specific time, you might be able to trick that guard into working tonight so you can have the best chance of sneaking in. You have two strategies for choosing the best guard/minute combination. + +Strategy 1: Find the guard that has the most minutes asleep. What minute does that guard spend asleep the most? + +In the example above, Guard #10 spent the most minutes asleep, a total of 50 minutes (20+25+5), while Guard #99 only slept for a total of 30 minutes (10+10+10). Guard #10 was asleep most during minute 24 (on two days, whereas any other minute the guard was asleep was only seen on one day). + +While this example listed the entries in chronological order, your entries are in the order you found them. You'll need to organize them before they can be analyzed. + +What is the ID of the guard you chose multiplied by the minute you chose? (In the above example, the answer would be 10 * 24 = 240.) + +--- Part Two --- + +Strategy 2: Of all guards, which guard is most frequently asleep on the same minute? + +In the example above, Guard #99 spent minute 45 asleep more than any other guard or minute - three times in total. (In all other cases, any guard spent any minute asleep at most twice.) + +What is the ID of the guard you chose multiplied by the minute you chose? (In the above example, the answer would be 99 * 45 = 4455.) diff --git a/www/statics/aoc/2018/04_input.txt b/www/statics/aoc/2018/04_input.txt new file mode 100644 index 0000000..e80732c --- /dev/null +++ b/www/statics/aoc/2018/04_input.txt @@ -0,0 +1,1186 @@ +[1518-05-12 00:39] wakes up +[1518-05-09 00:21] falls asleep +[1518-11-16 00:07] falls asleep +[1518-02-06 23:51] Guard #2081 begins shift +[1518-03-22 00:53] falls asleep +[1518-09-11 23:58] Guard #1699 begins shift +[1518-02-23 00:02] Guard #1913 begins shift +[1518-05-07 00:22] wakes up +[1518-07-23 00:26] wakes up +[1518-10-07 00:40] wakes up +[1518-02-18 00:02] Guard #263 begins shift +[1518-06-08 00:18] falls asleep +[1518-04-28 00:00] Guard #3301 begins shift +[1518-02-04 00:49] wakes up +[1518-09-08 00:13] falls asleep +[1518-05-27 23:56] Guard #2689 begins shift +[1518-06-17 00:53] wakes up +[1518-03-27 00:00] Guard #1913 begins shift +[1518-04-27 00:00] Guard #2017 begins shift +[1518-11-14 00:05] falls asleep +[1518-03-30 00:37] wakes up +[1518-11-04 00:01] Guard #2521 begins shift +[1518-11-06 00:00] Guard #3137 begins shift +[1518-07-14 00:46] falls asleep +[1518-06-08 23:52] Guard #2689 begins shift +[1518-01-29 23:58] Guard #617 begins shift +[1518-09-14 00:08] falls asleep +[1518-04-19 23:59] Guard #1699 begins shift +[1518-10-17 00:15] falls asleep +[1518-10-17 00:41] falls asleep +[1518-09-01 00:41] falls asleep +[1518-07-08 00:50] wakes up +[1518-04-14 00:48] wakes up +[1518-02-11 00:34] falls asleep +[1518-06-01 00:54] falls asleep +[1518-04-01 00:55] wakes up +[1518-08-13 00:41] falls asleep +[1518-10-21 23:59] Guard #131 begins shift +[1518-08-25 00:47] falls asleep +[1518-07-28 23:57] Guard #1069 begins shift +[1518-04-26 00:57] falls asleep +[1518-09-27 00:59] wakes up +[1518-04-14 00:01] falls asleep +[1518-09-11 00:47] falls asleep +[1518-03-27 00:49] wakes up +[1518-03-02 00:04] Guard #263 begins shift +[1518-04-22 00:30] wakes up +[1518-10-03 00:40] wakes up +[1518-08-05 00:31] falls asleep +[1518-03-12 00:21] falls asleep +[1518-05-21 00:58] wakes up +[1518-05-06 00:25] wakes up +[1518-11-18 00:57] falls asleep +[1518-04-20 00:57] wakes up +[1518-03-11 00:48] falls asleep +[1518-08-06 00:00] Guard #2017 begins shift +[1518-10-13 00:55] wakes up +[1518-08-11 00:49] wakes up +[1518-07-12 00:59] wakes up +[1518-07-17 00:00] Guard #1217 begins shift +[1518-07-10 00:15] falls asleep +[1518-08-02 23:53] Guard #3187 begins shift +[1518-10-26 00:01] Guard #3181 begins shift +[1518-05-29 00:40] falls asleep +[1518-06-26 23:56] Guard #467 begins shift +[1518-09-02 00:45] falls asleep +[1518-04-09 00:41] falls asleep +[1518-10-14 00:57] wakes up +[1518-06-13 00:01] Guard #617 begins shift +[1518-11-15 00:28] falls asleep +[1518-04-24 00:47] wakes up +[1518-03-03 00:24] wakes up +[1518-09-26 00:32] falls asleep +[1518-11-21 00:00] Guard #1933 begins shift +[1518-04-18 00:53] wakes up +[1518-10-03 00:03] Guard #2521 begins shift +[1518-03-07 00:13] falls asleep +[1518-07-23 00:07] falls asleep +[1518-10-12 00:37] falls asleep +[1518-10-21 00:52] wakes up +[1518-09-12 00:51] wakes up +[1518-08-20 00:08] wakes up +[1518-03-08 00:57] wakes up +[1518-09-20 00:54] wakes up +[1518-10-30 00:12] falls asleep +[1518-04-21 00:40] wakes up +[1518-10-15 00:34] falls asleep +[1518-10-21 00:20] falls asleep +[1518-02-26 00:11] falls asleep +[1518-05-29 00:56] wakes up +[1518-04-25 00:24] falls asleep +[1518-04-28 23:56] Guard #263 begins shift +[1518-03-17 00:52] falls asleep +[1518-08-31 00:01] falls asleep +[1518-02-19 00:29] falls asleep +[1518-03-04 00:52] wakes up +[1518-02-04 00:25] falls asleep +[1518-09-10 00:01] falls asleep +[1518-07-31 00:29] falls asleep +[1518-06-13 00:57] falls asleep +[1518-09-12 00:58] wakes up +[1518-06-16 23:59] Guard #2711 begins shift +[1518-05-25 00:03] Guard #1913 begins shift +[1518-04-09 00:56] wakes up +[1518-10-09 00:02] Guard #131 begins shift +[1518-05-24 00:57] wakes up +[1518-04-23 23:58] Guard #3187 begins shift +[1518-03-10 00:39] wakes up +[1518-05-17 00:01] Guard #1069 begins shift +[1518-04-24 23:56] Guard #2081 begins shift +[1518-09-06 00:58] wakes up +[1518-07-09 00:51] falls asleep +[1518-06-02 00:02] Guard #2081 begins shift +[1518-09-29 00:16] falls asleep +[1518-08-12 00:46] wakes up +[1518-04-05 23:54] Guard #2657 begins shift +[1518-11-23 00:51] wakes up +[1518-08-19 00:59] wakes up +[1518-02-07 00:35] wakes up +[1518-06-18 00:03] Guard #3181 begins shift +[1518-02-13 00:44] falls asleep +[1518-03-23 00:53] wakes up +[1518-06-23 00:20] falls asleep +[1518-10-24 00:37] wakes up +[1518-03-25 00:17] falls asleep +[1518-11-20 00:19] falls asleep +[1518-02-08 00:15] falls asleep +[1518-10-28 00:40] wakes up +[1518-02-08 00:04] wakes up +[1518-02-05 23:58] Guard #1201 begins shift +[1518-08-24 23:50] Guard #1069 begins shift +[1518-10-26 00:57] wakes up +[1518-02-09 00:40] wakes up +[1518-10-02 00:07] falls asleep +[1518-10-11 00:04] falls asleep +[1518-06-22 00:02] Guard #2017 begins shift +[1518-07-11 23:59] Guard #1217 begins shift +[1518-11-14 00:58] wakes up +[1518-07-28 00:16] falls asleep +[1518-10-18 00:38] wakes up +[1518-09-11 00:13] falls asleep +[1518-10-20 00:42] falls asleep +[1518-02-01 00:54] wakes up +[1518-04-15 23:58] Guard #2711 begins shift +[1518-02-14 00:18] falls asleep +[1518-03-08 23:54] Guard #2521 begins shift +[1518-03-21 23:47] Guard #1699 begins shift +[1518-07-07 00:14] falls asleep +[1518-06-29 00:18] falls asleep +[1518-07-16 00:20] wakes up +[1518-10-05 23:57] Guard #1217 begins shift +[1518-09-09 00:52] wakes up +[1518-11-10 00:42] wakes up +[1518-04-20 00:10] falls asleep +[1518-09-11 00:44] wakes up +[1518-04-06 00:54] wakes up +[1518-06-30 00:04] Guard #1699 begins shift +[1518-08-03 00:01] falls asleep +[1518-10-01 00:35] wakes up +[1518-09-01 00:01] Guard #1913 begins shift +[1518-09-13 23:58] Guard #1069 begins shift +[1518-07-27 00:48] wakes up +[1518-03-25 00:02] Guard #3137 begins shift +[1518-07-24 23:56] Guard #2657 begins shift +[1518-09-05 00:21] falls asleep +[1518-02-02 00:57] wakes up +[1518-05-01 00:03] Guard #263 begins shift +[1518-07-02 00:21] falls asleep +[1518-02-14 00:40] falls asleep +[1518-07-10 00:37] wakes up +[1518-05-06 00:02] Guard #617 begins shift +[1518-02-03 00:21] falls asleep +[1518-09-01 00:58] wakes up +[1518-06-03 00:52] wakes up +[1518-01-30 00:42] wakes up +[1518-07-03 00:36] falls asleep +[1518-08-13 23:54] Guard #3301 begins shift +[1518-10-11 00:35] falls asleep +[1518-08-18 00:42] falls asleep +[1518-11-02 00:34] falls asleep +[1518-02-12 00:47] falls asleep +[1518-05-15 00:48] wakes up +[1518-04-16 00:55] wakes up +[1518-04-03 00:18] wakes up +[1518-05-28 23:49] Guard #3187 begins shift +[1518-08-05 00:52] wakes up +[1518-02-05 00:30] falls asleep +[1518-09-01 00:52] wakes up +[1518-09-27 00:15] falls asleep +[1518-06-22 00:47] wakes up +[1518-07-03 00:03] Guard #3181 begins shift +[1518-02-24 00:53] wakes up +[1518-02-05 00:57] wakes up +[1518-06-20 00:24] falls asleep +[1518-10-01 00:03] falls asleep +[1518-06-30 00:55] wakes up +[1518-03-06 00:08] falls asleep +[1518-07-06 00:28] falls asleep +[1518-06-24 00:25] falls asleep +[1518-06-26 00:36] wakes up +[1518-08-01 00:58] wakes up +[1518-04-04 00:17] falls asleep +[1518-04-04 00:43] wakes up +[1518-09-24 00:40] falls asleep +[1518-02-21 00:13] wakes up +[1518-09-14 23:57] Guard #1069 begins shift +[1518-02-11 00:03] Guard #557 begins shift +[1518-09-12 00:57] falls asleep +[1518-05-28 00:35] wakes up +[1518-08-17 00:47] wakes up +[1518-04-19 00:31] falls asleep +[1518-09-02 00:27] wakes up +[1518-10-19 00:03] Guard #263 begins shift +[1518-02-15 00:36] falls asleep +[1518-08-26 00:29] falls asleep +[1518-02-20 00:55] falls asleep +[1518-11-18 00:48] wakes up +[1518-10-18 00:45] falls asleep +[1518-09-23 00:21] falls asleep +[1518-10-08 00:15] falls asleep +[1518-07-29 00:51] wakes up +[1518-06-20 00:52] wakes up +[1518-03-15 23:57] Guard #2711 begins shift +[1518-08-20 00:32] falls asleep +[1518-04-09 00:04] Guard #1201 begins shift +[1518-04-21 00:47] falls asleep +[1518-09-28 00:03] Guard #3137 begins shift +[1518-11-14 00:47] falls asleep +[1518-06-13 00:53] wakes up +[1518-07-26 00:55] falls asleep +[1518-07-25 23:58] Guard #1699 begins shift +[1518-03-13 00:01] Guard #2081 begins shift +[1518-04-12 00:34] falls asleep +[1518-08-10 00:20] falls asleep +[1518-10-23 00:44] wakes up +[1518-05-14 00:47] falls asleep +[1518-01-30 00:58] wakes up +[1518-03-15 00:41] falls asleep +[1518-03-10 00:03] falls asleep +[1518-11-07 23:58] Guard #2017 begins shift +[1518-03-23 00:36] falls asleep +[1518-05-13 00:04] falls asleep +[1518-06-29 00:53] falls asleep +[1518-06-08 00:40] falls asleep +[1518-10-23 00:00] Guard #557 begins shift +[1518-06-14 00:57] wakes up +[1518-03-22 00:02] falls asleep +[1518-05-04 23:57] Guard #1217 begins shift +[1518-09-25 00:51] wakes up +[1518-10-03 00:14] wakes up +[1518-05-21 00:01] Guard #1699 begins shift +[1518-08-17 23:59] Guard #2711 begins shift +[1518-11-17 00:04] falls asleep +[1518-09-29 23:56] Guard #263 begins shift +[1518-03-06 00:39] wakes up +[1518-04-16 23:52] Guard #3187 begins shift +[1518-10-04 00:59] wakes up +[1518-06-03 00:47] falls asleep +[1518-09-19 00:47] wakes up +[1518-03-06 23:58] Guard #3181 begins shift +[1518-10-30 23:47] Guard #1217 begins shift +[1518-02-24 00:42] wakes up +[1518-03-28 00:40] falls asleep +[1518-09-17 00:01] Guard #617 begins shift +[1518-03-12 00:46] wakes up +[1518-04-27 00:57] falls asleep +[1518-03-04 00:02] Guard #467 begins shift +[1518-07-18 23:59] Guard #2521 begins shift +[1518-06-29 00:47] wakes up +[1518-07-12 00:50] wakes up +[1518-05-09 00:27] wakes up +[1518-03-19 00:52] falls asleep +[1518-02-14 23:49] Guard #1933 begins shift +[1518-06-09 00:03] falls asleep +[1518-09-03 23:58] Guard #1217 begins shift +[1518-07-07 00:20] wakes up +[1518-02-16 00:24] falls asleep +[1518-08-08 00:29] falls asleep +[1518-05-12 23:46] Guard #2081 begins shift +[1518-11-05 00:37] falls asleep +[1518-06-30 23:57] Guard #1217 begins shift +[1518-11-22 00:15] falls asleep +[1518-07-21 00:29] falls asleep +[1518-11-09 00:55] wakes up +[1518-11-11 00:35] falls asleep +[1518-07-14 23:56] Guard #2521 begins shift +[1518-10-13 00:07] falls asleep +[1518-09-23 00:38] wakes up +[1518-04-29 00:36] falls asleep +[1518-08-04 00:34] falls asleep +[1518-05-14 00:00] Guard #263 begins shift +[1518-04-09 23:56] Guard #2521 begins shift +[1518-04-14 00:07] wakes up +[1518-03-19 00:59] wakes up +[1518-04-07 00:19] falls asleep +[1518-02-25 00:47] wakes up +[1518-03-29 00:20] falls asleep +[1518-09-28 23:56] Guard #2711 begins shift +[1518-04-02 00:55] wakes up +[1518-06-07 00:59] wakes up +[1518-05-29 00:15] wakes up +[1518-05-01 00:55] wakes up +[1518-11-03 00:00] Guard #2081 begins shift +[1518-11-02 00:24] wakes up +[1518-08-21 00:56] wakes up +[1518-10-23 00:52] falls asleep +[1518-11-13 00:04] Guard #2689 begins shift +[1518-06-19 00:36] falls asleep +[1518-07-07 00:52] wakes up +[1518-01-31 00:56] wakes up +[1518-09-16 00:04] Guard #2711 begins shift +[1518-07-17 23:56] Guard #557 begins shift +[1518-03-10 23:53] Guard #1069 begins shift +[1518-07-27 00:58] wakes up +[1518-02-23 00:31] falls asleep +[1518-05-18 00:05] falls asleep +[1518-05-01 00:42] wakes up +[1518-02-21 23:56] Guard #379 begins shift +[1518-02-01 00:57] falls asleep +[1518-06-19 23:57] Guard #2081 begins shift +[1518-11-13 00:53] falls asleep +[1518-06-13 23:46] Guard #2689 begins shift +[1518-11-10 00:25] falls asleep +[1518-01-31 00:43] falls asleep +[1518-07-30 00:35] falls asleep +[1518-02-13 23:58] Guard #1217 begins shift +[1518-04-26 00:58] wakes up +[1518-02-09 00:49] wakes up +[1518-08-10 23:58] Guard #1913 begins shift +[1518-05-12 00:24] falls asleep +[1518-02-14 00:44] wakes up +[1518-02-17 00:59] wakes up +[1518-10-24 00:02] Guard #1699 begins shift +[1518-10-23 00:41] falls asleep +[1518-10-11 00:17] wakes up +[1518-08-10 00:48] falls asleep +[1518-10-11 00:37] wakes up +[1518-09-19 23:48] Guard #2521 begins shift +[1518-04-23 00:46] falls asleep +[1518-07-22 00:42] falls asleep +[1518-07-28 00:41] wakes up +[1518-05-24 00:30] falls asleep +[1518-06-05 00:15] falls asleep +[1518-04-28 00:52] wakes up +[1518-10-31 00:04] falls asleep +[1518-07-06 23:57] Guard #3187 begins shift +[1518-11-05 00:26] wakes up +[1518-08-02 00:36] falls asleep +[1518-06-20 00:37] falls asleep +[1518-02-07 00:03] falls asleep +[1518-10-27 00:00] Guard #379 begins shift +[1518-08-21 23:57] Guard #617 begins shift +[1518-05-30 00:31] falls asleep +[1518-04-16 00:54] falls asleep +[1518-05-26 00:25] wakes up +[1518-05-07 00:18] falls asleep +[1518-03-28 00:46] wakes up +[1518-07-18 00:15] falls asleep +[1518-04-21 23:59] Guard #2689 begins shift +[1518-05-22 00:59] wakes up +[1518-07-08 00:00] Guard #1933 begins shift +[1518-06-06 23:57] Guard #1217 begins shift +[1518-01-31 00:40] wakes up +[1518-04-22 23:56] Guard #2521 begins shift +[1518-03-11 00:04] falls asleep +[1518-08-14 00:57] wakes up +[1518-09-23 00:00] falls asleep +[1518-10-04 23:56] Guard #1201 begins shift +[1518-08-30 00:51] falls asleep +[1518-07-27 23:59] Guard #2521 begins shift +[1518-08-14 00:04] falls asleep +[1518-07-17 00:39] falls asleep +[1518-07-19 00:14] falls asleep +[1518-04-30 00:00] Guard #1913 begins shift +[1518-08-18 23:56] Guard #1217 begins shift +[1518-09-16 00:28] falls asleep +[1518-08-23 00:21] falls asleep +[1518-08-28 00:06] falls asleep +[1518-11-23 00:56] wakes up +[1518-02-13 00:02] Guard #2689 begins shift +[1518-02-27 00:59] wakes up +[1518-10-29 23:59] Guard #2657 begins shift +[1518-10-12 00:57] wakes up +[1518-10-03 23:57] Guard #3181 begins shift +[1518-11-22 00:57] falls asleep +[1518-07-16 00:11] falls asleep +[1518-01-31 00:02] Guard #1201 begins shift +[1518-02-16 00:00] Guard #1913 begins shift +[1518-09-10 23:58] Guard #2689 begins shift +[1518-06-03 00:08] falls asleep +[1518-09-18 23:56] Guard #1217 begins shift +[1518-06-20 00:59] wakes up +[1518-04-27 00:52] wakes up +[1518-11-14 23:58] Guard #1699 begins shift +[1518-11-03 00:59] wakes up +[1518-05-02 00:00] falls asleep +[1518-08-20 00:14] falls asleep +[1518-04-11 00:40] falls asleep +[1518-06-22 00:07] falls asleep +[1518-11-23 00:54] falls asleep +[1518-09-24 23:52] Guard #3187 begins shift +[1518-07-24 00:17] falls asleep +[1518-04-21 00:00] falls asleep +[1518-09-30 23:50] Guard #3137 begins shift +[1518-05-06 00:07] falls asleep +[1518-11-13 00:47] wakes up +[1518-08-04 23:46] Guard #3187 begins shift +[1518-09-01 00:57] falls asleep +[1518-08-17 00:04] Guard #1201 begins shift +[1518-02-05 00:01] Guard #263 begins shift +[1518-05-03 00:09] falls asleep +[1518-02-10 00:14] falls asleep +[1518-10-29 00:50] wakes up +[1518-03-22 00:50] wakes up +[1518-04-06 00:47] falls asleep +[1518-10-11 23:59] Guard #263 begins shift +[1518-04-25 00:36] wakes up +[1518-07-31 00:46] wakes up +[1518-05-26 00:13] falls asleep +[1518-03-17 00:13] falls asleep +[1518-02-11 00:49] falls asleep +[1518-09-30 00:52] wakes up +[1518-04-01 23:57] Guard #2711 begins shift +[1518-02-11 00:50] wakes up +[1518-06-24 23:50] Guard #3301 begins shift +[1518-03-02 00:43] wakes up +[1518-05-05 00:26] falls asleep +[1518-03-17 00:35] falls asleep +[1518-02-01 00:59] wakes up +[1518-05-31 00:57] wakes up +[1518-03-09 00:44] wakes up +[1518-07-03 00:06] falls asleep +[1518-05-04 00:39] wakes up +[1518-11-07 00:50] wakes up +[1518-08-22 00:59] wakes up +[1518-04-20 00:36] wakes up +[1518-02-13 00:50] wakes up +[1518-10-30 00:15] wakes up +[1518-08-14 00:49] falls asleep +[1518-03-03 00:30] falls asleep +[1518-09-22 00:49] falls asleep +[1518-03-18 00:02] Guard #2657 begins shift +[1518-07-07 00:42] falls asleep +[1518-02-09 00:46] falls asleep +[1518-11-18 00:59] wakes up +[1518-10-18 00:56] wakes up +[1518-10-23 00:54] wakes up +[1518-02-15 00:09] wakes up +[1518-05-09 00:00] Guard #1933 begins shift +[1518-03-24 00:46] falls asleep +[1518-06-20 00:29] wakes up +[1518-03-05 00:51] wakes up +[1518-07-11 00:01] Guard #467 begins shift +[1518-04-18 00:41] falls asleep +[1518-05-22 00:27] falls asleep +[1518-07-20 00:51] falls asleep +[1518-04-18 00:44] wakes up +[1518-11-20 00:03] Guard #1933 begins shift +[1518-06-11 23:51] Guard #617 begins shift +[1518-07-30 00:58] wakes up +[1518-08-02 00:59] wakes up +[1518-08-30 23:50] Guard #263 begins shift +[1518-07-25 00:54] wakes up +[1518-07-24 00:37] wakes up +[1518-11-10 23:56] Guard #1069 begins shift +[1518-06-09 00:47] wakes up +[1518-03-26 00:03] Guard #3187 begins shift +[1518-03-14 23:58] Guard #3181 begins shift +[1518-08-31 00:47] wakes up +[1518-02-09 00:00] falls asleep +[1518-10-28 23:58] Guard #617 begins shift +[1518-05-09 23:58] Guard #2081 begins shift +[1518-03-16 00:49] falls asleep +[1518-11-10 00:03] Guard #1069 begins shift +[1518-08-04 00:48] falls asleep +[1518-08-05 00:24] wakes up +[1518-01-30 00:53] falls asleep +[1518-02-18 00:48] wakes up +[1518-10-24 23:54] Guard #1201 begins shift +[1518-07-25 00:22] falls asleep +[1518-11-07 00:29] falls asleep +[1518-04-01 00:46] falls asleep +[1518-03-17 00:59] wakes up +[1518-07-02 00:01] Guard #467 begins shift +[1518-11-03 00:27] wakes up +[1518-09-03 00:22] falls asleep +[1518-11-20 00:45] wakes up +[1518-09-14 00:45] wakes up +[1518-10-20 00:33] wakes up +[1518-02-01 00:27] falls asleep +[1518-10-04 00:20] wakes up +[1518-08-08 00:30] wakes up +[1518-03-28 00:57] wakes up +[1518-06-04 00:51] wakes up +[1518-09-04 00:16] falls asleep +[1518-05-21 00:52] falls asleep +[1518-09-27 00:00] Guard #1217 begins shift +[1518-10-24 00:41] falls asleep +[1518-03-23 00:05] falls asleep +[1518-02-10 00:48] falls asleep +[1518-06-12 00:04] falls asleep +[1518-08-03 00:56] wakes up +[1518-11-12 00:53] wakes up +[1518-06-07 23:59] Guard #1933 begins shift +[1518-04-02 23:46] Guard #2081 begins shift +[1518-07-30 00:36] wakes up +[1518-08-20 23:58] Guard #3137 begins shift +[1518-02-21 00:16] falls asleep +[1518-02-13 00:56] wakes up +[1518-03-31 00:02] Guard #1699 begins shift +[1518-03-27 00:21] falls asleep +[1518-08-26 00:01] Guard #1217 begins shift +[1518-11-20 00:48] falls asleep +[1518-02-25 00:57] falls asleep +[1518-07-05 00:19] falls asleep +[1518-10-14 00:40] wakes up +[1518-09-11 00:48] wakes up +[1518-03-14 00:52] wakes up +[1518-04-29 00:27] falls asleep +[1518-10-14 00:30] falls asleep +[1518-08-23 00:01] Guard #2081 begins shift +[1518-02-13 00:54] falls asleep +[1518-09-15 00:57] wakes up +[1518-11-17 00:54] wakes up +[1518-09-18 00:44] wakes up +[1518-08-25 00:19] wakes up +[1518-03-30 00:00] Guard #263 begins shift +[1518-02-07 23:49] Guard #3137 begins shift +[1518-08-07 00:09] falls asleep +[1518-10-06 00:34] falls asleep +[1518-06-11 00:16] falls asleep +[1518-06-05 00:00] Guard #1699 begins shift +[1518-04-08 00:01] Guard #2711 begins shift +[1518-04-27 00:59] wakes up +[1518-06-05 00:30] wakes up +[1518-07-01 00:52] wakes up +[1518-06-28 00:31] falls asleep +[1518-09-23 23:59] Guard #1933 begins shift +[1518-02-24 00:52] falls asleep +[1518-09-30 00:38] wakes up +[1518-05-04 00:37] falls asleep +[1518-03-09 00:03] falls asleep +[1518-02-12 00:32] falls asleep +[1518-07-31 00:16] falls asleep +[1518-08-09 00:55] falls asleep +[1518-07-08 00:42] falls asleep +[1518-09-16 00:49] wakes up +[1518-06-01 00:42] wakes up +[1518-08-26 00:44] wakes up +[1518-07-06 00:03] Guard #3137 begins shift +[1518-07-19 00:58] wakes up +[1518-08-29 00:52] wakes up +[1518-03-20 00:22] falls asleep +[1518-05-27 00:17] falls asleep +[1518-09-04 00:58] wakes up +[1518-07-02 00:46] wakes up +[1518-05-13 00:39] wakes up +[1518-07-05 00:36] wakes up +[1518-09-17 00:23] falls asleep +[1518-11-03 00:46] falls asleep +[1518-06-19 00:43] wakes up +[1518-05-01 00:51] falls asleep +[1518-10-01 00:52] falls asleep +[1518-08-12 00:20] falls asleep +[1518-08-19 00:13] falls asleep +[1518-08-01 00:54] falls asleep +[1518-02-19 00:48] falls asleep +[1518-07-15 00:37] wakes up +[1518-05-16 00:02] Guard #131 begins shift +[1518-03-06 00:26] falls asleep +[1518-06-16 00:56] wakes up +[1518-03-15 00:24] wakes up +[1518-03-05 00:22] falls asleep +[1518-07-09 00:48] wakes up +[1518-08-28 00:00] Guard #3137 begins shift +[1518-05-31 00:41] falls asleep +[1518-02-18 23:56] Guard #2017 begins shift +[1518-03-31 00:24] falls asleep +[1518-07-21 23:58] Guard #2711 begins shift +[1518-07-27 00:57] falls asleep +[1518-05-22 00:03] Guard #2017 begins shift +[1518-11-17 00:24] wakes up +[1518-05-23 00:50] wakes up +[1518-09-15 00:09] falls asleep +[1518-02-26 23:58] Guard #3187 begins shift +[1518-09-22 00:00] Guard #2521 begins shift +[1518-07-09 00:59] wakes up +[1518-06-02 00:19] falls asleep +[1518-02-20 00:28] wakes up +[1518-07-20 00:06] falls asleep +[1518-10-20 00:01] Guard #617 begins shift +[1518-07-06 00:52] wakes up +[1518-08-30 00:54] wakes up +[1518-11-13 23:54] Guard #1217 begins shift +[1518-06-04 00:56] falls asleep +[1518-05-03 00:00] Guard #1069 begins shift +[1518-08-11 00:38] falls asleep +[1518-05-15 00:02] falls asleep +[1518-08-11 00:11] falls asleep +[1518-08-14 00:34] wakes up +[1518-08-08 00:36] falls asleep +[1518-05-20 00:46] falls asleep +[1518-11-20 00:59] wakes up +[1518-11-09 00:53] falls asleep +[1518-04-03 00:01] falls asleep +[1518-02-03 00:34] wakes up +[1518-05-18 00:58] wakes up +[1518-03-19 00:13] falls asleep +[1518-03-04 23:57] Guard #1913 begins shift +[1518-10-31 23:53] Guard #263 begins shift +[1518-05-28 00:57] wakes up +[1518-10-07 00:51] wakes up +[1518-10-02 00:28] falls asleep +[1518-08-31 00:22] wakes up +[1518-06-01 00:41] falls asleep +[1518-09-06 00:04] Guard #1933 begins shift +[1518-08-04 00:52] wakes up +[1518-05-23 00:11] falls asleep +[1518-03-02 00:47] falls asleep +[1518-07-12 00:57] falls asleep +[1518-05-12 00:54] wakes up +[1518-03-31 23:59] Guard #1933 begins shift +[1518-09-07 00:43] wakes up +[1518-06-13 00:58] wakes up +[1518-05-25 23:59] Guard #2657 begins shift +[1518-05-11 00:44] wakes up +[1518-10-08 00:11] wakes up +[1518-06-16 00:46] wakes up +[1518-06-28 00:00] Guard #2017 begins shift +[1518-04-17 00:01] falls asleep +[1518-10-29 00:48] falls asleep +[1518-04-08 00:38] wakes up +[1518-06-26 00:50] falls asleep +[1518-06-13 00:48] falls asleep +[1518-09-22 00:51] wakes up +[1518-09-03 00:31] wakes up +[1518-06-19 00:14] falls asleep +[1518-07-31 00:26] wakes up +[1518-08-30 00:28] wakes up +[1518-04-10 00:50] falls asleep +[1518-10-18 00:35] falls asleep +[1518-07-11 00:44] wakes up +[1518-08-30 00:23] falls asleep +[1518-02-12 00:43] wakes up +[1518-06-25 00:03] falls asleep +[1518-04-24 00:18] falls asleep +[1518-08-04 00:03] Guard #1933 begins shift +[1518-04-22 00:46] wakes up +[1518-11-03 00:22] falls asleep +[1518-08-12 00:00] Guard #2657 begins shift +[1518-03-20 23:56] Guard #1913 begins shift +[1518-10-20 00:59] wakes up +[1518-10-13 23:57] Guard #3181 begins shift +[1518-03-22 00:30] falls asleep +[1518-09-19 00:38] falls asleep +[1518-07-30 23:58] Guard #3181 begins shift +[1518-10-07 00:34] falls asleep +[1518-07-24 00:00] Guard #1217 begins shift +[1518-05-20 00:00] Guard #617 begins shift +[1518-06-12 00:57] wakes up +[1518-09-13 00:33] falls asleep +[1518-11-22 00:02] Guard #2657 begins shift +[1518-06-04 00:36] falls asleep +[1518-09-26 00:57] wakes up +[1518-10-07 00:45] falls asleep +[1518-11-22 00:19] wakes up +[1518-11-19 00:32] falls asleep +[1518-03-21 00:42] wakes up +[1518-09-30 00:29] falls asleep +[1518-05-25 00:57] wakes up +[1518-04-02 00:54] falls asleep +[1518-09-25 23:56] Guard #1933 begins shift +[1518-05-25 00:52] wakes up +[1518-06-29 00:57] wakes up +[1518-06-19 00:04] Guard #1699 begins shift +[1518-02-03 23:57] Guard #3181 begins shift +[1518-03-28 00:52] falls asleep +[1518-05-21 00:56] falls asleep +[1518-06-24 00:29] wakes up +[1518-10-20 23:57] Guard #1217 begins shift +[1518-03-19 00:00] Guard #1069 begins shift +[1518-05-27 00:45] wakes up +[1518-05-10 00:25] wakes up +[1518-04-13 23:52] Guard #467 begins shift +[1518-07-09 00:29] falls asleep +[1518-02-19 23:58] Guard #2657 begins shift +[1518-08-11 00:29] wakes up +[1518-10-13 00:02] Guard #2521 begins shift +[1518-08-05 00:05] falls asleep +[1518-03-09 00:04] wakes up +[1518-11-06 00:46] wakes up +[1518-09-15 00:14] wakes up +[1518-03-06 00:18] wakes up +[1518-09-25 00:45] falls asleep +[1518-02-27 00:53] falls asleep +[1518-02-26 00:46] falls asleep +[1518-05-04 00:04] falls asleep +[1518-11-04 23:59] Guard #2017 begins shift +[1518-04-19 00:51] wakes up +[1518-06-29 00:46] falls asleep +[1518-04-20 00:52] falls asleep +[1518-02-17 00:02] Guard #263 begins shift +[1518-04-12 00:53] wakes up +[1518-09-22 23:52] Guard #2081 begins shift +[1518-05-05 00:34] wakes up +[1518-02-19 00:34] wakes up +[1518-04-13 00:00] Guard #3529 begins shift +[1518-02-25 00:59] wakes up +[1518-05-19 00:54] wakes up +[1518-06-11 00:59] wakes up +[1518-04-02 00:41] wakes up +[1518-06-02 00:57] wakes up +[1518-06-27 00:18] wakes up +[1518-05-31 23:58] Guard #3181 begins shift +[1518-06-28 00:58] wakes up +[1518-02-08 00:22] wakes up +[1518-03-01 00:09] falls asleep +[1518-03-09 00:26] falls asleep +[1518-06-03 00:43] wakes up +[1518-09-09 00:23] falls asleep +[1518-10-26 00:46] falls asleep +[1518-10-15 00:37] wakes up +[1518-09-22 00:40] wakes up +[1518-10-02 00:18] wakes up +[1518-06-07 00:18] falls asleep +[1518-09-21 00:43] falls asleep +[1518-01-31 00:37] falls asleep +[1518-03-21 00:38] falls asleep +[1518-05-14 00:54] wakes up +[1518-11-07 00:02] Guard #3181 begins shift +[1518-08-02 00:00] Guard #3301 begins shift +[1518-04-05 00:38] wakes up +[1518-10-07 23:46] Guard #2081 begins shift +[1518-11-02 00:03] Guard #1069 begins shift +[1518-08-17 00:53] falls asleep +[1518-06-08 00:54] wakes up +[1518-06-09 23:58] Guard #2081 begins shift +[1518-02-20 00:47] falls asleep +[1518-08-19 23:50] Guard #2521 begins shift +[1518-10-14 23:58] Guard #2657 begins shift +[1518-10-03 00:30] falls asleep +[1518-09-27 00:43] falls asleep +[1518-11-05 00:12] falls asleep +[1518-07-04 00:31] falls asleep +[1518-03-25 00:53] wakes up +[1518-10-08 00:00] falls asleep +[1518-11-19 00:18] falls asleep +[1518-05-08 00:00] Guard #617 begins shift +[1518-02-25 00:03] Guard #3187 begins shift +[1518-02-19 00:59] wakes up +[1518-08-06 00:52] wakes up +[1518-04-15 00:02] Guard #3301 begins shift +[1518-11-17 23:57] Guard #2657 begins shift +[1518-11-08 00:42] falls asleep +[1518-06-17 00:39] falls asleep +[1518-07-14 00:56] wakes up +[1518-08-06 00:25] falls asleep +[1518-08-20 00:28] wakes up +[1518-02-10 00:00] Guard #2689 begins shift +[1518-02-08 23:53] Guard #2657 begins shift +[1518-03-31 00:49] wakes up +[1518-11-17 00:43] wakes up +[1518-06-05 23:59] Guard #1217 begins shift +[1518-07-27 00:17] falls asleep +[1518-10-10 23:54] Guard #1913 begins shift +[1518-08-10 00:00] Guard #2711 begins shift +[1518-03-11 00:56] wakes up +[1518-09-15 00:38] falls asleep +[1518-03-20 00:28] wakes up +[1518-03-03 00:55] wakes up +[1518-09-02 00:53] wakes up +[1518-03-24 00:34] wakes up +[1518-09-19 00:57] wakes up +[1518-08-01 00:02] Guard #1069 begins shift +[1518-09-08 00:03] Guard #2657 begins shift +[1518-11-14 00:40] wakes up +[1518-10-20 00:20] falls asleep +[1518-08-24 00:59] wakes up +[1518-05-22 23:59] Guard #1069 begins shift +[1518-04-04 23:58] Guard #557 begins shift +[1518-03-18 00:50] wakes up +[1518-08-17 00:54] wakes up +[1518-11-13 00:19] falls asleep +[1518-11-12 00:00] falls asleep +[1518-07-20 00:15] wakes up +[1518-03-07 00:48] wakes up +[1518-05-28 00:41] falls asleep +[1518-09-02 00:03] Guard #2657 begins shift +[1518-03-02 00:38] falls asleep +[1518-09-21 00:13] falls asleep +[1518-08-24 00:00] Guard #467 begins shift +[1518-10-04 00:44] falls asleep +[1518-07-15 00:34] falls asleep +[1518-08-18 00:59] wakes up +[1518-06-25 00:58] wakes up +[1518-04-26 00:10] falls asleep +[1518-10-06 00:54] wakes up +[1518-02-14 00:35] wakes up +[1518-09-06 23:59] Guard #1069 begins shift +[1518-09-28 00:23] falls asleep +[1518-04-06 00:41] falls asleep +[1518-02-26 00:48] wakes up +[1518-06-24 00:02] Guard #3301 begins shift +[1518-06-25 23:53] Guard #1217 begins shift +[1518-09-18 00:06] falls asleep +[1518-02-23 00:38] wakes up +[1518-02-16 00:50] wakes up +[1518-04-21 00:59] wakes up +[1518-06-08 00:31] wakes up +[1518-11-04 00:46] wakes up +[1518-05-03 00:59] wakes up +[1518-08-09 00:56] wakes up +[1518-02-20 23:54] Guard #2689 begins shift +[1518-04-29 00:45] wakes up +[1518-03-06 00:58] wakes up +[1518-11-19 00:56] wakes up +[1518-08-15 00:32] wakes up +[1518-02-10 00:19] wakes up +[1518-06-10 00:20] falls asleep +[1518-11-18 00:37] falls asleep +[1518-08-20 00:03] falls asleep +[1518-03-18 00:27] falls asleep +[1518-07-15 00:45] falls asleep +[1518-07-12 00:17] falls asleep +[1518-03-24 00:26] falls asleep +[1518-10-05 00:08] falls asleep +[1518-08-10 00:55] wakes up +[1518-07-04 23:59] Guard #3301 begins shift +[1518-03-04 00:08] falls asleep +[1518-07-30 00:00] Guard #2711 begins shift +[1518-07-10 00:35] falls asleep +[1518-02-26 00:00] Guard #467 begins shift +[1518-10-29 00:22] wakes up +[1518-08-04 00:42] wakes up +[1518-03-08 00:16] falls asleep +[1518-09-05 00:29] wakes up +[1518-06-13 00:31] falls asleep +[1518-07-26 00:51] wakes up +[1518-04-01 00:24] wakes up +[1518-07-13 00:04] Guard #3529 begins shift +[1518-02-11 00:43] wakes up +[1518-10-31 00:09] wakes up +[1518-04-08 00:36] falls asleep +[1518-09-22 00:10] falls asleep +[1518-03-17 00:49] wakes up +[1518-05-26 00:58] wakes up +[1518-08-23 00:26] wakes up +[1518-08-19 00:20] wakes up +[1518-04-20 23:52] Guard #3301 begins shift +[1518-02-28 00:02] Guard #2017 begins shift +[1518-06-15 00:35] falls asleep +[1518-04-22 00:10] falls asleep +[1518-04-19 00:03] Guard #1933 begins shift +[1518-10-01 23:59] Guard #3187 begins shift +[1518-07-10 00:44] falls asleep +[1518-02-01 23:59] Guard #467 begins shift +[1518-06-10 23:57] Guard #2657 begins shift +[1518-07-15 00:52] wakes up +[1518-05-09 00:32] falls asleep +[1518-08-20 00:57] wakes up +[1518-05-08 00:49] wakes up +[1518-11-21 00:34] wakes up +[1518-03-05 23:59] Guard #1069 begins shift +[1518-09-09 00:04] Guard #2689 begins shift +[1518-08-13 00:57] wakes up +[1518-02-12 00:01] Guard #3181 begins shift +[1518-11-22 23:59] Guard #2711 begins shift +[1518-09-04 00:50] wakes up +[1518-08-25 00:01] falls asleep +[1518-04-12 00:03] Guard #2689 begins shift +[1518-04-30 00:42] falls asleep +[1518-10-14 00:49] falls asleep +[1518-07-14 00:03] Guard #1933 begins shift +[1518-05-07 00:03] Guard #467 begins shift +[1518-05-29 00:03] falls asleep +[1518-08-08 23:57] Guard #1933 begins shift +[1518-05-14 23:52] Guard #3187 begins shift +[1518-09-13 00:59] wakes up +[1518-03-23 00:16] wakes up +[1518-06-13 00:42] wakes up +[1518-07-04 00:02] Guard #467 begins shift +[1518-08-10 00:45] wakes up +[1518-03-02 00:54] wakes up +[1518-05-11 00:04] Guard #1913 begins shift +[1518-10-19 00:22] falls asleep +[1518-10-06 23:58] Guard #3187 begins shift +[1518-07-03 00:16] wakes up +[1518-04-15 00:24] falls asleep +[1518-09-21 00:29] wakes up +[1518-04-06 00:31] wakes up +[1518-02-26 00:33] wakes up +[1518-04-07 00:03] Guard #2657 begins shift +[1518-05-09 00:46] wakes up +[1518-11-09 00:05] falls asleep +[1518-05-12 00:52] falls asleep +[1518-03-29 00:29] wakes up +[1518-06-20 00:56] falls asleep +[1518-11-16 00:04] Guard #617 begins shift +[1518-03-06 00:49] falls asleep +[1518-05-25 00:55] falls asleep +[1518-09-30 00:41] falls asleep +[1518-04-03 00:26] falls asleep +[1518-06-27 00:23] falls asleep +[1518-02-12 00:52] wakes up +[1518-03-22 00:25] wakes up +[1518-05-08 00:24] falls asleep +[1518-07-06 00:45] falls asleep +[1518-07-08 23:56] Guard #1913 begins shift +[1518-09-03 00:00] Guard #617 begins shift +[1518-06-16 00:02] Guard #1217 begins shift +[1518-05-25 00:23] falls asleep +[1518-07-21 00:43] wakes up +[1518-11-01 00:01] falls asleep +[1518-02-08 00:00] falls asleep +[1518-08-21 00:55] falls asleep +[1518-03-24 00:00] falls asleep +[1518-05-03 23:50] Guard #557 begins shift +[1518-07-21 00:03] Guard #2689 begins shift +[1518-09-03 00:46] falls asleep +[1518-03-09 23:46] Guard #2081 begins shift +[1518-06-14 00:30] wakes up +[1518-03-13 00:12] falls asleep +[1518-10-27 23:58] Guard #2017 begins shift +[1518-07-19 23:57] Guard #1201 begins shift +[1518-07-04 00:54] wakes up +[1518-09-04 23:59] Guard #2657 begins shift +[1518-11-09 00:46] wakes up +[1518-07-14 00:21] falls asleep +[1518-11-08 23:50] Guard #2017 begins shift +[1518-09-19 00:54] falls asleep +[1518-06-23 00:17] wakes up +[1518-08-12 23:59] Guard #3187 begins shift +[1518-11-04 00:19] falls asleep +[1518-06-03 00:04] Guard #2657 begins shift +[1518-10-24 00:58] wakes up +[1518-03-29 00:00] Guard #617 begins shift +[1518-04-06 00:43] wakes up +[1518-11-16 00:38] wakes up +[1518-06-16 00:10] falls asleep +[1518-03-23 00:57] falls asleep +[1518-06-04 00:00] Guard #3181 begins shift +[1518-05-21 00:38] wakes up +[1518-10-05 00:57] wakes up +[1518-06-01 00:57] wakes up +[1518-09-17 23:58] Guard #557 begins shift +[1518-07-20 00:58] wakes up +[1518-11-03 00:56] falls asleep +[1518-09-12 00:42] falls asleep +[1518-07-04 00:11] falls asleep +[1518-04-17 00:59] wakes up +[1518-10-17 00:02] Guard #2521 begins shift +[1518-06-29 00:01] Guard #2689 begins shift +[1518-07-14 00:30] wakes up +[1518-04-28 00:32] falls asleep +[1518-08-15 23:58] Guard #3529 begins shift +[1518-06-21 00:01] Guard #379 begins shift +[1518-06-18 00:36] falls asleep +[1518-09-04 00:56] falls asleep +[1518-11-11 00:59] wakes up +[1518-05-21 00:35] falls asleep +[1518-02-06 00:39] falls asleep +[1518-08-30 00:36] falls asleep +[1518-03-28 00:00] Guard #1201 begins shift +[1518-06-27 00:38] wakes up +[1518-11-11 23:48] Guard #617 begins shift +[1518-04-23 00:48] wakes up +[1518-05-18 23:56] Guard #1933 begins shift +[1518-03-26 00:20] falls asleep +[1518-03-19 00:42] wakes up +[1518-10-25 00:02] falls asleep +[1518-04-11 00:59] wakes up +[1518-04-11 00:03] Guard #2017 begins shift +[1518-09-09 23:50] Guard #2711 begins shift +[1518-10-05 00:41] wakes up +[1518-08-29 00:24] falls asleep +[1518-03-15 00:44] wakes up +[1518-03-03 00:00] Guard #3181 begins shift +[1518-08-09 00:25] falls asleep +[1518-08-30 00:48] wakes up +[1518-11-22 00:25] falls asleep +[1518-02-28 00:51] wakes up +[1518-04-06 00:01] falls asleep +[1518-04-05 00:18] falls asleep +[1518-09-25 00:03] falls asleep +[1518-08-22 00:53] falls asleep +[1518-08-27 00:18] falls asleep +[1518-10-29 00:06] falls asleep +[1518-02-15 00:48] wakes up +[1518-05-24 00:04] Guard #1913 begins shift +[1518-05-12 00:01] Guard #3301 begins shift +[1518-09-06 00:12] falls asleep +[1518-04-27 00:07] falls asleep +[1518-02-02 00:25] falls asleep +[1518-08-24 00:19] falls asleep +[1518-05-17 23:54] Guard #2689 begins shift +[1518-02-17 00:13] falls asleep +[1518-07-03 00:39] wakes up +[1518-10-10 00:15] falls asleep +[1518-06-04 00:57] wakes up +[1518-06-23 00:42] wakes up +[1518-07-26 00:07] falls asleep +[1518-11-02 00:20] falls asleep +[1518-02-24 00:56] falls asleep +[1518-05-28 00:08] falls asleep +[1518-04-10 00:54] wakes up +[1518-04-18 00:47] falls asleep +[1518-09-28 00:45] wakes up +[1518-10-16 00:04] Guard #131 begins shift +[1518-10-04 00:13] falls asleep +[1518-05-20 00:51] wakes up +[1518-05-17 00:43] falls asleep +[1518-11-21 00:15] falls asleep +[1518-11-17 00:47] falls asleep +[1518-03-13 23:56] Guard #1699 begins shift +[1518-10-08 00:34] wakes up +[1518-06-18 00:58] wakes up +[1518-02-02 23:59] Guard #557 begins shift +[1518-03-26 00:29] wakes up +[1518-03-24 00:17] wakes up +[1518-03-03 00:16] falls asleep +[1518-09-20 00:02] falls asleep +[1518-10-09 23:56] Guard #3301 begins shift +[1518-03-01 00:56] wakes up +[1518-02-10 00:50] wakes up +[1518-03-30 00:27] falls asleep +[1518-05-19 00:46] falls asleep +[1518-08-25 00:52] wakes up +[1518-11-19 00:51] falls asleep +[1518-08-26 23:58] Guard #2711 begins shift +[1518-06-19 00:27] wakes up +[1518-03-14 00:42] falls asleep +[1518-05-01 23:46] Guard #3301 begins shift +[1518-11-07 00:58] wakes up +[1518-09-10 00:54] wakes up +[1518-10-24 00:09] falls asleep +[1518-10-02 00:46] wakes up +[1518-06-09 00:05] wakes up +[1518-03-13 00:55] wakes up +[1518-09-07 00:13] falls asleep +[1518-09-17 00:44] wakes up +[1518-03-14 00:18] falls asleep +[1518-07-16 00:00] Guard #1201 begins shift +[1518-04-30 00:59] wakes up +[1518-03-20 00:00] Guard #2081 begins shift +[1518-05-06 00:56] wakes up +[1518-03-11 23:59] Guard #3187 begins shift +[1518-05-11 00:20] falls asleep +[1518-09-25 00:40] wakes up +[1518-07-17 00:53] wakes up +[1518-06-23 00:14] falls asleep +[1518-06-26 00:55] wakes up +[1518-08-14 23:57] Guard #2081 begins shift +[1518-05-10 00:17] falls asleep +[1518-05-20 00:40] wakes up +[1518-11-15 00:54] wakes up +[1518-05-06 00:47] falls asleep +[1518-10-19 00:56] wakes up +[1518-03-17 00:32] wakes up +[1518-05-31 00:00] Guard #3181 begins shift +[1518-06-26 00:00] falls asleep +[1518-11-19 00:48] wakes up +[1518-02-28 23:58] Guard #2081 begins shift +[1518-03-22 00:55] wakes up +[1518-04-26 00:00] Guard #557 begins shift +[1518-03-15 00:09] falls asleep +[1518-02-24 00:07] falls asleep +[1518-09-24 00:59] wakes up +[1518-06-09 00:11] falls asleep +[1518-09-21 00:04] Guard #2711 begins shift +[1518-08-17 00:35] falls asleep +[1518-07-10 00:49] wakes up +[1518-02-18 00:25] falls asleep +[1518-02-21 00:03] falls asleep +[1518-06-06 00:11] falls asleep +[1518-08-29 00:00] Guard #3301 begins shift +[1518-08-09 00:48] wakes up +[1518-08-19 00:27] falls asleep +[1518-07-30 00:54] falls asleep +[1518-03-23 23:48] Guard #3137 begins shift +[1518-11-13 00:55] wakes up +[1518-10-17 00:45] wakes up +[1518-05-02 00:22] wakes up +[1518-11-02 00:51] wakes up +[1518-09-21 00:53] wakes up +[1518-05-01 00:33] falls asleep +[1518-05-19 00:22] falls asleep +[1518-09-08 00:26] wakes up +[1518-08-06 23:59] Guard #617 begins shift +[1518-02-23 23:59] Guard #617 begins shift +[1518-02-25 00:25] falls asleep +[1518-05-26 00:40] falls asleep +[1518-11-05 00:58] wakes up +[1518-02-24 00:59] wakes up +[1518-05-30 00:37] wakes up +[1518-10-10 00:27] wakes up +[1518-04-03 23:56] Guard #2689 begins shift +[1518-07-23 00:03] Guard #2081 begins shift +[1518-04-29 00:31] wakes up +[1518-10-05 00:51] falls asleep +[1518-09-13 00:04] Guard #3181 begins shift +[1518-05-29 23:59] Guard #2689 begins shift +[1518-10-17 00:28] wakes up +[1518-05-26 23:58] Guard #3181 begins shift +[1518-11-19 00:22] wakes up +[1518-02-20 00:10] falls asleep +[1518-03-22 23:52] Guard #617 begins shift +[1518-06-15 00:44] wakes up +[1518-11-03 00:51] wakes up +[1518-06-23 00:04] Guard #2521 begins shift +[1518-05-20 00:06] falls asleep +[1518-08-30 00:03] Guard #2081 begins shift +[1518-02-28 00:30] falls asleep +[1518-08-27 00:53] wakes up +[1518-11-01 00:58] wakes up +[1518-10-28 00:15] falls asleep +[1518-07-11 00:27] falls asleep +[1518-05-17 00:48] wakes up +[1518-09-27 00:17] wakes up +[1518-08-08 00:59] wakes up +[1518-07-26 00:59] wakes up +[1518-08-31 00:43] falls asleep +[1518-07-29 00:26] falls asleep +[1518-02-15 00:02] falls asleep +[1518-10-17 23:57] Guard #3301 begins shift +[1518-11-07 00:53] falls asleep +[1518-07-22 00:53] wakes up +[1518-04-01 00:13] falls asleep +[1518-11-22 00:52] wakes up +[1518-10-03 00:09] falls asleep +[1518-11-16 23:49] Guard #557 begins shift +[1518-11-18 23:56] Guard #1069 begins shift +[1518-11-06 00:18] falls asleep +[1518-02-01 00:04] Guard #2521 begins shift +[1518-07-06 00:31] wakes up +[1518-04-26 00:24] wakes up +[1518-04-02 00:11] falls asleep +[1518-07-04 00:13] wakes up +[1518-06-27 00:12] falls asleep +[1518-02-20 00:48] wakes up +[1518-03-23 00:59] wakes up +[1518-07-18 00:31] wakes up +[1518-03-14 00:21] wakes up +[1518-10-01 00:55] wakes up +[1518-07-09 23:57] Guard #557 begins shift +[1518-08-07 00:56] wakes up +[1518-04-22 00:45] falls asleep +[1518-10-25 00:05] wakes up +[1518-03-16 00:53] wakes up +[1518-02-06 00:59] wakes up +[1518-06-14 00:05] falls asleep +[1518-04-18 00:00] Guard #1933 begins shift +[1518-09-03 00:53] wakes up +[1518-09-02 00:22] falls asleep +[1518-07-10 00:17] wakes up +[1518-08-28 00:32] wakes up +[1518-06-30 00:36] falls asleep +[1518-01-30 00:22] falls asleep +[1518-06-10 00:25] wakes up +[1518-05-19 00:42] wakes up +[1518-11-23 00:33] falls asleep +[1518-04-15 00:30] wakes up +[1518-11-22 00:59] wakes up +[1518-09-23 00:06] wakes up +[1518-04-03 00:56] wakes up +[1518-06-16 00:53] falls asleep +[1518-06-14 00:44] falls asleep +[1518-06-29 00:42] wakes up +[1518-04-07 00:50] wakes up +[1518-04-14 00:29] falls asleep +[1518-06-06 00:35] wakes up +[1518-02-20 00:58] wakes up +[1518-11-17 00:28] falls asleep +[1518-03-17 00:03] Guard #3187 begins shift +[1518-02-21 00:37] wakes up +[1518-05-04 00:16] wakes up +[1518-05-21 00:53] wakes up +[1518-07-27 00:04] Guard #2017 begins shift +[1518-06-14 23:59] Guard #1217 begins shift +[1518-03-11 00:17] wakes up +[1518-03-07 23:57] Guard #3187 begins shift +[1518-07-01 00:15] falls asleep +[1518-11-08 00:57] wakes up +[1518-09-29 00:54] wakes up +[1518-08-07 23:56] Guard #3301 begins shift +[1518-08-15 00:23] falls asleep +[1518-03-24 00:57] wakes up diff --git a/www/statics/aoc/2018/05-1.linq b/www/statics/aoc/2018/05-1.linq new file mode 100644 index 0000000..78970e4 --- /dev/null +++ b/www/statics/aoc/2018/05-1.linq @@ -0,0 +1,10 @@ + + +var poly = File.ReadAllText(Path.Combine(Path.GetDirectoryName(Util.CurrentQueryPath), @"05_input.txt")).Trim(); +for (;;) +{ + var len = poly.Length; + for (var i='a';i<='z';i++) poly=poly.Replace(i+""+char.ToUpper(i), ""); + for (var i='a';i<='z';i++) poly=poly.Replace(char.ToUpper(i)+""+i, ""); + if (len == poly.Length) { poly.Length.Dump(); return; } +} \ No newline at end of file diff --git a/www/statics/aoc/2018/05-2.linq b/www/statics/aoc/2018/05-2.linq new file mode 100644 index 0000000..ce3e333 --- /dev/null +++ b/www/statics/aoc/2018/05-2.linq @@ -0,0 +1,22 @@ + + + +var poly0 = File.ReadAllText(Path.Combine(Path.GetDirectoryName(Util.CurrentQueryPath), @"05_input.txt")).Trim(); + +var r = new List<(char, int)>(); + +for (var cc = 'a'; cc <= 'z'; cc++) +{ + var poly = poly0; + poly = poly.Replace(cc + "", ""); + poly = poly.Replace(char.ToUpper(cc) + "", ""); + for (; ; ) + { + var len = poly.Length; + for (var i = 'a'; i <= 'z'; i++) poly = poly.Replace(i + "" + char.ToUpper(i), ""); + for (var i = 'a'; i <= 'z'; i++) poly = poly.Replace(char.ToUpper(i) + "" + i, ""); + if (len == poly.Length) { r.Add((cc, poly.Length)); break; } + } +} + +r.OrderBy(p => p.Item2).First().Item2.Dump(); \ No newline at end of file diff --git a/www/statics/aoc/2018/05_challenge.txt b/www/statics/aoc/2018/05_challenge.txt new file mode 100644 index 0000000..4445ae7 --- /dev/null +++ b/www/statics/aoc/2018/05_challenge.txt @@ -0,0 +1,42 @@ +--- 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 (one of which is available as your puzzle input). + +The polymer is formed by smaller units which, when triggered, react with each other such that two adjacent units of the same type and opposite polarity are destroyed. Units' types are represented by letters; units' polarity is represented by capitalization. For instance, r and R are units with the same type but opposite polarity, whereas r and s are entirely different types and do not react. + +For example: + + In aA, a and A react, leaving nothing behind. + In abBA, bB destroys itself, leaving aA. As above, this then destroys itself, leaving nothing. + In abAB, no two adjacent units are of the same type, and so nothing happens. + In aabAAB, even though aa and AA are of the same type, their polarities match, and so nothing happens. + +Now, consider a larger example, dabAcCaCBAcCcaDA: + +dabAcCaCBAcCcaDA The first 'cC' is removed. +dabAaCBAcCcaDA This creates 'Aa', which is removed. +dabCBAcCcaDA Either 'cC' or 'Cc' are removed (the result is the same). +dabCBAcaDA No further actions can be taken. + +After all possible reactions, the resulting polymer contains 10 units. + +How many units remain after fully reacting the polymer you scanned? (Note: in this puzzle and others, the input is large; if you copy/paste your input, make sure you get the whole thing.) + +--- Part Two --- + +Time to improve the polymer. + +One of the unit types is causing problems; it's preventing the polymer from collapsing as much as it should. Your goal is to figure out which unit type is causing the most problems, remove all instances of it (regardless of polarity), fully react the remaining polymer, and measure its length. + +For example, again using the polymer dabAcCaCBAcCcaDA from above: + + Removing all A/a units produces dbcCCBcCcD. Fully reacting this polymer produces dbCBcD, which has length 6. + Removing all B/b units produces daAcCaCAcCcaDA. Fully reacting this polymer produces daCAcaDA, which has length 8. + Removing all C/c units produces dabAaBAaDA. Fully reacting this polymer produces daDA, which has length 4. + Removing all D/d units produces abAcCaCBAcCcaA. Fully reacting this polymer produces abCBAc, which has length 6. + +In this example, removing all C/c units was best, producing the answer 4. + +What is the length of the shortest polymer you can produce by removing all units of exactly one type and fully reacting the result? diff --git a/www/statics/aoc/2018/05_input.txt b/www/statics/aoc/2018/05_input.txt new file mode 100644 index 0000000..32f5a9b --- /dev/null +++ b/www/statics/aoc/2018/05_input.txt @@ -0,0 +1 @@ +QqGgPfHhOiIoFMmUXxOooBbOqXxc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qdDEXxeTttaATQwjJtTTqQtDdNnUheErRwWvVwWHLuUlXxTWwtTeEgGts \ No newline at end of file diff --git a/www/statics/aoc/2018/06-1.linq b/www/statics/aoc/2018/06-1.linq new file mode 100644 index 0000000..6f0095e --- /dev/null +++ b/www/statics/aoc/2018/06-1.linq @@ -0,0 +1,35 @@ + + +var coords = File + .ReadAllLines(Path.Combine(Path.GetDirectoryName(Util.CurrentQueryPath), @"06_input.txt")) + .Where(p => !string.IsNullOrWhiteSpace(p)) + .Select(l => (int.Parse(l.Split(',')[0].Trim()), int.Parse(l.Split(',')[1].Trim())) ) + .ToList(); + + +int[][] d = new int[2][]; + +for (int i = 0; i < 2; i++) +{ + var minX = coords.Min(p => p.Item1)-i; + var maxX = coords.Max(p => p.Item1)+i; + var minY = coords.Min(p => p.Item2)-i; + var maxY = coords.Max(p => p.Item2)+i; + + int[,] map = new int[1+maxX-minX, 1+maxY-minY]; + + d[i] = new int[coords.Count]; + + for (int x = minX; x <= maxX; x++) + for (int y = minX; y <= maxY; y++) + { + var s = coords.Select((c, idx) => new { I = idx, D = Math.Abs(c.Item1 - x) + Math.Abs(c.Item2 - y), V = c }).OrderBy(c => c.D).ToList(); + if (s[0].D == s[1].D) { map[x-minX, y-minY]=-1; continue; } + d[i][s[0].I]++; + map[x-minX, y-minY]=s[0].I; + } + //map.Dump(); +} + +//d[0].Zip(d[1], (a, b) => (a, b)).Dump(); +d[0].Zip(d[1], (a, b) => (a, b)).Where(p => p.a == p.b).Max().a.Dump(); \ No newline at end of file diff --git a/www/statics/aoc/2018/06-2.linq b/www/statics/aoc/2018/06-2.linq new file mode 100644 index 0000000..b020da9 --- /dev/null +++ b/www/statics/aoc/2018/06-2.linq @@ -0,0 +1,25 @@ + + +var coords = File + .ReadAllLines(Path.Combine(Path.GetDirectoryName(Util.CurrentQueryPath), @"06_input.txt")) + .Where(p => !string.IsNullOrWhiteSpace(p)) + .Select(l => (int.Parse(l.Split(',')[0].Trim()), int.Parse(l.Split(',')[1].Trim()))) + .ToList(); + + +var minX = coords.Min(p => p.Item1) - 5_000; +var maxX = coords.Max(p => p.Item1) + 5_000; +var minY = coords.Min(p => p.Item2) - 5_000; +var maxY = coords.Max(p => p.Item2) + 5_000; + +int r = 0; + +for (int x = minX; x <= maxX; x++) +for (int y = minX; y <= maxY; y++) +{ + var s1 = coords.Sum(c => Math.Abs(c.Item1 - x) + Math.Abs(c.Item2 - y)); + if (s1 < 10_000) r++; + Util.Progress=((x-minX)*100)/(maxX-minX); +} + +r.Dump(); \ No newline at end of file diff --git a/www/statics/aoc/2018/06_challenge.txt b/www/statics/aoc/2018/06_challenge.txt new file mode 100644 index 0000000..f1cef71 --- /dev/null +++ b/www/statics/aoc/2018/06_challenge.txt @@ -0,0 +1,87 @@ +--- 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." + +The device then produces a list of coordinates (your puzzle input). Are they places it thinks are safe or dangerous? It recommends you check manual page 729. The Elves did not give you a manual. + +If they're dangerous, maybe you can minimize the danger by finding the coordinate that gives the largest distance from the other points. + +Using only the Manhattan distance, determine the area around each coordinate by counting the number of integer X,Y locations that are closest to that coordinate (and aren't tied in distance to any other coordinate). + +Your goal is to find the size of the largest area that isn't infinite. For example, consider the following list of coordinates: + +1, 1 +1, 6 +8, 3 +3, 4 +5, 5 +8, 9 + +If we name these coordinates A through F, we can draw them on a grid, putting 0,0 at the top left: + +.......... +.A........ +.......... +........C. +...D...... +.....E.... +.B........ +.......... +.......... +........F. + +This view is partial - the actual grid extends infinitely in all directions. Using the Manhattan distance, each location's closest coordinate can be determined, shown here in lowercase: + +aaaaa.cccc +aAaaa.cccc +aaaddecccc +aadddeccCc +..dDdeeccc +bb.deEeecc +bBb.eeee.. +bbb.eeefff +bbb.eeffff +bbb.ffffFf + +Locations shown as . are equally far from two or more coordinates, and so they don't count as being closest to any. + +In this example, the areas of coordinates A, B, C, and F are infinite - while not shown here, their areas extend forever outside the visible grid. However, the areas of coordinates D and E are finite: D is closest to 9 locations, and E is closest to 17 (both including the coordinate's location itself). Therefore, in this example, the size of the largest area is 17. + +What is the size of the largest area that isn't infinite? + +--- Part Two --- + +On the other hand, if the coordinates are safe, maybe the best you can do is try to find a region near as many coordinates as possible. + +For example, suppose you want the sum of the Manhattan distance to all of the coordinates to be less than 32. For each location, add up the distances to all of the given coordinates; if the total of those distances is less than 32, that location is within the desired region. Using the same coordinates as above, the resulting region looks like this: + +.......... +.A........ +.......... +...###..C. +..#D###... +..###E#... +.B.###.... +.......... +.......... +........F. + +In particular, consider the highlighted location 4,3 located at the top middle of the region. Its calculation is as follows, where abs() is the absolute value function: + + Distance to coordinate A: abs(4-1) + abs(3-1) = 5 + Distance to coordinate B: abs(4-1) + abs(3-6) = 6 + Distance to coordinate C: abs(4-8) + abs(3-3) = 4 + Distance to coordinate D: abs(4-3) + abs(3-4) = 2 + Distance to coordinate E: abs(4-5) + abs(3-5) = 3 + Distance to coordinate F: abs(4-8) + abs(3-9) = 10 + Total distance: 5 + 6 + 4 + 2 + 3 + 10 = 30 + +Because the total distance to all coordinates (30) is less than 32, the location is within the region. + +This region, which also includes coordinates D and E, has a total size of 16. + +Your actual region will need to be much larger than this example, though, instead including all locations with a total distance of less than 10000. + +What is the size of the region containing all locations which have a total distance to all given coordinates of less than 10000? diff --git a/www/statics/aoc/2018/06_input.txt b/www/statics/aoc/2018/06_input.txt new file mode 100644 index 0000000..16c8863 --- /dev/null +++ b/www/statics/aoc/2018/06_input.txt @@ -0,0 +1,50 @@ +264, 340 +308, 156 +252, 127 +65, 75 +102, 291 +47, 67 +83, 44 +313, 307 +159, 48 +84, 59 +263, 248 +188, 258 +312, 240 +59, 173 +191, 130 +155, 266 +252, 119 +108, 299 +50, 84 +172, 227 +226, 159 +262, 177 +233, 137 +140, 211 +108, 175 +278, 255 +259, 209 +233, 62 +44, 341 +58, 175 +252, 74 +232, 63 +176, 119 +209, 334 +103, 112 +155, 94 +253, 255 +169, 87 +135, 342 +55, 187 +313, 338 +210, 63 +237, 321 +171, 143 +63, 238 +79, 132 +135, 113 +310, 294 +289, 184 +56, 259 diff --git a/www/statics/aoc/2018/07-1.linq b/www/statics/aoc/2018/07-1.linq new file mode 100644 index 0000000..398ab1c --- /dev/null +++ b/www/statics/aoc/2018/07-1.linq @@ -0,0 +1,35 @@ + + +class Node { public char N; public List Precond = new List(); public List Postcond = new List(); } + +void Main() +{ + var data = File + .ReadAllLines(Path.Combine(Path.GetDirectoryName(Util.CurrentQueryPath), @"07_input.txt")) + .Where(p => !string.IsNullOrWhiteSpace(p)) + .Select(l => (l[5], l[36])) + .ToList(); + + var nodes = data.SelectMany(p => new[] {p.Item1, p.Item2}).Distinct().Select(p => new Node {N=p}).ToList(); + + foreach (var (pre, post) in data) + { + var n1 = nodes.First(p => p.N == pre); + var n2 = nodes.First(p => p.N == post); + + n1.Postcond.Add(n2); + n2.Precond.Add(n1); + } + + var r = new StringBuilder(); + for(var fin = new HashSet(); fin.Count !fin.Contains(p)).Where(p => p.Precond.All(q => fin.Contains(q))).OrderBy(p=>p.N).First(); + fin.Add(n); + r.Append(n.N); + } + r.ToString().Dump(); + +} + +// Define other methods and classes here diff --git a/www/statics/aoc/2018/07-2.linq b/www/statics/aoc/2018/07-2.linq new file mode 100644 index 0000000..d4b531f --- /dev/null +++ b/www/statics/aoc/2018/07-2.linq @@ -0,0 +1,61 @@ + + +class Node { public char N; public List Precond = new List(); public List Postcond = new List(); } +class Worker { public Node curr; public int Remaining; } +void Main() +{ + var data = File + .ReadAllLines(Path.Combine(Path.GetDirectoryName(Util.CurrentQueryPath), @"07_input.txt")) + .Where(p => !string.IsNullOrWhiteSpace(p)) + .Select(l => (l[5], l[36])) + .ToList(); + + var nodes = data.SelectMany(p => new[] { p.Item1, p.Item2 }).Distinct().Select(p => new Node { N = p }).ToList(); + + foreach (var (pre, post) in data) + { + var n1 = nodes.First(p => p.N == pre); + var n2 = nodes.First(p => p.N == post); + + n1.Postcond.Add(n2); + n2.Precond.Add(n1); + } + + var workers = Enumerable.Repeat(0, 5).Select(p => new Worker()).ToList(); + + var started = new HashSet(); + var fin = new HashSet(); + var done = new StringBuilder(); + for (int sec = 0; workers.Any(n => n.curr != null) || fin.Count < nodes.Count; sec++) + { + foreach (var w in workers.Where(p => p.curr != null)) + { + if (--w.Remaining == 0) + { + started.Remove(w.curr); + done.Append(w.curr.N); + fin.Add(w.curr); + w.curr = null; + } + } + + foreach (var w in workers.Where(p => p.curr == null)) + { + var n = nodes + .Where(p => !started.Contains(p)) + .Where(p => !fin.Contains(p)) + .Where(p => p.Precond.All(q => fin.Contains(q))) + .OrderBy(p => p.N) + .FirstOrDefault(); + if (n == null) continue; + w.curr = n; + w.Remaining = 60 + 1 + (n.N - 'A'); + started.Add(n); + } + + $"{sec:000} {string.Join(" ", workers.Select(w => (w?.curr?.N ?? '.').ToString()))} {done.ToString()}".Dump(); + } + +} + +// Define other methods and classes here diff --git a/www/statics/aoc/2018/07_challenge.txt b/www/statics/aoc/2018/07_challenge.txt new file mode 100644 index 0000000..6217bf0 --- /dev/null +++ b/www/statics/aoc/2018/07_challenge.txt @@ -0,0 +1,75 @@ +--- 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. 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. + +"We do need to find our way back to the North Pole, but we have higher priorities at the moment. You see, believe it or not, this box contains something that will solve all of Santa's transportation problems - at least, that's what it looks like from the pictures in the instructions." It doesn't seem like they can read whatever language it's in, but you can: "Sleigh kit. Some assembly required." + +"'Sleigh'? What a wonderful name! You must help us assemble this 'sleigh' at once!" They start excitedly pulling more parts out of the box. + +The instructions specify a series of steps and requirements about which steps must be finished before others can begin (your puzzle input). Each step is designated by a single letter. For example, suppose you have the following instructions: + +Step C must be finished before step A can begin. +Step C must be finished before step F can begin. +Step A must be finished before step B can begin. +Step A must be finished before step D can begin. +Step B must be finished before step E can begin. +Step D must be finished before step E can begin. +Step F must be finished before step E can begin. + +Visually, these requirements look like this: + + + -->A--->B-- + / \ \ +C -->D----->E + \ / + ---->F----- + +Your first goal is to determine the order in which the steps should be completed. If more than one step is ready, choose the step which is first alphabetically. In this example, the steps would be completed as follows: + + Only C is available, and so it is done first. + Next, both A and F are available. A is first alphabetically, so it is done next. + Then, even though F was available earlier, steps B and D are now also available, and B is the first alphabetically of the three. + After that, only D and F are available. E is not available because only some of its prerequisites are complete. Therefore, D is completed next. + F is the only choice, so it is done next. + Finally, E is completed. + +So, in this example, the correct order is CABDFE. + +In what order should the steps in your instructions be completed? + +--- Part Two --- + +As you're about to begin construction, four of the Elves offer to help. "The sun will set soon; it'll go faster if we work together." Now, you need to account for multiple people working on steps simultaneously. If multiple steps are available, workers should still begin them in alphabetical order. + +Each step takes 60 seconds plus an amount corresponding to its letter: A=1, B=2, C=3, and so on. So, step A takes 60+1=61 seconds, while step Z takes 60+26=86 seconds. No time is required between steps. + +To simplify things for the example, however, suppose you only have help from one Elf (a total of two workers) and that each step takes 60 fewer seconds (so that step A takes 1 second and step Z takes 26 seconds). Then, using the same instructions as above, this is how each second would be spent: + +Second Worker 1 Worker 2 Done + 0 C . + 1 C . + 2 C . + 3 A F C + 4 B F CA + 5 B F CA + 6 D F CAB + 7 D F CAB + 8 D F CAB + 9 D . CABF + 10 E . CABFD + 11 E . CABFD + 12 E . CABFD + 13 E . CABFD + 14 E . CABFD + 15 . . CABFDE + +Each row represents one second of time. The Second column identifies how many seconds have passed as of the beginning of that second. Each worker column shows the step that worker is currently doing (or . if they are idle). The Done column shows completed steps. + +Note that the order of the steps has changed; this is because steps now take time to finish and multiple workers can begin multiple steps simultaneously. + +In this example, it would take 15 seconds for two workers to complete these steps. + +With 5 workers and the 60+ second step durations described above, how long will it take to complete all of the steps? diff --git a/www/statics/aoc/2018/07_input.txt b/www/statics/aoc/2018/07_input.txt new file mode 100644 index 0000000..c2686c7 --- /dev/null +++ b/www/statics/aoc/2018/07_input.txt @@ -0,0 +1,101 @@ +Step T must be finished before step X can begin. +Step G must be finished before step O can begin. +Step X must be finished before step B can begin. +Step I must be finished before step W can begin. +Step N must be finished before step V can begin. +Step K must be finished before step H can begin. +Step S must be finished before step R can begin. +Step P must be finished before step J can begin. +Step L must be finished before step V can begin. +Step D must be finished before step E can begin. +Step J must be finished before step R can begin. +Step U must be finished before step W can begin. +Step M must be finished before step Q can begin. +Step B must be finished before step F can begin. +Step F must be finished before step E can begin. +Step V must be finished before step Q can begin. +Step C must be finished before step A can begin. +Step H must be finished before step Z can begin. +Step A must be finished before step Y can begin. +Step O must be finished before step Y can begin. +Step W must be finished before step Q can begin. +Step E must be finished before step Y can begin. +Step Y must be finished before step Z can begin. +Step Q must be finished before step R can begin. +Step R must be finished before step Z can begin. +Step S must be finished before step E can begin. +Step O must be finished before step W can begin. +Step G must be finished before step B can begin. +Step I must be finished before step N can begin. +Step G must be finished before step I can begin. +Step H must be finished before step R can begin. +Step N must be finished before step C can begin. +Step M must be finished before step W can begin. +Step Y must be finished before step R can begin. +Step T must be finished before step B can begin. +Step G must be finished before step D can begin. +Step J must be finished before step O can begin. +Step I must be finished before step A can begin. +Step J must be finished before step H can begin. +Step T must be finished before step Y can begin. +Step N must be finished before step H can begin. +Step B must be finished before step V can begin. +Step M must be finished before step R can begin. +Step Y must be finished before step Q can begin. +Step X must be finished before step J can begin. +Step A must be finished before step E can begin. +Step P must be finished before step Z can begin. +Step P must be finished before step C can begin. +Step N must be finished before step Q can begin. +Step A must be finished before step O can begin. +Step G must be finished before step X can begin. +Step P must be finished before step U can begin. +Step T must be finished before step S can begin. +Step I must be finished before step V can begin. +Step V must be finished before step H can begin. +Step U must be finished before step F can begin. +Step D must be finished before step Q can begin. +Step D must be finished before step O can begin. +Step G must be finished before step H can begin. +Step I must be finished before step Z can begin. +Step N must be finished before step D can begin. +Step B must be finished before step Y can begin. +Step J must be finished before step M can begin. +Step V must be finished before step Y can begin. +Step W must be finished before step Y can begin. +Step E must be finished before step Z can begin. +Step T must be finished before step N can begin. +Step L must be finished before step U can begin. +Step S must be finished before step A can begin. +Step Q must be finished before step Z can begin. +Step T must be finished before step F can begin. +Step F must be finished before step Z can begin. +Step J must be finished before step C can begin. +Step X must be finished before step Y can begin. +Step K must be finished before step V can begin. +Step T must be finished before step I can begin. +Step I must be finished before step O can begin. +Step C must be finished before step W can begin. +Step B must be finished before step Q can begin. +Step W must be finished before step Z can begin. +Step D must be finished before step H can begin. +Step K must be finished before step A can begin. +Step M must be finished before step E can begin. +Step T must be finished before step U can begin. +Step I must be finished before step J can begin. +Step O must be finished before step Q can begin. +Step M must be finished before step Z can begin. +Step U must be finished before step C can begin. +Step N must be finished before step F can begin. +Step C must be finished before step H can begin. +Step X must be finished before step E can begin. +Step F must be finished before step O can begin. +Step P must be finished before step O can begin. +Step J must be finished before step A can begin. +Step H must be finished before step Y can begin. +Step A must be finished before step Q can begin. +Step V must be finished before step Z can begin. +Step S must be finished before step L can begin. +Step H must be finished before step E can begin. +Step X must be finished before step I can begin. +Step O must be finished before step R can begin. diff --git a/www/statics/aoc/2018/08-1.linq b/www/statics/aoc/2018/08-1.linq new file mode 100644 index 0000000..72d3615 --- /dev/null +++ b/www/statics/aoc/2018/08-1.linq @@ -0,0 +1,29 @@ + + +class Node { public List Children = new List(); public List Metadata = new List(); } + +void Main() +{ + var data = File + .ReadAllText(Path.Combine(Path.GetDirectoryName(Util.CurrentQueryPath), @"08_input.txt")) + .Split(' ') + .Select(int.Parse) + .ToList(); + + int i = 0; + var root = Parse(data, ref i); + + MetaSum(root).Dump(); +} + +private Node Parse(List data, ref int pos) +{ + var qn = data[pos++]; + var qm = data[pos++]; + var n = new Node(); + for (int i = 0; i < qn; i++) n.Children.Add(Parse(data, ref pos)); + for (int i = 0; i < qm; i++) n.Metadata.Add(data[pos++]); + return n; +} + +private int MetaSum(Node n) => n.Metadata.Sum() + n.Children.Select(MetaSum).Sum(); \ No newline at end of file diff --git a/www/statics/aoc/2018/08-2.linq b/www/statics/aoc/2018/08-2.linq new file mode 100644 index 0000000..583ea77 --- /dev/null +++ b/www/statics/aoc/2018/08-2.linq @@ -0,0 +1,31 @@ + + +class Node { public List Children = new List(); public List Metadata = new List(); } + +void Main() +{ + var data = File + .ReadAllText(Path.Combine(Path.GetDirectoryName(Util.CurrentQueryPath), @"08_input.txt")) + .Split(' ') + .Select(int.Parse) + .ToList(); + + int i = 0; + var root = Parse(data, ref i); + + NodeVal(root).Dump(); +} + +private Node Parse(List data, ref int pos) +{ + var qn = data[pos++]; + var qm = data[pos++]; + var n = new Node(); + for (int i = 0; i < qn; i++) n.Children.Add(Parse(data, ref pos)); + for (int i = 0; i < qm; i++) n.Metadata.Add(data[pos++]); + return n; +} + +private int MetaSum(Node n) => n.Metadata.Sum() + n.Children.Select(MetaSum).Sum(); + +private int NodeVal(Node n) => n.Children.Any() ? n.Metadata.Select(i=>i-1).Where(i=>i>=0&&iNodeVal(n.Children[i])).Sum() : n.Metadata.Sum(); \ No newline at end of file diff --git a/www/statics/aoc/2018/08_challenge.txt b/www/statics/aoc/2018/08_challenge.txt new file mode 100644 index 0000000..87405ae --- /dev/null +++ b/www/statics/aoc/2018/08_challenge.txt @@ -0,0 +1,54 @@ +--- 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." + +The navigation system's license file consists of a list of numbers (your puzzle input). The numbers define a data structure which, when processed, produces some kind of tree that can be used to calculate the license number. + +The tree is made up of nodes; a single, outermost node forms the tree's root, and it contains all other nodes in the tree (or contains nodes that contain nodes, and so on). + +Specifically, a node consists of: + + A header, which is always exactly two numbers: + The quantity of child nodes. + The quantity of metadata entries. + Zero or more child nodes (as specified in the header). + One or more metadata entries (as specified in the header). + +Each child node is itself a node that has its own header, child nodes, and metadata. For example: + +2 3 0 3 10 11 12 1 1 0 1 99 2 1 1 2 +A---------------------------------- + B----------- C----------- + D----- + +In this example, each node of the tree is also marked with an underline starting with a letter for easier identification. In it, there are four nodes: + + A, which has 2 child nodes (B, C) and 3 metadata entries (1, 1, 2). + B, which has 0 child nodes and 3 metadata entries (10, 11, 12). + C, which has 1 child node (D) and 1 metadata entry (2). + D, which has 0 child nodes and 1 metadata entry (99). + +The first check done on the license file is to simply add up all of the metadata entries. In this example, that sum is 1+1+2+10+11+12+2+99=138. + +What is the sum of all metadata entries? + +--- Part Two --- + +The second check is slightly more complicated: you need to find the value of the root node (A in the example above). + +The value of a node depends on whether it has child nodes. + +If a node has no child nodes, its value is the sum of its metadata entries. So, the value of node B is 10+11+12=33, and the value of node D is 99. + +However, if a node does have child nodes, the metadata entries become indexes which refer to those child nodes. A metadata entry of 1 refers to the first child node, 2 to the second, 3 to the third, and so on. The value of this node is the sum of the values of the child nodes referenced by the metadata entries. If a referenced child node does not exist, that reference is skipped. A child node can be referenced multiple time and counts each time it is referenced. A metadata entry of 0 does not refer to any child node. + +For example, again using the above nodes: + + Node C has one metadata entry, 2. Because node C has only one child node, 2 references a child node which does not exist, and so the value of node C is 0. + Node A has three metadata entries: 1, 1, and 2. The 1 references node A's first child node, B, and the 2 references node A's second child node, C. Because node B has a value of 33 and node C has a value of 0, the value of node A is 33+33+0=66. + +So, in this example, the value of the root node is 66. + +What is the value of the root node? diff --git a/www/statics/aoc/2018/08_input.txt b/www/statics/aoc/2018/08_input.txt new file mode 100644 index 0000000..e2de6f4 --- /dev/null +++ b/www/statics/aoc/2018/08_input.txt @@ -0,0 +1 @@ +9 11 6 3 5 5 3 5 1 7 0 7 1 5 7 3 2 6 4 2 1 1 1 3 1 1 1 5 0 6 7 5 1 3 3 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8 2 3 1 2 1 3 1 3 2 1 1 3 3 4 5 3 5 1 8 0 6 3 1 2 1 5 5 2 2 2 1 1 3 2 2 1 5 0 8 2 6 9 8 1 3 2 1 1 1 3 2 1 1 8 0 7 2 1 9 7 2 3 1 1 3 1 1 1 1 3 1 1 1 4 2 5 3 4 1 6 0 7 1 3 4 2 1 6 8 1 1 1 3 1 2 1 9 0 10 1 2 6 3 1 5 5 7 6 1 3 2 1 1 3 1 1 2 3 1 8 0 8 4 6 2 1 1 6 3 9 3 3 3 3 3 3 1 2 2 5 3 2 3 4 1 8 0 6 3 1 7 1 8 3 3 3 2 1 2 2 1 1 1 6 0 10 7 7 9 1 2 2 7 6 5 3 1 1 3 3 1 1 1 6 0 7 5 7 9 1 6 4 4 2 3 2 2 1 1 3 1 2 1 4 1 3 1 2 7 5 3 8 11 6 4 3 4 4 6 2 \ No newline at end of file diff --git a/www/statics/aoc/2018/09-1.linq b/www/statics/aoc/2018/09-1.linq new file mode 100644 index 0000000..3e8b1ff --- /dev/null +++ b/www/statics/aoc/2018/09-1.linq @@ -0,0 +1,36 @@ + + +void Main() +{ + var input = File.ReadAllText(Path.Combine(Path.GetDirectoryName(Util.CurrentQueryPath), @"09_input.txt")); + + var players = int.Parse(input.Split(' ')[0]); + var marbles = int.Parse(input.Split(' ')[6]); + + List board = new List { 0 }; + int[] score = new int[players]; + + int curr = 0; + int currplayer = 0; + for (int m = 1; m <= marbles; m++) + { + if (m % 23 != 0) + { + curr = (curr + 2)%board.Count; + board.Insert(curr, m); + } + else + { + score[currplayer] += m; + curr = (board.Count + curr - 7) % board.Count; + score[currplayer] += board[curr]; + board.RemoveAt(curr); + } + + //($"[{currplayer+1:0}]" + string.Join(" ", board.Select((b, i) => i == curr ? $"({b:00})" : $" {b:00} "))).Dump(); + + currplayer = (currplayer + 1) % players; + } + + score.Max().Dump(); +} diff --git a/www/statics/aoc/2018/09-2.linq b/www/statics/aoc/2018/09-2.linq new file mode 100644 index 0000000..8fa6928 --- /dev/null +++ b/www/statics/aoc/2018/09-2.linq @@ -0,0 +1,55 @@ + + +class Marble { public Marble Prev, Next; public int Value; } + +void Main() +{ + var input = File.ReadAllText(Path.Combine(Path.GetDirectoryName(Util.CurrentQueryPath), @"09_input.txt")); + + var players = int.Parse(input.Split(' ')[0]); + var marbles = int.Parse(input.Split(' ')[6]) * 100; + + List board = new List { 0 }; + long[] score = new long[players]; + + Marble curr = new Marble(); + curr.Next = curr; + curr.Prev = curr; + + int currplayer = 0; + Marble old = null; + for (int m = 1; m <= marbles; m++) + { + if (m % 23 != 0) + { + curr = curr.Next; + var nm = old ?? new Marble(); + old=null; + nm.Prev=curr; + nm.Next=curr.Next; + nm.Value=m; + curr.Next.Prev = nm; + curr.Next = nm; + curr = curr.Next; + } + else + { + score[currplayer] += m; + curr = curr.Prev.Prev.Prev.Prev.Prev.Prev; + score[currplayer] += curr.Prev.Value; + + old = curr.Prev; + var c = old.Prev; + c.Next = curr; + curr.Prev=c; + } + + //($"[{currplayer+1:0}]" + string.Join(" ", board.Select((b, i) => i == curr ? $"({b:00})" : $" {b:00} "))).Dump(); + + currplayer = (currplayer + 1) % players; + + Util.Progress = (m * 100) / marbles; + } + + score.Max().Dump(); +} diff --git a/www/statics/aoc/2018/09_challenge.txt b/www/statics/aoc/2018/09_challenge.txt new file mode 100644 index 0000000..52822d4 --- /dev/null +++ b/www/statics/aoc/2018/09_challenge.txt @@ -0,0 +1,58 @@ +--- 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 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. + +First, the marble numbered 0 is placed in the circle. At this point, while it contains only a single marble, it is still a circle: the marble is both clockwise from itself and counter-clockwise from itself. This marble is designated the current marble. + +Then, each Elf takes a turn placing the lowest-numbered remaining marble into the circle between the marbles that are 1 and 2 marbles clockwise of the current marble. (When the circle is large enough, this means that there is one marble between the marble that was just placed and the current marble.) The marble that was just placed then becomes the current marble. + +However, if the marble that is about to be placed has a number which is a multiple of 23, something entirely different happens. First, the current player keeps the marble they would have placed, adding it to their score. In addition, the marble 7 marbles counter-clockwise from the current marble is removed from the circle and also added to the current player's score. The marble located immediately clockwise of the marble that was removed becomes the new current marble. + +For example, suppose there are 9 players. After the marble with value 0 is placed in the middle, each player (shown in square brackets) takes a turn. The result of each of those turns would produce circles of marbles like this, where clockwise is to the right and the resulting current marble is in parentheses: + +[-] (0) +[1] 0 (1) +[2] 0 (2) 1 +[3] 0 2 1 (3) +[4] 0 (4) 2 1 3 +[5] 0 4 2 (5) 1 3 +[6] 0 4 2 5 1 (6) 3 +[7] 0 4 2 5 1 6 3 (7) +[8] 0 (8) 4 2 5 1 6 3 7 +[9] 0 8 4 (9) 2 5 1 6 3 7 +[1] 0 8 4 9 2(10) 5 1 6 3 7 +[2] 0 8 4 9 2 10 5(11) 1 6 3 7 +[3] 0 8 4 9 2 10 5 11 1(12) 6 3 7 +[4] 0 8 4 9 2 10 5 11 1 12 6(13) 3 7 +[5] 0 8 4 9 2 10 5 11 1 12 6 13 3(14) 7 +[6] 0 8 4 9 2 10 5 11 1 12 6 13 3 14 7(15) +[7] 0(16) 8 4 9 2 10 5 11 1 12 6 13 3 14 7 15 +[8] 0 16 8(17) 4 9 2 10 5 11 1 12 6 13 3 14 7 15 +[9] 0 16 8 17 4(18) 9 2 10 5 11 1 12 6 13 3 14 7 15 +[1] 0 16 8 17 4 18 9(19) 2 10 5 11 1 12 6 13 3 14 7 15 +[2] 0 16 8 17 4 18 9 19 2(20)10 5 11 1 12 6 13 3 14 7 15 +[3] 0 16 8 17 4 18 9 19 2 20 10(21) 5 11 1 12 6 13 3 14 7 15 +[4] 0 16 8 17 4 18 9 19 2 20 10 21 5(22)11 1 12 6 13 3 14 7 15 +[5] 0 16 8 17 4 18(19) 2 20 10 21 5 22 11 1 12 6 13 3 14 7 15 +[6] 0 16 8 17 4 18 19 2(24)20 10 21 5 22 11 1 12 6 13 3 14 7 15 +[7] 0 16 8 17 4 18 19 2 24 20(25)10 21 5 22 11 1 12 6 13 3 14 7 15 + +The goal is to be the player with the highest score after the last marble is used up. Assuming the example above ends after the marble numbered 25, the winning score is 23+9=32 (because player 5 kept marble 23 and removed marble 9, while no other player got any points in this very short example game). + +Here are a few more examples: + + 10 players; last marble is worth 1618 points: high score is 8317 + 13 players; last marble is worth 7999 points: high score is 146373 + 17 players; last marble is worth 1104 points: high score is 2764 + 21 players; last marble is worth 6111 points: high score is 54718 + 30 players; last marble is worth 5807 points: high score is 37305 + +What is the winning Elf's score? + +--- Part Two --- + +Amused by the speed of your answer, the Elves are curious: + +What would the new winning Elf's score be if the number of the last marble were 100 times larger? diff --git a/www/statics/aoc/2018/09_input.txt b/www/statics/aoc/2018/09_input.txt new file mode 100644 index 0000000..9d9451b --- /dev/null +++ b/www/statics/aoc/2018/09_input.txt @@ -0,0 +1 @@ +447 players; last marble is worth 71510 points \ No newline at end of file diff --git a/www/statics/aoc/2018/10-1.linq b/www/statics/aoc/2018/10-1.linq new file mode 100644 index 0000000..f78b757 --- /dev/null +++ b/www/statics/aoc/2018/10-1.linq @@ -0,0 +1,56 @@ + + +class P { public int XX, YY, VX, VY; } + +List

input; + +void Main() +{ + input = File + .ReadAllLines(Path.Combine(Path.GetDirectoryName(Util.CurrentQueryPath), @"10_input.txt")) + .Where(p => !string.IsNullOrWhiteSpace(p)) + .Select(l => new P + { + XX=int.Parse(l.Substring(10,6).Trim()), + YY=int.Parse(l.Substring(18,6).Trim()), + VX=int.Parse(l.Substring(36,2).Trim()), + VY=int.Parse(l.Substring(40,2).Trim()), + }) + .ToList(); + + + + for (;;) + { + foreach (var v in input) { v.XX += v.VX; v.YY += v.VY; } + + + if (input.Any(Alone)) continue; + Print(); + + return; + } + +} + +bool Alone(P p) => !input.Any(i => i != p && Math.Abs(i.XX-p.XX)<=1 && Math.Abs(i.YY-p.YY)<=1); + +void Print() +{ + int minX = input.Min(i => i.XX); + int maxX = input.Max(i => i.XX); + int minY = input.Min(i => i.YY); + int maxY = input.Max(i => i.YY); + + var b = new StringBuilder(); + for (int y = minY; y <= maxY; y++) + { + for (int x = minX; x <= maxX; x++) + { + b.Append(input.Any(i => i.XX==x&&i.YY==y)?'#':'.'); + } + b.AppendLine(); + } + b.ToString().Dump(); + +} diff --git a/www/statics/aoc/2018/10-2.linq b/www/statics/aoc/2018/10-2.linq new file mode 100644 index 0000000..d6d6358 --- /dev/null +++ b/www/statics/aoc/2018/10-2.linq @@ -0,0 +1,56 @@ + + +class P { public int XX, YY, VX, VY; } + +List

input; + +void Main() +{ + input = File + .ReadAllLines(Path.Combine(Path.GetDirectoryName(Util.CurrentQueryPath), @"10_input.txt")) + .Where(p => !string.IsNullOrWhiteSpace(p)) + .Select(l => new P + { + XX = int.Parse(l.Substring(10, 6).Trim()), + YY = int.Parse(l.Substring(18, 6).Trim()), + VX = int.Parse(l.Substring(36, 2).Trim()), + VY = int.Parse(l.Substring(40, 2).Trim()), + }) + .ToList(); + + + + for (int i = 1; ; i++) + { + foreach (var v in input) { v.XX += v.VX; v.YY += v.VY; } + + + if (input.Any(Alone)) continue; + //Print(); + i.Dump(); + return; + } + +} + +bool Alone(P p) => !input.Any(i => i != p && Math.Abs(i.XX - p.XX) <= 1 && Math.Abs(i.YY - p.YY) <= 1); + +void Print() +{ + int minX = input.Min(i => i.XX); + int maxX = input.Max(i => i.XX); + int minY = input.Min(i => i.YY); + int maxY = input.Max(i => i.YY); + + var b = new StringBuilder(); + for (int y = minY; y <= maxY; y++) + { + for (int x = minX; x <= maxX; x++) + { + b.Append(input.Any(i => i.XX == x && i.YY == y) ? '#' : '.'); + } + b.AppendLine(); + } + b.ToString().Dump(); + +} diff --git a/www/statics/aoc/2018/10_challenge.txt b/www/statics/aoc/2018/10_challenge.txt new file mode 100644 index 0000000..56d3acb --- /dev/null +++ b/www/statics/aoc/2018/10_challenge.txt @@ -0,0 +1,149 @@ +--- 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. + +You can see these points of light floating in the distance, and record their position in the sky and their velocity, the relative change in position per second (your puzzle input). The coordinates are all given from your perspective; given enough time, those positions and velocities will move the points into a cohesive message! + +Rather than wait, you decide to fast-forward the process and calculate what the points will eventually spell. + +For example, suppose you note the following points: + +position=< 9, 1> velocity=< 0, 2> +position=< 7, 0> velocity=<-1, 0> +position=< 3, -2> velocity=<-1, 1> +position=< 6, 10> velocity=<-2, -1> +position=< 2, -4> velocity=< 2, 2> +position=<-6, 10> velocity=< 2, -2> +position=< 1, 8> velocity=< 1, -1> +position=< 1, 7> velocity=< 1, 0> +position=<-3, 11> velocity=< 1, -2> +position=< 7, 6> velocity=<-1, -1> +position=<-2, 3> velocity=< 1, 0> +position=<-4, 3> velocity=< 2, 0> +position=<10, -3> velocity=<-1, 1> +position=< 5, 11> velocity=< 1, -2> +position=< 4, 7> velocity=< 0, -1> +position=< 8, -2> velocity=< 0, 1> +position=<15, 0> velocity=<-2, 0> +position=< 1, 6> velocity=< 1, 0> +position=< 8, 9> velocity=< 0, -1> +position=< 3, 3> velocity=<-1, 1> +position=< 0, 5> velocity=< 0, -1> +position=<-2, 2> velocity=< 2, 0> +position=< 5, -2> velocity=< 1, 2> +position=< 1, 4> velocity=< 2, 1> +position=<-2, 7> velocity=< 2, -2> +position=< 3, 6> velocity=<-1, -1> +position=< 5, 0> velocity=< 1, 0> +position=<-6, 0> velocity=< 2, 0> +position=< 5, 9> velocity=< 1, -2> +position=<14, 7> velocity=<-2, 0> +position=<-3, 6> velocity=< 2, -1> + +Each line represents one point. Positions are given as pairs: X represents how far left (negative) or right (positive) the point appears, while Y represents how far up (negative) or down (positive) the point appears. + +At 0 seconds, each point has the position given. Each second, each point's velocity is added to its position. So, a point with velocity <1, -2> is moving to the right, but is moving upward twice as quickly. If this point's initial position were <3, 9>, after 3 seconds, its position would become <6, 3>. + +Over time, the points listed above would move like this: + +Initially: +........#............. +................#..... +.........#.#..#....... +...................... +#..........#.#.......# +...............#...... +....#................. +..#.#....#............ +.......#.............. +......#............... +...#...#.#...#........ +....#..#..#.........#. +.......#.............. +...........#..#....... +#...........#......... +...#.......#.......... + +After 1 second: +...................... +...................... +..........#....#...... +........#.....#....... +..#.........#......#.. +...................... +......#............... +....##.........#...... +......#.#............. +.....##.##..#......... +........#.#........... +........#...#.....#... +..#...........#....... +....#.....#.#......... +...................... +...................... + +After 2 seconds: +...................... +...................... +...................... +..............#....... +....#..#...####..#.... +...................... +........#....#........ +......#.#............. +.......#...#.......... +.......#..#..#.#...... +....#....#.#.......... +.....#...#...##.#..... +........#............. +...................... +...................... +...................... + +After 3 seconds: +...................... +...................... +...................... +...................... +......#...#..###...... +......#...#...#....... +......#...#...#....... +......#####...#....... +......#...#...#....... +......#...#...#....... +......#...#...#....... +......#...#..###...... +...................... +...................... +...................... +...................... + +After 4 seconds: +...................... +...................... +...................... +............#......... +........##...#.#...... +......#.....#..#...... +.....#..##.##.#....... +.......##.#....#...... +...........#....#..... +..............#....... +....#......#...#...... +.....#.....##......... +...............#...... +...............#...... +...................... +...................... + +After 3 seconds, the message appeared briefly: HI. Of course, your message will be much longer and will take many more seconds to appear. + +What message will eventually appear in the sky? + +--- Part Two --- + +Good thing you didn't have to wait, because that would have taken a long time - much longer than the 3 seconds in the example above. + +Impressed by your sub-hour communication capabilities, the Elves are curious: exactly how many seconds would they have needed to wait for that message to appear? diff --git a/www/statics/aoc/2018/10_input.txt b/www/statics/aoc/2018/10_input.txt new file mode 100644 index 0000000..efd33b4 --- /dev/null +++ b/www/statics/aoc/2018/10_input.txt @@ -0,0 +1,337 @@ +position=< 21518, -21209> velocity=<-2, 2> +position=< 10842, 21423> velocity=<-1, -2> +position=< 32189, -21209> velocity=<-3, 2> +position=<-21158, -21218> velocity=< 2, 2> +position=<-31794, -53194> velocity=< 3, 5> +position=<-42469, 42743> velocity=< 4, -4> +position=<-53120, -31873> velocity=< 5, 3> +position=< 32177, -42536> velocity=<-3, 4> +position=< 53505, 32084> velocity=<-5, -3> +position=<-53091, 10764> velocity=< 5, -1> +position=<-53141, -21211> velocity=< 5, 2> +position=<-42429, 10764> velocity=< 4, -1> +position=<-10492, -31873> velocity=< 1, 3> +position=< 42819, -10550> velocity=<-4, 1> +position=<-53096, -10551> velocity=< 5, 1> +position=<-10492, -42536> velocity=< 1, 4> +position=<-10508, 42739> velocity=< 1, -4> +position=<-10471, -42533> velocity=< 1, 4> +position=< 53446, 32086> velocity=<-5, -3> +position=< 10820, -53195> velocity=<-1, 5> +position=< 10858, 21423> velocity=<-1, -2> +position=<-31810, -10553> velocity=< 3, 1> +position=<-10492, 32077> velocity=< 1, -3> +position=<-31799, -42527> velocity=< 3, 4> +position=<-10484, 42738> velocity=< 1, -4> +position=< 10862, 10767> velocity=<-1, -1> +position=<-10503, 10759> velocity=< 1, -1> +position=<-21130, 32081> velocity=< 2, -3> +position=<-42477, -31877> velocity=< 4, 3> +position=<-10452, -42530> velocity=< 1, 4> +position=<-10452, 53399> velocity=< 1, -5> +position=<-31826, 42744> velocity=< 3, -4> +position=<-42444, -10556> velocity=< 4, 1> +position=< 42824, -31873> velocity=<-4, 3> +position=<-10492, 32082> velocity=< 1, -3> +position=<-53092, 10759> velocity=< 5, -1> +position=< 21522, 42745> velocity=<-2, -4> +position=< 53474, -42532> velocity=<-5, 4> +position=<-31822, 42737> velocity=< 3, -4> +position=< 32131, -42529> velocity=<-3, 4> +position=<-10476, -53193> velocity=< 1, 5> +position=< 21473, -10551> velocity=<-2, 1> +position=<-10497, 21422> velocity=< 1, -2> +position=< 21469, 42741> velocity=<-2, -4> +position=< 21470, 10763> velocity=<-2, -1> +position=<-31807, 32086> velocity=< 3, -3> +position=< 32144, 32078> velocity=<-3, -3> +position=<-53120, -42531> velocity=< 5, 4> +position=<-31773, -31871> velocity=< 3, 3> +position=<-31800, -21218> velocity=< 3, 2> +position=< 53478, -21213> velocity=<-5, 2> +position=< 21498, 21424> velocity=<-2, -2> +position=< 42798, 32081> velocity=<-4, -3> +position=< 42790, 10761> velocity=<-4, -1> +position=<-31778, -10558> velocity=< 3, 1> +position=<-21106, 21418> velocity=< 2, -2> +position=<-31785, 53401> velocity=< 3, -5> +position=< 53497, -42536> velocity=<-5, 4> +position=< 53491, -42535> velocity=<-5, 4> +position=<-21115, -21218> velocity=< 2, 2> +position=< 53478, 53401> velocity=<-5, -5> +position=< 10835, 32077> velocity=<-1, -3> +position=<-10500, 21421> velocity=< 1, -2> +position=<-53142, -21212> velocity=< 5, 2> +position=<-10490, -31868> velocity=< 1, 3> +position=< 53506, 21419> velocity=<-5, -2> +position=< 21517, 10764> velocity=<-2, -1> +position=< 32136, 32082> velocity=<-3, -3> +position=<-42485, -42536> velocity=< 4, 4> +position=< 10821, -53195> velocity=<-1, 5> +position=<-42445, -10551> velocity=< 4, 1> +position=<-10473, -21214> velocity=< 1, 2> +position=< 42806, -53186> velocity=<-4, 5> +position=< 42791, 10767> velocity=<-4, -1> +position=<-53144, 32083> velocity=< 5, -3> +position=<-53096, 53402> velocity=< 5, -5> +position=<-21119, 42738> velocity=< 2, -4> +position=< 42824, 53404> velocity=<-4, -5> +position=< 21495, 32081> velocity=<-2, -3> +position=<-31782, 21421> velocity=< 3, -2> +position=<-21157, -31873> velocity=< 2, 3> +position=< 53478, 32083> velocity=<-5, -3> +position=< 53470, 53398> velocity=<-5, -5> +position=< 42797, 21422> velocity=<-4, -2> +position=<-21143, -31877> velocity=< 2, 3> +position=< 32144, -21216> velocity=<-3, 2> +position=<-10482, 32086> velocity=< 1, -3> +position=< 42831, -21216> velocity=<-4, 2> +position=<-42448, 53397> velocity=< 4, -5> +position=<-21135, -21213> velocity=< 2, 2> +position=< 42806, 32086> velocity=<-4, -3> +position=< 42805, 53404> velocity=<-4, -5> +position=<-53096, 32080> velocity=< 5, -3> +position=< 32155, 32077> velocity=<-3, -3> +position=< 53463, -10550> velocity=<-5, 1> +position=< 53475, 42737> velocity=<-5, -4> +position=< 21470, -31873> velocity=<-2, 3> +position=<-10452, -10550> velocity=< 1, 1> +position=< 10850, 21427> velocity=<-1, -2> +position=< 10854, 53398> velocity=<-1, -5> +position=<-10500, 53395> velocity=< 1, -5> +position=< 21497, 10759> velocity=<-2, -1> +position=< 32155, -42527> velocity=<-3, 4> +position=< 53505, -42534> velocity=<-5, 4> +position=<-21142, 53404> velocity=< 2, -5> +position=< 32176, -53193> velocity=<-3, 5> +position=<-42437, -53193> velocity=< 4, 5> +position=<-21163, 53396> velocity=< 2, -5> +position=< 32128, -42531> velocity=<-3, 4> +position=< 42798, -53195> velocity=<-4, 5> +position=< 42829, 32081> velocity=<-4, -3> +position=< 21510, -53192> velocity=<-2, 5> +position=<-53108, -21214> velocity=< 5, 2> +position=<-21124, 53399> velocity=< 2, -5> +position=<-21108, -31875> velocity=< 2, 3> +position=<-31794, 10768> velocity=< 3, -1> +position=< 10842, 21426> velocity=<-1, -2> +position=<-53142, 21424> velocity=< 5, -2> +position=<-42476, 53399> velocity=< 4, -5> +position=< 42816, -10554> velocity=<-4, 1> +position=< 32179, 42741> velocity=<-3, -4> +position=< 32171, 32081> velocity=<-3, -3> +position=<-10503, 32077> velocity=< 1, -3> +position=< 42813, 42745> velocity=<-4, -4> +position=< 21485, 42736> velocity=<-2, -4> +position=<-42444, 10762> velocity=< 4, -1> +position=<-31789, -53187> velocity=< 3, 5> +position=<-10480, 32077> velocity=< 1, -3> +position=< 32128, -10556> velocity=<-3, 1> +position=< 10858, -31869> velocity=<-1, 3> +position=<-53144, -42532> velocity=< 5, 4> +position=<-42461, -21215> velocity=< 4, 2> +position=<-42457, -10550> velocity=< 4, 1> +position=< 32186, 32083> velocity=<-3, -3> +position=<-42440, 53403> velocity=< 4, -5> +position=<-21130, 21419> velocity=< 2, -2> +position=< 42819, -21216> velocity=<-4, 2> +position=<-31810, -31874> velocity=< 3, 3> +position=<-53120, 32080> velocity=< 5, -3> +position=< 32178, -42536> velocity=<-3, 4> +position=< 21509, -31876> velocity=<-2, 3> +position=<-42436, -31868> velocity=< 4, 3> +position=<-42432, -21211> velocity=< 4, 2> +position=<-21155, 21422> velocity=< 2, -2> +position=<-53111, -42532> velocity=< 5, 4> +position=< 42819, -53188> velocity=<-4, 5> +position=<-21147, -21209> velocity=< 2, 2> +position=< 42840, 42741> velocity=<-4, -4> +position=<-31782, 32079> velocity=< 3, -3> +position=<-42448, -31871> velocity=< 4, 3> +position=< 21501, 53398> velocity=<-2, -5> +position=<-31797, 21426> velocity=< 3, -2> +position=<-42448, 53402> velocity=< 4, -5> +position=<-53110, -21214> velocity=< 5, 2> +position=< 32179, 32086> velocity=<-3, -3> +position=<-21138, 32080> velocity=< 2, -3> +position=< 10871, 32086> velocity=<-1, -3> +position=< 53470, 32082> velocity=<-5, -3> +position=<-53141, -53193> velocity=< 5, 5> +position=< 53462, -31868> velocity=<-5, 3> +position=<-21116, -42531> velocity=< 2, 4> +position=<-31782, -21212> velocity=< 3, 2> +position=<-42477, -31874> velocity=< 4, 3> +position=< 42836, -21218> velocity=<-4, 2> +position=<-31826, -53193> velocity=< 3, 5> +position=< 10818, 42740> velocity=<-1, -4> +position=< 53503, 10763> velocity=<-5, -1> +position=<-21109, -21215> velocity=< 2, 2> +position=<-21143, 53403> velocity=< 2, -5> +position=<-53120, 32078> velocity=< 5, -3> +position=<-31794, -10550> velocity=< 3, 1> +position=<-42473, 42740> velocity=< 4, -4> +position=<-31782, 53398> velocity=< 3, -5> +position=<-53120, -21218> velocity=< 5, 2> +position=<-53119, 53399> velocity=< 5, -5> +position=<-10500, 53404> velocity=< 1, -5> +position=< 53503, 53399> velocity=<-5, -5> +position=< 21498, 53396> velocity=<-2, -5> +position=<-31766, 42737> velocity=< 3, -4> +position=< 32138, -42532> velocity=<-3, 4> +position=< 32133, -10559> velocity=<-3, 1> +position=< 53505, 42738> velocity=<-5, -4> +position=< 21518, 21418> velocity=<-2, -2> +position=<-53144, 53399> velocity=< 5, -5> +position=<-31810, -42535> velocity=< 3, 4> +position=<-53099, -53187> velocity=< 5, 5> +position=<-31805, -42527> velocity=< 3, 4> +position=< 21478, 42740> velocity=<-2, -4> +position=< 53506, 53403> velocity=<-5, -5> +position=<-21165, -42533> velocity=< 2, 4> +position=< 10850, -21217> velocity=<-1, 2> +position=<-21143, -42528> velocity=< 2, 4> +position=<-31769, 42740> velocity=< 3, -4> +position=<-53088, -21211> velocity=< 5, 2> +position=<-53119, -31868> velocity=< 5, 3> +position=<-42448, 32084> velocity=< 4, -3> +position=<-53096, -31872> velocity=< 5, 3> +position=<-53091, -53186> velocity=< 5, 5> +position=< 42787, 10760> velocity=<-4, -1> +position=< 10861, 21427> velocity=<-1, -2> +position=< 53446, 53402> velocity=<-5, -5> +position=< 42832, 10759> velocity=<-4, -1> +position=< 21485, -42535> velocity=<-2, 4> +position=<-10482, -42532> velocity=< 1, 4> +position=< 53483, -53194> velocity=<-5, 5> +position=< 10835, -31868> velocity=<-1, 3> +position=< 53507, -10550> velocity=<-5, 1> +position=< 42815, 32077> velocity=<-4, -3> +position=< 10847, -42533> velocity=<-1, 4> +position=<-42448, 32084> velocity=< 4, -3> +position=<-21117, 32086> velocity=< 2, -3> +position=<-21167, 42742> velocity=< 2, -4> +position=<-31826, 21427> velocity=< 3, -2> +position=< 32181, 42745> velocity=<-3, -4> +position=< 32136, 10766> velocity=<-3, -1> +position=<-21138, 32085> velocity=< 2, -3> +position=< 21501, -21218> velocity=<-2, 2> +position=< 21510, -10557> velocity=<-2, 1> +position=<-31777, 21427> velocity=< 3, -2> +position=<-53084, 21426> velocity=< 5, -2> +position=<-31810, 21426> velocity=< 3, -2> +position=<-31797, -10556> velocity=< 3, 1> +position=<-31794, 42744> velocity=< 3, -4> +position=<-31773, -42529> velocity=< 3, 4> +position=< 10818, 32084> velocity=<-1, -3> +position=<-21149, -21209> velocity=< 2, 2> +position=< 10855, 32078> velocity=<-1, -3> +position=< 32186, -21215> velocity=<-3, 2> +position=< 53454, 42743> velocity=<-5, -4> +position=< 21530, 10759> velocity=<-2, -1> +position=< 42795, 53404> velocity=<-4, -5> +position=< 21522, 32078> velocity=<-2, -3> +position=<-21111, -42535> velocity=< 2, 4> +position=<-31826, 32079> velocity=< 3, -3> +position=<-21133, 10763> velocity=< 2, -1> +position=<-10499, 32077> velocity=< 1, -3> +position=< 32170, -21213> velocity=<-3, 2> +position=<-53096, 10765> velocity=< 5, -1> +position=< 42839, -10554> velocity=<-4, 1> +position=<-53101, 53400> velocity=< 5, -5> +position=<-31782, -21212> velocity=< 3, 2> +position=<-10508, -10556> velocity=< 1, 1> +position=<-53142, -31874> velocity=< 5, 3> +position=< 53479, 53399> velocity=<-5, -5> +position=<-31818, -31871> velocity=< 3, 3> +position=<-31789, -21217> velocity=< 3, 2> +position=< 32186, 10765> velocity=<-3, -1> +position=<-42427, -21215> velocity=< 4, 2> +position=<-21157, 10759> velocity=< 2, -1> +position=<-10448, 42737> velocity=< 1, -4> +position=< 21493, -10550> velocity=<-2, 1> +position=< 42819, -10557> velocity=<-4, 1> +position=< 42830, 10764> velocity=<-4, -1> +position=<-31794, -21211> velocity=< 3, 2> +position=<-21139, -10555> velocity=< 2, 1> +position=<-42441, 10766> velocity=< 4, -1> +position=< 32176, 42740> velocity=<-3, -4> +position=< 32136, 53401> velocity=<-3, -5> +position=<-10484, 42737> velocity=< 1, -4> +position=<-21138, 32079> velocity=< 2, -3> +position=<-10508, 10759> velocity=< 1, -1> +position=< 21522, 53396> velocity=<-2, -5> +position=<-31818, 21419> velocity=< 3, -2> +position=< 10867, -21213> velocity=<-1, 2> +position=< 21469, 21424> velocity=<-2, -2> +position=< 32139, -53191> velocity=<-3, 5> +position=< 42819, -21214> velocity=<-4, 2> +position=< 42803, -42534> velocity=<-4, 4> +position=< 10847, 53398> velocity=<-1, -5> +position=<-42437, -42528> velocity=< 4, 4> +position=< 21521, -42531> velocity=<-2, 4> +position=< 42835, 32080> velocity=<-4, -3> +position=<-10503, 21427> velocity=< 1, -2> +position=<-21167, -42527> velocity=< 2, 4> +position=< 21521, 32077> velocity=<-2, -3> +position=<-10484, -10553> velocity=< 1, 1> +position=<-10452, -42529> velocity=< 1, 4> +position=< 10847, -21213> velocity=<-1, 2> +position=< 53470, 21419> velocity=<-5, -2> +position=< 10862, -10551> velocity=<-1, 1> +position=<-42469, -31868> velocity=< 4, 3> +position=< 10838, -10550> velocity=<-1, 1> +position=< 32152, -42527> velocity=<-3, 4> +position=< 32176, 53401> velocity=<-3, -5> +position=<-31825, -10554> velocity=< 3, 1> +position=<-21167, -42528> velocity=< 2, 4> +position=<-21115, -31872> velocity=< 2, 3> +position=< 10866, -21217> velocity=<-1, 2> +position=< 21506, -10555> velocity=<-2, 1> +position=<-21143, 53399> velocity=< 2, -5> +position=<-10471, -31877> velocity=< 1, 3> +position=<-10508, 32085> velocity=< 1, -3> +position=< 10866, -10550> velocity=<-1, 1> +position=<-53088, -31877> velocity=< 5, 3> +position=<-10495, 10759> velocity=< 1, -1> +position=< 10847, 21418> velocity=<-1, -2> +position=<-10484, 42743> velocity=< 1, -4> +position=< 10818, 10764> velocity=<-1, -1> +position=< 32155, 42740> velocity=<-3, -4> +position=< 42787, 21423> velocity=<-4, -2> +position=< 53490, 21425> velocity=<-5, -2> +position=<-42448, 10764> velocity=< 4, -1> +position=<-21119, 53396> velocity=< 2, -5> +position=< 21528, -21211> velocity=<-2, 2> +position=< 53502, 10762> velocity=<-5, -1> +position=< 42820, -31873> velocity=<-4, 3> +position=< 21481, 53395> velocity=<-2, -5> +position=<-10468, -42527> velocity=< 1, 4> +position=< 32130, -21212> velocity=<-3, 2> +position=< 32181, -10554> velocity=<-3, 1> +position=< 32184, 53395> velocity=<-3, -5> +position=< 10851, -53188> velocity=<-1, 5> +position=< 21477, 42736> velocity=<-2, -4> +position=<-21159, 21426> velocity=< 2, -2> +position=<-31773, 10767> velocity=< 3, -1> +position=< 42827, 32077> velocity=<-4, -3> +position=<-31818, -21210> velocity=< 3, 2> +position=< 53458, -21218> velocity=<-5, 2> +position=<-10452, 42740> velocity=< 1, -4> +position=<-53142, -21215> velocity=< 5, 2> +position=< 10826, 53398> velocity=<-1, -5> +position=<-21166, 42741> velocity=< 2, -4> +position=<-42469, -53187> velocity=< 4, 5> +position=< 32173, 10768> velocity=<-3, -1> +position=< 53497, 10759> velocity=<-5, -1> +position=< 53449, -10557> velocity=<-5, 1> +position=< 32170, -53190> velocity=<-3, 5> +position=< 42843, -53187> velocity=<-4, 5> +position=< 10852, 32081> velocity=<-1, -3> +position=<-10499, 53395> velocity=< 1, -5> +position=< 21496, -53195> velocity=<-2, 5> +position=< 32157, 32084> velocity=<-3, -3> +position=< 42831, 10765> velocity=<-4, -1> +position=< 21498, -10556> velocity=<-2, 1> +position=< 42843, -53193> velocity=<-4, 5> +position=< 42811, -53189> velocity=<-4, 5> +position=<-42477, 53397> velocity=< 4, -5> diff --git a/www/statics/aoc/2018/11-1.linq b/www/statics/aoc/2018/11-1.linq new file mode 100644 index 0000000..6077e70 --- /dev/null +++ b/www/statics/aoc/2018/11-1.linq @@ -0,0 +1,20 @@ + + +public int serial_num; + +void Main() +{ + serial_num = int.Parse(File.ReadAllText(Path.Combine(Path.GetDirectoryName(Util.CurrentQueryPath), @"11_input.txt"))); + + Enumerable + .Range(1, 300-3) + .SelectMany(x => Enumerable.Range(1, 300-3).Select(y => new {X=x, Y=y, Pow=SPow(x, y) })) + .OrderByDescending(p => p.Pow) + .Select(p => $"{p.X},{p.Y}") + .First() + .Dump(); +} + +int Pow(int x, int y) => (((x + 10) * ((x + 10) * y + serial_num) / 100) % 10) - 5; + +int SPow(int x, int y) => Enumerable.Range(0, 9).Sum(v => Pow(x+v%3, y+v/3)); diff --git a/www/statics/aoc/2018/11-2.linq b/www/statics/aoc/2018/11-2.linq new file mode 100644 index 0000000..9d30508 --- /dev/null +++ b/www/statics/aoc/2018/11-2.linq @@ -0,0 +1,34 @@ + + +int serial_num = int.Parse(File.ReadAllText(Path.Combine(Path.GetDirectoryName(Util.CurrentQueryPath), @"11_input.txt"))); + + +int[,] scache = new int[301, 301]; +for (int x = 1; x <= 300; x++) for (int y = 1; y <= 300; y++) scache[x, y] = (((x + 10) * ((x + 10) * y + serial_num) / 100) % 10) - 5; + +int[,] cache = new int[301, 301]; +for (int x = 1; x <= 300; x++) for (int y = 1; y <= 300; y++) cache[x, y] = 0; + +var max = (pow:0, x:0,y:0,s:0); + +for (int s = 1; s <= 300; s++) +{ + for (int x = 1; x <= 1+ 300-s; x++) + { + for (int y = 1; y <= 1 + 300 - s; y++) + { + + var v = cache[x, y]; + for (int ix = 0; ix < s; ix++) v += scache[x + ix, y + s - 1]; + for (int iy = 0; iy < s-1; iy++) v += scache[x + s - 1, y + iy]; + + cache[x,y]=v; + + if (v > max.pow) max = (v,x,y,s); + } + } + + Util.Progress = (s*100)/300; +} + +$"{max.x},{max.y},{max.s}".Dump(); \ No newline at end of file diff --git a/www/statics/aoc/2018/11_challenge.txt b/www/statics/aoc/2018/11_challenge.txt new file mode 100644 index 0000000..2c452e7 --- /dev/null +++ b/www/statics/aoc/2018/11_challenge.txt @@ -0,0 +1,70 @@ +--- 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. + +The low fuel warning light is illuminated on your wrist-mounted device. Tapping it once causes it to project a hologram of the situation: a 300x300 grid of fuel cells and their current power levels, some negative. You're not sure what negative power means in the context of time travel, but it can't be good. + +Each fuel cell has a coordinate ranging from 1 to 300 in both the X (horizontal) and Y (vertical) direction. In X,Y notation, the top-left cell is 1,1, and the top-right cell is 300,1. + +The interface lets you select any 3x3 square of fuel cells. To increase your chances of getting to your destination, you decide to choose the 3x3 square with the largest total power. + +The power level in a given fuel cell can be found through the following process: + + Find the fuel cell's rack ID, which is its X coordinate plus 10. + Begin with a power level of the rack ID times the Y coordinate. + Increase the power level by the value of the grid serial number (your puzzle input). + Set the power level to itself multiplied by the rack ID. + Keep only the hundreds digit of the power level (so 12345 becomes 3; numbers with no hundreds digit become 0). + Subtract 5 from the power level. + +For example, to find the power level of the fuel cell at 3,5 in a grid with serial number 8: + + The rack ID is 3 + 10 = 13. + The power level starts at 13 * 5 = 65. + Adding the serial number produces 65 + 8 = 73. + Multiplying by the rack ID produces 73 * 13 = 949. + The hundreds digit of 949 is 9. + Subtracting 5 produces 9 - 5 = 4. + +So, the power level of this fuel cell is 4. + +Here are some more example power levels: + + Fuel cell at 122,79, grid serial number 57: power level -5. + Fuel cell at 217,196, grid serial number 39: power level 0. + Fuel cell at 101,153, grid serial number 71: power level 4. + +Your goal is to find the 3x3 square which has the largest total power. The square must be entirely within the 300x300 grid. Identify this square using the X,Y coordinate of its top-left fuel cell. For example: + +For grid serial number 18, the largest total 3x3 square has a top-left corner of 33,45 (with a total power of 29); these fuel cells appear in the middle of this 5x5 region: + +-2 -4 4 4 4 +-4 4 4 4 -5 + 4 3 3 4 -4 + 1 1 2 4 -3 +-1 0 2 -5 -2 + +For grid serial number 42, the largest 3x3 square's top-left is 21,61 (with a total power of 30); they are in the middle of this region: + +-3 4 2 2 2 +-4 4 3 3 4 +-5 3 3 4 -4 + 4 3 3 4 -3 + 3 3 3 -5 -1 + +What is the X,Y coordinate of the top-left fuel cell of the 3x3 square with the largest total power? + +--- Part Two --- + +You discover a dial on the side of the device; it seems to let you select a square of any size, not just 3x3. Sizes from 1x1 to 300x300 are supported. + +Realizing this, you now must find the square of any size with the largest total power. Identify this square by including its size as a third parameter after the top-left coordinate: a 9x9 square with a top-left corner of 3,5 is identified as 3,5,9. + +For example: + + For grid serial number 18, the largest total square (with a total power of 113) is 16x16 and has a top-left corner of 90,269, so its identifier is 90,269,16. + For grid serial number 42, the largest total square (with a total power of 119) is 12x12 and has a top-left corner of 232,251, so its identifier is 232,251,12. + +What is the X,Y,size identifier of the square with the largest total power? diff --git a/www/statics/aoc/2018/11_input.txt b/www/statics/aoc/2018/11_input.txt new file mode 100644 index 0000000..cb4b5f6 --- /dev/null +++ b/www/statics/aoc/2018/11_input.txt @@ -0,0 +1 @@ +1723 \ No newline at end of file diff --git a/www/statics/aoc/2018/12-1.linq b/www/statics/aoc/2018/12-1.linq new file mode 100644 index 0000000..7c87a3b --- /dev/null +++ b/www/statics/aoc/2018/12-1.linq @@ -0,0 +1,44 @@ + + +var input_initial = File.ReadAllLines(Path.Combine(Path.GetDirectoryName(Util.CurrentQueryPath), @"12_input.txt"))[0].Substring(15).Select(p=>p=='#'?1:0).ToArray(); +var input_rules = File + .ReadAllLines(Path.Combine(Path.GetDirectoryName(Util.CurrentQueryPath), @"12_input.txt")) + .Skip(1) + .Where(p => !string.IsNullOrWhiteSpace(p)) + .Select( p => ( p.Split(' ')[0].Select(q=>q=='#'?1:0).ToArray() , p.Split(' ')[2][0]=='#'?1:0 ) ) + .Select( p => ( p.Item1.Reverse().Select((u,i)=>(u<s|t) , p.Item2 ) ) + .OrderBy(p => p.Item1) + .Select(p => p.Item2) + .ToArray(); + +int LEN = 2 * 20 + input_initial.Length + 2 * 20; +int OFF = LEN / 2 - input_initial.Length / 2; + +int[] pots = new int[LEN]; +int[] ipots = new int[LEN]; + +//input_initial.Dump(); +//input_rules.Dump(); + +for (int i = 0; i < input_initial.Length; i++) pots[i+OFF]=input_initial[i]; + +int[] rules = new int[OFF*2+100]; +for (int gen = 0; gen < 20; gen++) +{ + //string.Join("", rules.Select(p => p + "")).Dump(); + ($"{gen:00}: "+string.Join("", pots.Select(p => (p == 0) ? "." : "#"))).Dump(); + + for (int p = 2; p < pots.Length-2; p++) + { + var rule = (pots[p - 2] << 4) | (pots[p - 1] << 3) | (pots[p - 0] << 2) | (pots[p + 1] << 1) | (pots[p + 2] << 0); + + rules[p]=rule; + ipots[p]=input_rules[rule]; + } + for (int p = 0, q = 0; p < pots.Length; pots[p++] = ipots[q++]) ; +} +($"{20:00}: " + string.Join("", pots.Select(p => (p == 0) ? "." : "#"))).Dump(); + +"".Dump(); + +pots.Select((p,i) => (p,i-OFF)).Where(p => p.p>0).Sum(p=>p.Item2).Dump(); \ No newline at end of file diff --git a/www/statics/aoc/2018/12-2.linq b/www/statics/aoc/2018/12-2.linq new file mode 100644 index 0000000..32beaec --- /dev/null +++ b/www/statics/aoc/2018/12-2.linq @@ -0,0 +1,60 @@ + + +var input_initial = File.ReadAllLines(Path.Combine(Path.GetDirectoryName(Util.CurrentQueryPath), @"12_input.txt"))[0].Substring(15).Select(p => p == '#' ? 1 : 0).ToArray(); +var input_rules = File + .ReadAllLines(Path.Combine(Path.GetDirectoryName(Util.CurrentQueryPath), @"12_input.txt")) + .Skip(1) + .Where(p => !string.IsNullOrWhiteSpace(p)) + .Select(p => (p.Split(' ')[0].Select(q => q == '#' ? 1 : 0).ToArray(), p.Split(' ')[2][0] == '#' ? 1 : 0)) + .Select(p => (p.Item1.Reverse().Select((u, i) => (u << i)).Aggregate((s, t) => s | t), p.Item2)) + .OrderBy(p => p.Item1) + .Select(p => p.Item2) + .ToArray(); + +int LEN = 2 * 2000 + input_initial.Length + 2 * 2000; +int OFF = LEN / 2 - input_initial.Length / 2; + +int[] pots = new int[LEN]; +int[] ipots = new int[LEN]; + +//input_initial.Dump(); +//input_rules.Dump(); + +for (int i = 0; i < input_initial.Length; i++) pots[i + OFF] = input_initial[i]; + + +int hashOffset = 0; +string lastHash = ""; + +for (long gen = 0; gen < 50000000000L; gen++) +{ + for (int p = 2; p < pots.Length - 2; p++) + { + var rule = (pots[p - 2] << 4) | (pots[p - 1] << 3) | (pots[p - 0] << 2) | (pots[p + 1] << 1) | (pots[p + 2] << 0); + + ipots[p] = input_rules[rule]; + } + for (int p = 0, q = 0; p < pots.Length; pots[p++] = ipots[q++]); + + var currHash = string.Join("", pots.SkipWhile(p => p == 0).Reverse().SkipWhile(p => p == 0).Select(p => p.ToString())); + if (currHash == lastHash) + { + checked + { + var hashOffsetNew = pots.TakeWhile(p => p == 0).Count(); + var drift = (hashOffsetNew - hashOffset); + + var score_curr = pots.Select((p, i) => (p, i - OFF)).Where(p => p.p > 0).Sum(p => p.Item2); + var count_curr = pots.Sum(); + var score_Future = score_curr + (50_000_000_000 - (gen + 1)) * count_curr; + score_Future.Dump(); + + $"stable after {gen} Generations with generational drift of {drift}".Dump(); + return; + } + } + lastHash = currHash; + hashOffset = pots.TakeWhile(p => p==0).Count(); +} + +"ERROR - UNSTABLE".Dump(); \ No newline at end of file diff --git a/www/statics/aoc/2018/12_challenge.txt b/www/statics/aoc/2018/12_challenge.txt new file mode 100644 index 0000000..8de5788 --- /dev/null +++ b/www/statics/aoc/2018/12_challenge.txt @@ -0,0 +1,74 @@ +--- 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. + +The pots are numbered, with 0 in front of you. To the left, the pots are numbered -1, -2, -3, and so on; to the right, 1, 2, 3.... Your puzzle input contains a list of pots from 0 to the right and whether they do (#) or do not (.) currently contain a plant, the initial state. (No other pots currently contain plants.) For example, an initial state of #..##.... indicates that pots 0, 3, and 4 currently contain plants. + +Your puzzle input also contains some notes you find on a nearby table: someone has been trying to figure out how these plants spread to nearby pots. Based on the notes, for each generation of plants, a given pot has or does not have a plant based on whether that pot (and the two pots on either side of it) had a plant in the last generation. These are written as LLCRR => N, where L are pots to the left, C is the current pot being considered, R are the pots to the right, and N is whether the current pot will have a plant in the next generation. For example: + + A note like ..#.. => . means that a pot that contains a plant but with no plants within two pots of it will not have a plant in it during the next generation. + A note like ##.## => . means that an empty pot with two plants on each side of it will remain empty in the next generation. + A note like .##.# => # means that a pot has a plant in a given generation if, in the previous generation, there were plants in that pot, the one immediately to the left, and the one two pots to the right, but not in the ones immediately to the right and two to the left. + +It's not clear what these plants are for, but you're sure it's important, so you'd like to make sure the current configuration of plants is sustainable by determining what will happen after 20 generations. + +For example, given the following input: + +initial state: #..#.#..##......###...### + +...## => # +..#.. => # +.#... => # +.#.#. => # +.#.## => # +.##.. => # +.#### => # +#.#.# => # +#.### => # +##.#. => # +##.## => # +###.. => # +###.# => # +####. => # + +For brevity, in this example, only the combinations which do produce a plant are listed. (Your input includes all possible combinations.) Then, the next 20 generations will look like this: + + 1 2 3 + 0 0 0 0 + 0: ...#..#.#..##......###...###........... + 1: ...#...#....#.....#..#..#..#........... + 2: ...##..##...##....#..#..#..##.......... + 3: ..#.#...#..#.#....#..#..#...#.......... + 4: ...#.#..#...#.#...#..#..##..##......... + 5: ....#...##...#.#..#..#...#...#......... + 6: ....##.#.#....#...#..##..##..##........ + 7: ...#..###.#...##..#...#...#...#........ + 8: ...#....##.#.#.#..##..##..##..##....... + 9: ...##..#..#####....#...#...#...#....... +10: ..#.#..#...#.##....##..##..##..##...... +11: ...#...##...#.#...#.#...#...#...#...... +12: ...##.#.#....#.#...#.#..##..##..##..... +13: ..#..###.#....#.#...#....#...#...#..... +14: ..#....##.#....#.#..##...##..##..##.... +15: ..##..#..#.#....#....#..#.#...#...#.... +16: .#.#..#...#.#...##...#...#.#..##..##... +17: ..#...##...#.#.#.#...##...#....#...#... +18: ..##.#.#....#####.#.#.#...##...##..##.. +19: .#..###.#..#.#.#######.#.#.#..#.#...#.. +20: .#....##....#####...#######....#.#..##. + +The generation is shown along the left, where 0 is the initial state. The pot numbers are shown along the top, where 0 labels the center pot, negative-numbered pots extend to the left, and positive pots extend toward the right. Remember, the initial state begins at pot 0, which is not the leftmost pot used in this example. + +After one generation, only seven plants remain. The one in pot 0 matched the rule looking for ..#.., the one in pot 4 matched the rule looking for .#.#., pot 9 matched .##.., and so on. + +In this example, after 20 generations, the pots shown as # contain plants, the furthest left of which is pot -2, and the furthest right of which is pot 34. Adding up all the numbers of plant-containing pots after the 20th generation produces 325. + +After 20 generations, what is the sum of the numbers of all pots which contain a plant? + +--- Part Two --- + +You realize that 20 generations aren't enough. After all, these plants will need to last another 1500 years to even reach your timeline, not to mention your future. + +After fifty billion (50000000000) generations, what is the sum of the numbers of all pots which contain a plant? diff --git a/www/statics/aoc/2018/12_input.txt b/www/statics/aoc/2018/12_input.txt new file mode 100644 index 0000000..bbac5b9 --- /dev/null +++ b/www/statics/aoc/2018/12_input.txt @@ -0,0 +1,34 @@ +initial state: .##..#.#..##..##..##...#####.#.....#..#..##.###.#.####......#.......#..###.#.#.##.#.#.###...##.###.# + +.##.# => # +##.#. => # +##... => # +#.... => . +.#..# => . +#.##. => . +.##.. => . +.#.## => . +###.. => . +..##. => # +##### => # +#...# => # +.#... => # +###.# => # +#.### => # +##..# => . +.###. => # +...## => . +..#.# => . +##.## => # +....# => . +#.#.# => # +#.#.. => . +.#### => . +...#. => # +..### => . +..#.. => # +..... => . +####. => . +#..## => # +.#.#. => . +#..#. => # diff --git a/www/statics/aoc/2018/13-1.linq b/www/statics/aoc/2018/13-1.linq new file mode 100644 index 0000000..b046cd7 --- /dev/null +++ b/www/statics/aoc/2018/13-1.linq @@ -0,0 +1,229 @@ + + +class Rail +{ + public int X,Y; + public Rail N,E,S,W; +} +class Cart +{ + public Dir D; + public Rail R; + public int Mem=0; +} +enum Dir {N=0,E=1,S=2,W=3} + +void Main() +{ + (List rails, List carts) = Parse(File.ReadAllLines(Path.Combine(Path.GetDirectoryName(Util.CurrentQueryPath), @"13_input.txt"))); + + for (int gen=0;;gen++) + { + foreach (var c in carts.OrderBy(c => c.R.Y*10000+c.R.X)) + { + switch (c.D) + { + case Dir.S: + Move(c, new[] { (Dir.E, c.R.E), (Dir.S, c.R.S), (Dir.W, c.R.W) }); + break; + case Dir.W: + Move(c, new[] { (Dir.S, c.R.S), (Dir.W, c.R.W), (Dir.N, c.R.N) }); + break; + case Dir.N: + Move(c, new[] { (Dir.W, c.R.W), (Dir.N, c.R.N), (Dir.E, c.R.E) }); + break; + case Dir.E: + Move(c, new[] { (Dir.N, c.R.N), (Dir.E, c.R.E), (Dir.S, c.R.S) }); + break; + } + + if (carts.Any(oc => oc != c && oc.R == c.R)) { $"{c.R.X},{c.R.Y} after {gen}".Dump(); return; } + + } + //foreach (var c in carts) $"{c.R.X}|{c.R.Y}|{c.D}".Dump();"------".Dump(); + } + +} + +void Move(Cart c, IEnumerable<(Dir, Rail)> options) +{ + var outs = options.Where(p => p.Item2 != null).ToList(); + if (outs.Count == 1) + { + c.R = outs[0].Item2; + c.D = outs[0].Item1; + } + else + { + c.R = outs[c.Mem % 3].Item2; + c.D = outs[c.Mem % 3].Item1; + c.Mem++; + } + +} + +void Dump(List rails, List carts) +{ + int maxx = rails.Max(r => r.X) + 1; + int maxy = rails.Max(r => r.Y) + 1; + + var b = new StringBuilder(); + for (int yy = 0; yy < maxy; yy++) + { + for (int xx = 0; xx < maxx; xx++) + { + var cc = carts.FirstOrDefault(c => c.R.X == xx && c.R.Y == yy); + if (cc != null) + { + if (cc.D == Dir.N) b.Append('^'); + if (cc.D == Dir.E) b.Append('>'); + if (cc.D == Dir.S) b.Append('v'); + if (cc.D == Dir.W) b.Append('<'); + } + else if (rails.Any(r => r.X == xx && r.Y == yy)) + { + b.Append('.'); + } + else + { + b.Append(' '); + } + } + b.AppendLine(); + } + b.ToString().Dump(); + "".Dump(); +} + +(List, List) Parse(string[] line) +{ + var rails = new Dictionary<(int,int), Rail>(); + var carts = new List(); + + Rail get(int x, int y) { if(rails.TryGetValue((x,y), out var v))return v; Rail r = new Rail { X = x, Y = y }; rails.Add((x,y),r); return r; } + + char last = ' '; + for (int y = 0; y < line.Length; y++) + { + last = ' '; + for (int x = 0; x < line[y].Length; x++) + { + char c = line[y][x]; + if (c==' ') continue; + + switch (c) + { + case '-': + { + var rr = get(x, y); + var ra = get(x - 1, y); + var rb = get(x + 1, y); + rr.W = ra; ra.E = rr; + rr.E = rb; rb.W = rr; + } + break; + case '|': + { + var rr = get(x, y); + var ra = get(x, y - 1); + var rb = get(x, y + 1); + rr.N = ra; ra.S = rr; + rr.S = rb; rb.N = rr; + } + break; + case '+': + { + var rr = get(x, y); + var ra = get(x, y - 1); + var rb = get(x + 1, y); + var rc = get(x, y + 1); + var rd = get(x - 1, y); + rr.N = ra; ra.S = rr; + rr.E = rb; rb.W = rr; + rr.S = rc; rc.N = rr; + rr.W = rd; rd.E = rr; + } + break; + case '/': + if (last == '-' || last == '+') + { + var rr = get(x, y); + var ra = get(x - 1, y); + var rb = get(x, y - 1); + rr.W = ra; ra.E = rr; + rr.N = rb; rb.S = rr; + } + else + { + var rr = get(x, y); + var ra = get(x + 1, y); + var rb = get(x, y + 1); + rr.E = ra; ra.W = rr; + rr.S = rb; rb.N = rr; + } + break; + case '\\': + if (last == '-' || last == '+') + { + var rr = get(x, y); + var ra = get(x - 1, y); + var rb = get(x, y + 1); + rr.W = ra; ra.E = rr; + rr.S = rb; rb.N = rr; + } + else + { + var rr = get(x, y); + var ra = get(x + 1, y); + var rb = get(x, y - 1); + rr.E = ra; ra.W = rr; + rr.N = rb; rb.S = rr; + } + break; + case '^': + { + var rr = get(x, y); + var ra = get(x, y - 1); + var rb = get(x, y + 1); + rr.N = ra; ra.S = rr; + rr.S = rb; rb.N = rr; + carts.Add(new Cart { D = Dir.N, R=rr, }); + } + break; + case 'v': + { + var rr = get(x, y); + var ra = get(x, y - 1); + var rb = get(x, y + 1); + rr.N = ra; ra.S = rr; + rr.S = rb; rb.N = rr; + carts.Add(new Cart { D = Dir.S, R=rr, }); + } + break; + case '>': + { + var rr = get(x, y); + var ra = get(x - 1, y); + var rb = get(x + 1, y); + rr.W = ra; ra.E = rr; + rr.E = rb; rb.W = rr; + carts.Add(new Cart { D = Dir.E, R = rr, }); + } + break; + case '<': + { + var rr = get(x, y); + var ra = get(x - 1, y); + var rb = get(x + 1, y); + rr.W = ra; ra.E = rr; + rr.E = rb; rb.W = rr; + carts.Add(new Cart { D = Dir.W, R = rr, }); + } + break; + } + last = c; + } + } + + return (rails.Select(p=>p.Value).ToList(), carts); +} \ No newline at end of file diff --git a/www/statics/aoc/2018/13-2.linq b/www/statics/aoc/2018/13-2.linq new file mode 100644 index 0000000..cd08bbe --- /dev/null +++ b/www/statics/aoc/2018/13-2.linq @@ -0,0 +1,234 @@ + + +class Rail +{ + public int X,Y; + public Rail N,E,S,W; +} +class Cart +{ + public bool C=false; + public Dir D; + public Rail R; + public int Mem = 0; +} +enum Dir { N = 0, E = 1, S = 2, W = 3 } + +void Main() +{ + (List rails, List carts) = Parse(File.ReadAllLines(Path.Combine(Path.GetDirectoryName(Util.CurrentQueryPath), @"13_input.txt"))); + + int cc = carts.Count; + for (int gen = 0; ; gen++) + { + foreach (var c in carts.OrderBy(c => c.R.Y * 10000 + c.R.X)) + { + if (c.C)continue; + switch (c.D) + { + case Dir.S: + Move(c, new[] { (Dir.E, c.R.E), (Dir.S, c.R.S), (Dir.W, c.R.W) }); + break; + case Dir.W: + Move(c, new[] { (Dir.S, c.R.S), (Dir.W, c.R.W), (Dir.N, c.R.N) }); + break; + case Dir.N: + Move(c, new[] { (Dir.W, c.R.W), (Dir.N, c.R.N), (Dir.E, c.R.E) }); + break; + case Dir.E: + Move(c, new[] { (Dir.N, c.R.N), (Dir.E, c.R.E), (Dir.S, c.R.S) }); + break; + } + + var dc = carts.FirstOrDefault(oc => oc != c && oc.R == c.R && !oc.C); + if (dc != null) { c.C = dc.C = true; cc-=2; } + if (cc == 1) { $"{carts.Single(p => !p.C).R.X},{carts.Single(p => !p.C).R.Y} after {gen}".Dump(); return; } + + } + //foreach (var c in carts) $"{c.R.X}|{c.R.Y}|{c.D}".Dump();"------".Dump(); + } + +} + +void Move(Cart c, IEnumerable<(Dir, Rail)> options) +{ + var outs = options.Where(p => p.Item2 != null).ToList(); + if (outs.Count == 1) + { + c.R = outs[0].Item2; + c.D = outs[0].Item1; + } + else + { + c.R = outs[c.Mem % 3].Item2; + c.D = outs[c.Mem % 3].Item1; + c.Mem++; + } + +} + +void Dump(List rails, List carts) +{ + int maxx = rails.Max(r => r.X) + 1; + int maxy = rails.Max(r => r.Y) + 1; + + var b = new StringBuilder(); + for (int yy = 0; yy < maxy; yy++) + { + for (int xx = 0; xx < maxx; xx++) + { + var cc = carts.FirstOrDefault(c => c.R.X == xx && c.R.Y == yy); + if (cc != null) + { + if (cc.D == Dir.N) b.Append('^'); + if (cc.D == Dir.E) b.Append('>'); + if (cc.D == Dir.S) b.Append('v'); + if (cc.D == Dir.W) b.Append('<'); + } + else if (rails.Any(r => r.X == xx && r.Y == yy)) + { + b.Append('.'); + } + else + { + b.Append(' '); + } + } + b.AppendLine(); + } + b.ToString().Dump(); + "".Dump(); +} + +(List, List) Parse(string[] line) +{ + var rails = new Dictionary<(int, int), Rail>(); + var carts = new List(); + + Rail get(int x, int y) { if (rails.TryGetValue((x, y), out var v)) return v; Rail r = new Rail { X = x, Y = y }; rails.Add((x, y), r); return r; } + + char last = ' '; + for (int y = 0; y < line.Length; y++) + { + last = ' '; + for (int x = 0; x < line[y].Length; x++) + { + char c = line[y][x]; + if (c == ' ') continue; + + switch (c) + { + case '-': + { + var rr = get(x, y); + var ra = get(x - 1, y); + var rb = get(x + 1, y); + rr.W = ra; ra.E = rr; + rr.E = rb; rb.W = rr; + } + break; + case '|': + { + var rr = get(x, y); + var ra = get(x, y - 1); + var rb = get(x, y + 1); + rr.N = ra; ra.S = rr; + rr.S = rb; rb.N = rr; + } + break; + case '+': + { + var rr = get(x, y); + var ra = get(x, y - 1); + var rb = get(x + 1, y); + var rc = get(x, y + 1); + var rd = get(x - 1, y); + rr.N = ra; ra.S = rr; + rr.E = rb; rb.W = rr; + rr.S = rc; rc.N = rr; + rr.W = rd; rd.E = rr; + } + break; + case '/': + if (last == '-' || last == '+') + { + var rr = get(x, y); + var ra = get(x - 1, y); + var rb = get(x, y - 1); + rr.W = ra; ra.E = rr; + rr.N = rb; rb.S = rr; + } + else + { + var rr = get(x, y); + var ra = get(x + 1, y); + var rb = get(x, y + 1); + rr.E = ra; ra.W = rr; + rr.S = rb; rb.N = rr; + } + break; + case '\\': + if (last == '-' || last == '+') + { + var rr = get(x, y); + var ra = get(x - 1, y); + var rb = get(x, y + 1); + rr.W = ra; ra.E = rr; + rr.S = rb; rb.N = rr; + } + else + { + var rr = get(x, y); + var ra = get(x + 1, y); + var rb = get(x, y - 1); + rr.E = ra; ra.W = rr; + rr.N = rb; rb.S = rr; + } + break; + case '^': + { + var rr = get(x, y); + var ra = get(x, y - 1); + var rb = get(x, y + 1); + rr.N = ra; ra.S = rr; + rr.S = rb; rb.N = rr; + carts.Add(new Cart { D = Dir.N, R = rr, }); + } + break; + case 'v': + { + var rr = get(x, y); + var ra = get(x, y - 1); + var rb = get(x, y + 1); + rr.N = ra; ra.S = rr; + rr.S = rb; rb.N = rr; + carts.Add(new Cart { D = Dir.S, R = rr, }); + } + break; + case '>': + { + var rr = get(x, y); + var ra = get(x - 1, y); + var rb = get(x + 1, y); + rr.W = ra; ra.E = rr; + rr.E = rb; rb.W = rr; + carts.Add(new Cart { D = Dir.E, R = rr, }); + } + break; + case '<': + { + var rr = get(x, y); + var ra = get(x - 1, y); + var rb = get(x + 1, y); + rr.W = ra; ra.E = rr; + rr.E = rb; rb.W = rr; + carts.Add(new Cart { D = Dir.W, R = rr, }); + } + break; + } + last = c; + } + } + + return (rails.Select(p => p.Value).ToList(), carts); +} \ No newline at end of file diff --git a/www/statics/aoc/2018/13_challenge.txt b/www/statics/aoc/2018/13_challenge.txt new file mode 100644 index 0000000..fdf9a81 --- /dev/null +++ b/www/statics/aoc/2018/13_challenge.txt @@ -0,0 +1,206 @@ +--- 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. + +You map out the tracks (your puzzle input) and see where you can help. + +Tracks consist of straight paths (| and -), curves (/ and \), and intersections (+). Curves connect exactly two perpendicular pieces of track; for example, this is a closed loop: + +/----\ +| | +| | +\----/ + +Intersections occur when two perpendicular paths cross. At an intersection, a cart is capable of turning left, turning right, or continuing straight. Here are two loops connected by two intersections: + +/-----\ +| | +| /--+--\ +| | | | +\--+--/ | + | | + \-----/ + +Several carts are also on the tracks. Carts always face either up (^), down (v), left (<), or right (>). (On your initial map, the track under each cart is a straight path matching the direction the cart is facing.) + +Each time a cart has the option to turn (by arriving at any intersection), it turns left the first time, goes straight the second time, turns right the third time, and then repeats those directions starting again with left the fourth time, straight the fifth time, and so on. This process is independent of the particular intersection at which the cart has arrived - that is, the cart has no per-intersection memory. + +Carts all move at the same speed; they take turns moving a single step at a time. They do this based on their current location: carts on the top row move first (acting from left to right), then carts on the second row move (again from left to right), then carts on the third row, and so on. Once each cart has moved one step, the process repeats; each of these loops is called a tick. + +For example, suppose there are two carts on a straight track: + +| | | | | +v | | | | +| v v | | +| | | v X +| | ^ ^ | +^ ^ | | | +| | | | | + +First, the top cart moves. It is facing down (v), so it moves down one square. Second, the bottom cart moves. It is facing up (^), so it moves up one square. Because all carts have moved, the first tick ends. Then, the process repeats, starting with the first cart. The first cart moves down, then the second cart moves up - right into the first cart, colliding with it! (The location of the crash is marked with an X.) This ends the second and last tick. + +Here is a longer example: + +/->-\ +| | /----\ +| /-+--+-\ | +| | | | v | +\-+-/ \-+--/ + \------/ + +/-->\ +| | /----\ +| /-+--+-\ | +| | | | | | +\-+-/ \->--/ + \------/ + +/---v +| | /----\ +| /-+--+-\ | +| | | | | | +\-+-/ \-+>-/ + \------/ + +/---\ +| v /----\ +| /-+--+-\ | +| | | | | | +\-+-/ \-+->/ + \------/ + +/---\ +| | /----\ +| /->--+-\ | +| | | | | | +\-+-/ \-+--^ + \------/ + +/---\ +| | /----\ +| /-+>-+-\ | +| | | | | ^ +\-+-/ \-+--/ + \------/ + +/---\ +| | /----\ +| /-+->+-\ ^ +| | | | | | +\-+-/ \-+--/ + \------/ + +/---\ +| | /----< +| /-+-->-\ | +| | | | | | +\-+-/ \-+--/ + \------/ + +/---\ +| | /---<\ +| /-+--+>\ | +| | | | | | +\-+-/ \-+--/ + \------/ + +/---\ +| | /--<-\ +| /-+--+-v | +| | | | | | +\-+-/ \-+--/ + \------/ + +/---\ +| | /-<--\ +| /-+--+-\ | +| | | | v | +\-+-/ \-+--/ + \------/ + +/---\ +| | /<---\ +| /-+--+-\ | +| | | | | | +\-+-/ \-<--/ + \------/ + +/---\ +| | v----\ +| /-+--+-\ | +| | | | | | +\-+-/ \<+--/ + \------/ + +/---\ +| | /----\ +| /-+--v-\ | +| | | | | | +\-+-/ ^-+--/ + \------/ + +/---\ +| | /----\ +| /-+--+-\ | +| | | X | | +\-+-/ \-+--/ + \------/ + +After following their respective paths for a while, the carts eventually crash. To help prevent crashes, you'd like to know the location of the first crash. Locations are given in X,Y coordinates, where the furthest left column is X=0 and the furthest top row is Y=0: + + 111 + 0123456789012 +0/---\ +1| | /----\ +2| /-+--+-\ | +3| | | X | | +4\-+-/ \-+--/ +5 \------/ + +In this example, the location of the first crash is 7,3. + +--- Part Two --- + +There isn't much you can do to prevent crashes in this ridiculous system. However, by predicting the crashes, the Elves know where to be in advance and instantly remove the two crashing carts the moment any crash occurs. + +They can proceed like this for a while, but eventually, they're going to run out of carts. It could be useful to figure out where the last cart that hasn't crashed will end up. + +For example: + +/>-<\ +| | +| /<+-\ +| | | v +\>+/ + +/---\ +| | +| v-+-\ +| | | | +\-+-/ | + | | + ^---^ + +/---\ +| | +| /-+-\ +| v | | +\-+-/ | + ^ ^ + \---/ + +/---\ +| | +| /-+-\ +| | | | +\-+-/ ^ + | | + \---/ + +After four very expensive crashes, a tick ends with only one cart remaining; its final location is 6,4. + +What is the location of the last cart at the end of the first tick where it is the only cart left? \ No newline at end of file diff --git a/www/statics/aoc/2018/13_input.txt b/www/statics/aoc/2018/13_input.txt new file mode 100644 index 0000000..6a91ced --- /dev/null +++ b/www/statics/aoc/2018/13_input.txt @@ -0,0 +1,150 @@ + /---------------------\ /----------------<---------------------------------------------------------------------\ + | | | /---------------------------\ | + /-------+---------------------+-----------+---------+---------------------------+------\ | + /----------+-------+---------------------+---\ /+---------+---------------------------+------+------\ | + /-+----------+-------+---------------------+---+------++---------+-------------------------\ | | | | + | | | | /------------------+---+------++---------+-----\ | | /----+------+---------------------------\ | + | | /------+-------+--+------------------+---+-\ || | | /----+-+-+----+------+----------------\ | | + | | | | /-----+--+------------------+---+-+----++---------+-----+--------------+----+-+-+----+---\ | | | | + | | | | | /+--+--------------\ | | | || /----+-----+--------------+----+-+-+----+---+--+----------------+---------\| | + | | | | | || | | | | | || | | | | | | | | | | | || | + | | | | | || | /-------+---+-\ | | || | | | | | | | | | | /-------+---------++------+---\ + | | | | | || | | | | | | | || | | | /--------+----+-+-+----+---+\ | | | || | | + | | | | | || | | | | | | | || |/---+-----+\ | | | | | | || | | | || | | + | | | /-+-+----++--+------+-------+---+-+-+-+----++----++---+-----++--->+--------+----+-+-+----+---++-+-----\ | | || | | + | | | | | | /++--+------+-------+---+-+-+-+----++----++---+-----++----+--------+----+-+-+----+---++-+-----+--+-------+-\ || | | + | | /+----+-+-+---+++--+------+-------+---+-+-+-+----++-\ || | || | | | | | | || | | | | | || | | + | | || | | | ||| | | | | | | | || | /++---+-----++----+--------+----+-+-+-\ | || | | | | | || | | + | | || |/+-+---+++--+------+-------+---+-+-+-+----++-+-+++---+\ /-++----+--\ | | | | | | || | | | | |/------++--\ | | + | | || ||| |/--+++--+------+-------+---+-+-+-+----++\| ||| || | || | | /---+----+-+-+-+--+---++-+----\| | | || || | | | + | | || ||| || ||| |/-----+-------+---+-+-+-+----++++-+++---++--+-++----+--+-+---+----+-+-+-+--+---++-+----++--+-------+-++---\ || | | | + | | || ||| || |\+--++-----+-------/ | | | | |||| ||| v| | || | | | | | | | | |/--++-+----++--+-------+-++---+--++--+---+--\| +/+-+--++----+++-++--+-+--++-----+-----------+-+-+-+----++++-+++---++--+-++----+--+-+-\ \----+-+-+-+--++--++-+----++--+-------/ || | || | | || +|| | /++----+++-++--+-+--++-----+-----------+-+-+-+----++++-+++---++--+-++---\| | | | | | | | || || | || | || | || | | || +|| | ||| ||| || | | || | | | | |/---++++-+++---++--+-++---++--+-+-+------+-+-+-+--++--++-+----++--+---------++--\| || | | || +|| | |||/---+++-++--+-+--++-----+-----------+-+-+-++---++++-+++---++--+-++---++--+-+-+---\ | | | | || || | || | || || || | | || +|| | |||| ||| || | | || | | | | || |||| ||| || | ||/--++--+-+-+---+--+-+\| | || || | || | || || || | | || +|| | |||| ||| || /+-+--++-----+-----------+-+-+-++---++++-+++---++--+-+++--++--+-+-+---+--+-+++-+--++--++-+----++--+-------\ || || || | | || +|| | |||| ||| \+-++-+--++-----+-----------+-+-+-++---++++-+++---++--+-+++--++--+-+-+---+--+-+++-+--++--/| | || \-------+-++--++--++--+---+--+/ +|| | |||| ||| |/++-+--++-----+-----------+-+-+-++---++++-+++---++--+-+++\ || | | | | | ||| | || | | || | || || || | | | +|| | |||| ||| |||| | || | | | | || |||| ||| || | |||| || | | | | | ||| | || | | || | || || || | | | +|| |/++++---+++--++++-+--++---\ | | | | || |||| ||| ||/-+-++++-++--+-+-+---+--+-+++-+--++---+-+----++----------+-++--++--++--+---+--+\ +|| |||||| ||| |||| | || | | | | | || |||| |\+---+++-+-++++-++--+-+-+---+--+-+++-+--++---+-+----++----------+-++--++--/| | | || +|| |||||| ||| |||| | || | | /--------+-+-+-++---++++-+-+---+++-+-++++-++--+-+-+---+-\| ||| | || | | || | || || | | | || +|| |||||| ||| |||| | /++---+-+--+--------+-+-+-++---++++-+-+---+++-+-++++-++--+-+-+---+-++-+++-+--++-\ | | || /--------+-++--++---+--+\ | || +|| |||||| ||| |||| | ||| | | | /----+-+-+-++---++++-+-+---+++-+-++++-++--+-+-+---+-++-+++-+--++-+-+-+----++-+--------+-++--++---+--++--+-\|| +|| |||||| ||| |||| | ||| | | | | | | | || /++++-+-+--\||| | |||| || |/+-+---+-++-+++-+--++-+-+-+----++-+--------+-++--++---+--++-\| ||| +|| |||||| ||| |||| | ||| /+-+--+---+----+-+-+-++--+++++-+-+--++++-+-++++-++--+++-+---+-++-+++-+--++-+-+-+----++-+--\ | || || | || || ||| +|| |||||| /-+++--++++-+-+++--++-+--+---+----+-+\| || ||||| | | |||| | |||| || ||| | | || ||| | || | | | || | | /-+-++--++---+\ || || ||| +|| |||||| | ||| |||| \-+++--++-+--+---+----/ ||| || ||||| | | |||| | |||| || ||| | | || ||| | || | | | || | | | | || || || || || ||| +|| ||||\+-+-+++--++++---+++--++-+--+---+>-----+++-/| ||||| | | |||\-+-++++-++--+++-+---+-++-+++-+--++-+-+-+----++-+--+---+-+-++--++---++-++-++-++/ +|| |||| | | ||| |||| ||| || | | |/-----+++--+--+++++-+-+--+++--+-++++-++--+++-+---+-++-+++-+--++-+-+-+-\ || | | | | || || || || || || +|| |||| | | ||| |\++---+++--++-+--+---++-----+++--+--+++++-+-+--+++--+-+++//++--+++-+---+-++-+++-+--++-+-+-+-+--++-+--+---+\| || || || || || || +|| |||| | | ||| | |\---+++--++-+--+---++-----+++--+--+++++-+-+--+++--+>+++-+++--+++-+---+-++-+++-+--++-+-+-+-+--++-+--+---+++-/| || || || || || +|| |||| | | ||| | | ||| || | | /-++-----+++--+--+++++-+-+--+++--+-+++-+++--+++-+---+-++-+++-+--++-+-+-+-+--++-+--+---+++--+--++-<-++-++-++\|| +|| |||\-+-+-+++--+-+----+++--++-+--+-+-++-----+++--+--++++/ | | ||| | ||| ||| ||| | | || ||| | || |/+-+-+--++-+--+---+++--+--++---++-++-+++++\ +|| ||| | | ||| | | ||| || | | | || ||| | |||| \-+--+++--+-+++-+++--+++-+---+-++-+++-/ || ||| | | || | | ||| | || || || |||||| +|| ||| | | ||| | | ||| || | | | ||/----+++--+--++++----+\ ||| | ||| ||| |||/+---+-++-+++----++-+++-+-+--++-+--+---+++--+--++--\|| || |||||| +|| ||| | | ||| | | ||| || | |/+-+++----+++--+--++++----++-+++--+-+++-+++--+++++---+-++-+++----++-+++-+-+--++-+--+---+++-\| || ||| || |||||| +|| \++--+-+-+++--+-+----+++--++-+--+++-+++----++/ | |||| || ||| \-+++-+++--/|||| | || ||| || ||| | | || | | ||| || || ||| || |||||| +|| || | | ||| | | ||| || | ||| ||| || | |||| || ||| ||| ||\---++++---+-++-+++----++-++/ | | || | | ||| || || ||| || |||||| +|| || | | ||| | | ||| || | ||| ||| || | |||| \+-+++----+/| \+----++++---+-++-+++----++-++--+-+--++-+--+---+/| || || ||| || |||||| +|| || /+-+-+++--+-+----+++--++-+--+++-+++----++---+--++++-----+-+++----+-+--+----++++---+\|| ||| || || | | || \--+---+-+-++--++--+++-+/ |||||| +|| || || | ||| | | /+++--++-+--+++-+++----++---+--++++-----+-+++----+-+--+----++++---++++-+++----++-++--+-+--++--\ | | | || || ||| | |||||| +|| || || | ||| | | |||| || | ||| ||| || | |||| | |\+----+-+--+----++++---++++-/|| || || | | || | | | | || || ||| | |||||| +|| || || | ||| | | /++++--++-+--+++-+++----++---+--++++-----+-+-+----+-+--+----++++---++++--++----++-++--+-+--++--+-+---+-+-++-\|| ||| | |||||| +|| || || | ||| | | ||||| || | ||| ||| || | |||| | | | | | | |||| |||| /++----++-++--+-+--++--+\| |/+-++-+++\ ||| | |||||| +|| || || | ||| | | ||||| || | ||| ||| || |/-++++-----+-+-+----+-+--+----++++---++++-+++\ || || | | || ||| ||| || |||| ||| | |||||| +|| || || | ||| | | /+++++--++-+--+++<+++----++---++-++++-----+-+-+----+-+--+----++++---++++-++++---++-++--+\| || ||| ||| || |||| ||| | |||||| +|| || || | ||| | | |||||| || | |\+-+++----++---++-++++-----+-+-+----+-+--+----++++---++++-++++---++-++--+++--++--+++---+++-/| |||| ||| | |||||| +|| || || | ||| | | |||\++--++-+--+-+-+++----++---++-++++-----+-+-+----+-+--+----++++---++++-++++---++-/| ||| || ||| ||| | |||| ||| | |^|||| +|| || || | ||| | |/+++-++--++-+--+-+-+++----++---++-++++-----+-+-+----+-+--+----++++\ |||| |||| |\--+--+++--++--+++---+++--+-++++-+++-+--++++/| +|| || || | ||| | ||||| || || | | | ||| || || |||| | | | | | | ||\++--++++-++++---+---+--+++--++--+++---+++--+-++++-/|| | |||| | +|| || || | ||| | ||||| || || | | | ||| || || |||| | | | | | | || || |||| |||| | | ||| || ||| ||| | |||| || | |||| | +|| || || | \++--+-+++++-++--++-+--+-+-+++----++---++-++++-----+-+-+----+-+--+----++-++--++++-++++---+---+--+++--+/ ||| ||| | |||| || | |||| | +|| || || | || | ||||| || || | | | ||| || || |||| | | | | | | || || |||| |||| | | ||| | ||| ||| | |||| || | |||| | +|| ||/++-+--++--+-+++++-++--++-+--+-+-+++----++---++-++++-----+-+-+----+-+--+----++-++\ |||| |||| | | ||| | ||| ||| | |||| || | |||| | +|| \++++-+--++--+-+++++-++--+/ | | | ||| /--++---++-++++-----+-+-+----+-+--+----++-+++-++++-++++>--+---+--+++--+---+++---+++--+\|||| || | |||| | +|| |||| | || | ||||| |\--+--+--+-+-+++-+--++---++-++++-----+-+-+----+-+--+----++-+++-++++-++++---+---+--+++--+---+++---+++--++++/| || | |||| | +|| |||| | || | ||||| | | | | | ||\-+--++---++-++++-----/ | | |/+--+----++-+++\|||| |||| |/--+--+++--+---+++---+++--++++-+--++-+-\|||| | +|| |||| | || | ||||| | | | | | || |/-++---++-++++-------+-+----+++--+----++-++++++++-++++---++--+--+++--+---+++---+++--++++-+--++\| ||||| | +|| |||| | || | ||||| | /-+--+--+-+-++--++-++---++-++++-------+-+----+++--+----++-++++++++-++++---++--+--+++\ | ||| ||| |||| | |||| ||||| | +|\---++++-+--++--+-+++++-+-+-+--+--+-+-++--++-++---++-++++-------+-+----+++--+----++-+++++++/ |||| || | |||| | ||| ||| |||| | |||| ||||| | +| |||\-+--++--+-+++++-+-+-+--+--+-+-++--++-++---++-++++-------+-+----+++--+----++-++++/|| |||| || | |||| | ||| ||| |||| | |||| ||||| | +| |||/-+--++--+-+++++-+-+-+--+--+-+-++--++-++---++-++++-------+-+-\ ||| | || |||| || |||| || | |||| | ||| ||| |||| | |||| ||||| | +| |||| | || | ||||| | | | | | | || || || |\-++++-------+-+-+--+++--+----++-++++-++--+++/ || | |||| | ||| ||| \+++-+--+++/ ||||| | +| |||| | || | ||||| | | |/-+--+-+-++--++-++---+--++++-------+-+-+--+++--+----++-++++-++--+++----++--+--++++\| ||| ||| ||| | ||| ||||| | +| |||| | || | ||||| | | || | | | || || || /-+--++++-------+-+-+--+++--+--\ || |||| || ||| || | |||||| ||| ||| ||| | ||| ||||| | +| |||| | || | ||||| \-+-++-+--+-+-++--++-++-+-+--++++-------+-+-+--/|| | | || |||| || ||| || | |||||| ||| ||| ||| | ||| ||||| | +| |||| | || | ||||| | || | | | || || || | | |||| /-----+-+-+---++--+--+-++-++++-++--+++----++--+--++++++---+++---+++\ ||| | ||| ||||| | +| |||| | \+--+-+++++---+-++-+--+-+-++--++-++-+-+--++++-+-----+-/ | || | | || |||| || ||| /++--+--++++++\ ||| |||| /+++-+--+++\ ||||| | +| |||| \---+--+-+++++---+-++-+--+-+-++--++-+/ v | |\++-+-----+---+---++--+--+-++-++++-++--+++---+++--+--/|||||| ||| |||| |||| | |||| ||||| | +| |||| /--+--+-+++++--\|/++-+--+-+-++--++-+--+-+--+-++-+-----+---+---++--+--+-++-++++-++--+++---+++--+\ |||||| ||| |||| |||| | |||| ||||| | +| |||| | | /+-+++++--+++++-+--+-+-++--++-+--+-+--+-++-+-----+---+---++-\| | || |||| || ||| |||/-++--++++++-\||| |||| |||| | |||| ||||| | +| |||| | | || ||||| ||||| | | | || || | | | | || |/----+---+---++-++--+-++-++++-++--+++---++++-++--++++++-++++\ |||| |||| | |||| ||||| | +\----++++--+--+-++-+++++--+++++-+--+-+-++--++-+--+-+--+-++-++----+---+---++-++--+-++-/||| || ||| |||| || |||||| ||||| |||| |||| | |||| ||||| | + /++++--+--+-++-+++++\ |||\+-+--+-+-++--++-+--+-+--+-++-++----+---+---++-++--+-++--+++-++--+++---++++-++--++++++-+++/| |||| |||| | |||| ||||| | + |||||/-+--+-++-++++++-+++-+-+-\| \-++--++-+--+-+--+-++-++----+---+---++-++--+-++--+++-++--+++---++++-++--++++++-+++-+--++++-++++-+--++++-+++/| | + |||||| | | || |||||| |\+-+<+-++---++--++-+--+-+--+-++-++----+---+---++-++--+-++--+++-++--+++---++++-++--++/||| ||| | |||| |||| | |||| ||| | | + |||||| | | || |||||| | | \-+-++---++--++-+--+-+--+-++-++----+---+---++-++--+-++--+++-++--+++---++++-++--++-/|| ||| | |||| |||| | |||| ||| | | + |||||| | | || |||||| | | | || || || | \-+--+-++-++----+---+---++-++--/ || ||| || ||| |||| || || || ||| | |||| |||| | |||| ||| | | + |||||| | | || |||\++-+-+---+-++---++--++-+----+--+-++-++----+---+---++-++----++--+++-++--+++---++++-++--++--++-+++-+--++++-++/| | |||| ||| | | + |||||| | |/++-+++-++-+-+---+-++---++--++-+----+--+-++-++----+---+---++-++----++--+++-++\ ||| |||| || || || ||| | |||| || | | |||| ||| | | + |||||| | |||| ||| || | | | |\---++--++-+----+--+-++-++----+---+---++-++----++--+++-+/| ||| |||| || || || ||| | |||| || | | |||| ||| | | + |||||| | |||| ||| || | | | | || \+-+----+--+-++-++----+---+---++-++----++--+++-+-+-+++---++++-++--++--++-+++-+--++++-+/ | | |||| ||| | | + |||||| | |||| ||| || | | | | ||/--+-+----+--+-++-++---\| | || || || ||| | | ||| |||| || || || ||| | |||| | | | |||| ||| | | + |||||| | |||| ||| || | | | | ||| | | | | || || || | || || || ||| | | ||\---++++-++--++--++-+++-+--++++-+--+-+--/||| ||| | | + |||||| | |||| ||| |^ | | | | ||| | | | | || || || | || || || |||/+-+-++----++++-++--++--++-+++\| |||| | | | ||| ||| | | + /-++++++-+--++++\||| || | | | | ||| | | | | || || || | \+-++----++-<++/|| | || |||| || || || ||||| |||| | | | ||| ||| | | + | |||||| \--++++++++-++-/ | | | ||| /+-+----+--+-++-++---++---+---\| || /--++--++-++-+-++----++++-++--++--++-+++++--++++-+--+\| ||| ||| | | + | |||||| |||||||| || | | | ||| || | | | || || || | || || | || || || | \+----++++-++--++--++-++/|| |||| | ||| ||| ||| | | + | |||||| |||||||| || | | | /--+++-++-+----+--+-++-++---++---+\ || || | \+--++-++-+--+----++++-++--++--++-++-++--++++-+--+++---+++-+/| | | + | |||||| |||||||| || | | | | ||| || | | /+-++-++---++---++--++-++-+---+--++-++-+--+----++++-++--++--++-++-++--++++-+--+++---+++-+-+-+-+\ + | |||||| |||||||| || | | | | ||| || | | || \+-++---++---++--++-++-+---+--++-++-+--+----++++-++--++--++-++-++--++++-+--+++---+++-+-/ | || + | |||||| \+++++++-++---+---+-+-+--+++-++-+----+-++--+-++---++---++--++-++-+---+--++-++-+--+----+/|| || || || || || |||| | ||| ||| | | || + | |||||| ||||||| || | | | | ||| || | | || | || || || || || | | || || | | | || || || || || || |||| | ||| ||| | | || + | |||||| ||||||| || | | | | \++-++-+----+-++--+-++---++---++--++-++-+---+--++-++-+--+----+-++-++--++--++-++-++--++++-+--+++---+++-+---/ || + | \+++++-----+++++++-+/ | \-+-+---++-++-/ | || | || || || || || | \--++-++-+--+----+-++-++--++--/| || || |\++-+--++/ ||| | || + | |v|||/----+++++++-+----+--\ | | || || \-++--+-++---++---++--++-++-+------++-++-+--+----+-++-++--++---+-++-++--+-++-+--/| ||| | || + | |||||| \++++++-+----+--+--+-+---++-++--------++--+-++---++---++--++-++-+------++-++-/ | | || || || | || || | || | | ||| | || + | |||||| /-++++++-+----+--+--+-+---++-++--------++--+-++---++---++--++-++-+------++-++----+----+-++\|| || | || || | || | | ||| | || + | |||||| | |||||| | | | | | \+-++--------++--+-++---++---++--++-++-+------++-++----+----+-+++++--+/ | || || | || | | ||| | || + | |||||| | |||||| \----+--+--+-+----+-++--------++--+-++---++---++--++-++-+------++-++----+----+-+++++--+----+-+/ || | || | | ||| | || + \--++++++---+-++/||| | | | | | || || | || || || || || | /--++-++----+----+-+++++--+----+-+--++\ | || | | ||| | || + |||||| | || ||| | | | | | \+--------++--+-++---++---++--/| || | | || || | | ||||| | | | ||| | || | | ||| | || + \+++++---+-++-+++------+--+--+-+----+--+--------++--+-++---++---++---+-+/ \---+--++-++----+----+-+++++--+----+-+--+++-+-++-+---/ ||| | || + ||||| /-+-++-+++------+--+--+-+----+--+--------++--+-++---++---++---+-+------+--++-++----+----+-+++++--+\ | | ||| \-++-+--------/|| | || + ||||| | | || ||| \--+--+-+----+--+--------++--+-++---++---++---+-+->----+--++-++----+----+-++++/ || | | ||| || | || | || + ||||| | | || ||| | | | | | |\--+-++---+/ ||/--+-+------+--++-++----+---\| |\++---++---+-/ ||| || | || | || + /----+++++-+-+-++\||| | | | \--+--------+---+-++---/ ||| | | | || || | || | |\---++---+----+++---++-+---------++-+-----/| + | ||||| | | |||||| | | | | | | || ||| | | | || || | || | | || | ||| || | || | | + | ||||| | | |\++++---------+--+-+-------+--------+---/ || ||| | | | || || | || | | || | ||| || | || | | + | ||||| | | | |||| | | | | | || /----+++--+-+------+--++-++----+---++-+-+----++---+----+++---++-+------\ || | | + | ||||| | | | |||| | | | | \-----++---+----+++--+-+------+--++-++----+---++-+-+----++---+----+++---++-+------+--++-+------/ + | ||||| | | | |||| | | \-------+--------------++---+----+/| | | | || || | || | | || | ||| /-++-+------+-\|| | + | ||||| | | | |||| | | | \+---+----+-+--+-+------+--++-++----+---++-+-+----++---+----+++-+-+/ | | ||| | + | ||||| | \-+-++++---------+--+---------+---------------+---+----+-+--+-+------+--++-++----+---++-+-/ || | ||| | | | | ||| | + | ||||| | | |||\---------+--+---------+---------------+---+----+-+--+-+------+--++-++----+---++-+------/| | ||| | | | | ||| | + |/---+++++-+---+-+++-\ | | /---+---------------+---+----+-+--+-+------+--++-++----+---++-+-------+---+----+++-+-+--+------+\||| | + \+---+++++-+---+-/|| | | | | | |/--+----+-+--+-+------+--++-++----+---++-+-----\ | | ||| | | | ||||| | + | \++++-+---+--++-+--------+--+-----+---+---------------++--+----+-+--+-+------+--+/ || | || | | | | ||| | | \------++++/ | + | |||| | | || | | | | | || | | | \-+------+--+--++----/ || | | | | ||| | | |||| | + | |||| | | || | | | v | || | | | | | | \+--------++-+-----+-+---+----/|| | | |||| | + | ||\+-+---+--++-+--------+--/ | | || | | | | | | | |\-+-----+-+---/ || | | |||| | + | || | | | \+-+--------+--------+---+---------------++--+----+-+----+------+--+---+--------+--+----<+-+---------++-+-/ |||| | + | || | | | \-+--------+--------+---+---------------++--+----+-+----+------+--/ | | | | | || \-----------++/| | + | \+-+-+---+-----+--------+--------+---+---------------++--+----+-+----+------+------/ | | | | || || | | + | | | | | | | \---+---------------++--+----+-+----+------+---------------+--+-----+-+---------++-------------+/ | | + | | | | | | | | || | | | | | | | | | || | | | + | | | \---+-----+--------+------------+---------------++--+----+-+----+------+---------------+--+-----+-/ || | | | + | | | \-----+--------+------------+---------------++--+----+-+----/ | | | | || | | | + | | | | | | /----------++--+----+-+-----------+---------------+--+-----+-----------++----\ | | | + | | | | | | | \+--+----+-+-----------+---------------+--+-----+-----------/| | | | | + \-----+-+-----------/ | | | \--+----+-+-----------+---------------+--+-----/ | | | | | + | | | \----+--------------+----+-+-----------+---------------+--+------------------+----+--------+--/ | + | | | | | | | \---------------+--+------------------/ | | | + \-+--------------------+-----------------+--------------+----/ | | | | | | + | | | | \---------------------------/ | | | | + \--------------------/ | \-------------------------------------+-----------------------+--------/ | + | \-----------------------+--------------/ + \----------------------------------------------------------------------------/ diff --git a/www/statics/aoc/2018/14-1.linq b/www/statics/aoc/2018/14-1.linq new file mode 100644 index 0000000..95b3054 --- /dev/null +++ b/www/statics/aoc/2018/14-1.linq @@ -0,0 +1,27 @@ + + +var input = int.Parse(File.ReadAllText(Path.Combine(Path.GetDirectoryName(Util.CurrentQueryPath), @"14_input.txt"))); + + +var board = new List(input); +board.Add(3); +board.Add(7); + +int elf1 = 0; +int elf2 = 1; +for(int gen=0;;gen++) +{ + var sum1=board[elf1]+board[elf2]; + if (sum1>=10)board.Add(1); board.Add(sum1%10); + + elf1 = (elf1 + 1 + board[elf1]) % board.Count; + elf2 = (elf2 + 1 + board[elf2]) % board.Count; + + //board.Select((p, i) => (i == elf1) ? $"({p})" : ((i == elf2) ? $"[{p}]" : $" {p} ")).Aggregate((a,b)=>a+" "+b).Dump(); + + if (board.Count >= input+10) + { + board.Skip(input).Take(10).Select(p=>p.ToString()).Aggregate((a,b)=>a+b).Dump(); + return; + } +} \ No newline at end of file diff --git a/www/statics/aoc/2018/14-2.linq b/www/statics/aoc/2018/14-2.linq new file mode 100644 index 0000000..89b4df6 --- /dev/null +++ b/www/statics/aoc/2018/14-2.linq @@ -0,0 +1,33 @@ + + +var input = File.ReadAllText(Path.Combine(Path.GetDirectoryName(Util.CurrentQueryPath), @"14_input.txt")).Select(c => c-'0').Reverse().ToArray(); + + +var board = new List(); +board.Add(3); +board.Add(7); + +int elf1 = 0; +int elf2 = 1; +for (int gen = 0; ; gen++) +{ + var sum1 = board[elf1] + board[elf2]; + if (sum1 >= 10) board.Add(1); board.Add((short)(sum1 % 10)); + + elf1 = (elf1 + 1 + board[elf1]) % board.Count; + elf2 = (elf2 + 1 + board[elf2]) % board.Count; + + //board.Select((p, i) => (i == elf1) ? $"({p})" : ((i == elf2) ? $"[{p}]" : $" {p} ")).Aggregate((a,b)=>a+" "+b).Dump(); + + if (board.Count >= input.Length && input.Select((p,i) => board[board.Count-1-i]==p ).All(p=>p)) + { + (board.Count-input.Length).Dump(); + return; + } + + if (board.Count >= input.Length && sum1 >= 10 && input.Select((p, i) => board[board.Count - 2 - i] == p).All(p => p)) + { + (board.Count - input.Length - 1).Dump(); + return; + } +} \ No newline at end of file diff --git a/www/statics/aoc/2018/14_challenge.txt b/www/statics/aoc/2018/14_challenge.txt new file mode 100644 index 0000000..56af854 --- /dev/null +++ b/www/statics/aoc/2018/14_challenge.txt @@ -0,0 +1,52 @@ +--- 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. + +Only two recipes are on the board: the first recipe got a score of 3, the second, 7. Each of the two Elves has a current recipe: the first Elf starts with the first recipe, and the second Elf starts with the second recipe. + +To create new recipes, the two Elves combine their current recipes. This creates new recipes from the digits of the sum of the current recipes' scores. With the current recipes' scores of 3 and 7, their sum is 10, and so two new recipes would be created: the first with score 1 and the second with score 0. If the current recipes' scores were 2 and 3, the sum, 5, would only create one recipe (with a score of 5) with its single digit. + +The new recipes are added to the end of the scoreboard in the order they are created. So, after the first round, the scoreboard is 3, 7, 1, 0. + +After all new recipes are added to the scoreboard, each Elf picks a new current recipe. To do this, the Elf steps forward through the scoreboard a number of recipes equal to 1 plus the score of their current recipe. So, after the first round, the first Elf moves forward 1 + 3 = 4 times, while the second Elf moves forward 1 + 7 = 8 times. If they run out of recipes, they loop back around to the beginning. After the first round, both Elves happen to loop around until they land on the same recipe that they had in the beginning; in general, they will move to different recipes. + +Drawing the first Elf as parentheses and the second Elf as square brackets, they continue this process: + +(3)[7] +(3)[7] 1 0 + 3 7 1 [0](1) 0 + 3 7 1 0 [1] 0 (1) +(3) 7 1 0 1 0 [1] 2 + 3 7 1 0 (1) 0 1 2 [4] + 3 7 1 [0] 1 0 (1) 2 4 5 + 3 7 1 0 [1] 0 1 2 (4) 5 1 + 3 (7) 1 0 1 0 [1] 2 4 5 1 5 + 3 7 1 0 1 0 1 2 [4](5) 1 5 8 + 3 (7) 1 0 1 0 1 2 4 5 1 5 8 [9] + 3 7 1 0 1 0 1 [2] 4 (5) 1 5 8 9 1 6 + 3 7 1 0 1 0 1 2 4 5 [1] 5 8 9 1 (6) 7 + 3 7 1 0 (1) 0 1 2 4 5 1 5 [8] 9 1 6 7 7 + 3 7 [1] 0 1 0 (1) 2 4 5 1 5 8 9 1 6 7 7 9 + 3 7 1 0 [1] 0 1 2 (4) 5 1 5 8 9 1 6 7 7 9 2 + +The Elves think their skill will improve after making a few recipes (your puzzle input). However, that could take ages; you can speed this up considerably by identifying the scores of the ten recipes after that. For example: + + If the Elves think their skill will improve after making 9 recipes, the scores of the ten recipes after the first nine on the scoreboard would be 5158916779 (highlighted in the last line of the diagram). + After 5 recipes, the scores of the next ten would be 0124515891. + After 18 recipes, the scores of the next ten would be 9251071085. + After 2018 recipes, the scores of the next ten would be 5941429882. + +What are the scores of the ten recipes immediately after the number of recipes in your puzzle input? + +--- Part Two --- + +As it turns out, you got the Elves' plan backwards. They actually want to know how many recipes appear on the scoreboard to the left of the first recipes whose scores are the digits from your puzzle input. + + 51589 first appears after 9 recipes. + 01245 first appears after 5 recipes. + 92510 first appears after 18 recipes. + 59414 first appears after 2018 recipes. + +How many recipes appear on the scoreboard to the left of the score sequence in your puzzle input? \ No newline at end of file diff --git a/www/statics/aoc/2018/14_input.txt b/www/statics/aoc/2018/14_input.txt new file mode 100644 index 0000000..6c85e92 --- /dev/null +++ b/www/statics/aoc/2018/14_input.txt @@ -0,0 +1 @@ +260321 \ No newline at end of file diff --git a/www/statics/aoc/2018/15-1.linq b/www/statics/aoc/2018/15-1.linq new file mode 100644 index 0000000..48167eb --- /dev/null +++ b/www/statics/aoc/2018/15-1.linq @@ -0,0 +1,277 @@ + + +enum Fraction { Wall, Elf, Goblin } + +class Entity +{ + public Fraction Frac; + public int AttackPower; + public int HitPoints; + public int X, Y; + public bool Alive; + + public override string ToString() => $"{Frac}[{AttackPower};{HitPoints}]"; +} + +int Width = 0; +int Height = 0; +Entity[,] Map = null; +List Units = null; + +readonly bool DUMP_REACHABLE = false; +readonly bool DUMP_PATHFINDING = false; +readonly bool DUMP_MAP = false; + +void Main() +{ + Load(File.ReadAllLines(Path.Combine(Path.GetDirectoryName(Util.CurrentQueryPath), @"15_input.txt"))); + + for (int gen = 0; ; gen++) + { + if (DUMP_MAP) DumpMap(gen); + + //if (gen==60)Util.Break(); + foreach (var u in Units.OrderBy(p=>p.Y).ThenBy(p=>p.X).ToList()) + { + if (!u.Alive) continue; + var success = Tick(u); + if (!success && (Units.Count(q => q.Frac == Fraction.Elf) == 0 || Units.Count(q => q.Frac == Fraction.Goblin) == 0)) + { + if (DUMP_MAP) DumpMap(gen+1); + + var winner = Units.Where(q => q.Frac != Fraction.Wall).Select(p => p.Frac).Distinct().Single(); + var count = Units.Count(q => q.Frac != Fraction.Wall); + var hpsum = Units.Where(q => q.Frac != Fraction.Wall).Sum(q => q.HitPoints); + $"Finished after {gen} rounds with {count} Units ({winner}) and {hpsum} Total HP. The score is [ {hpsum * gen} ] ".Dump(); + return; + } + } + } +} + +bool Tick(Entity e) +{ + var enemyFraction = e.Frac==Fraction.Elf ? Fraction.Goblin : Fraction.Elf; + + // [1] Fast Attack + { + Entity target = null; + if (e.Y > 0 && Map[e.X, e.Y - 1] != null && Map[e.X, e.Y - 1].Frac == enemyFraction && (target == null || Map[e.X, e.Y - 1].HitPoints < target.HitPoints)) target = Map[e.X, e.Y - 1]; + if (e.X > 0 && Map[e.X - 1, e.Y] != null && Map[e.X - 1, e.Y].Frac == enemyFraction && (target == null || Map[e.X - 1, e.Y].HitPoints < target.HitPoints)) target = Map[e.X - 1, e.Y]; + if (e.X < Width - 1 && Map[e.X + 1, e.Y] != null && Map[e.X + 1, e.Y].Frac == enemyFraction && (target == null || Map[e.X + 1, e.Y].HitPoints < target.HitPoints)) target = Map[e.X + 1, e.Y]; + if (e.Y < Height - 1 && Map[e.X, e.Y + 1] != null && Map[e.X, e.Y + 1].Frac == enemyFraction && (target == null || Map[e.X, e.Y + 1].HitPoints < target.HitPoints)) target = Map[e.X, e.Y + 1]; + + if (target != null) { Attack(e,target); return true; } + } + + // [2] Path Finding + { + var targetPos = ListTargets(enemyFraction) + .Select(p => (p, GetDistance( (e.X, e.Y), (p.x, p.y) ) ) ) + .Where(p => p.Item2!=null) + .OrderBy(p => p.Item2) + .ThenBy(p=>p.p.y) + .ThenBy(p=>p.p.x) + .Select(p=>p.p) + .FirstOrDefault(); + + if (targetPos==default) { return false; } + + int[,] matrix = DoPathFinding(targetPos.x, targetPos.y); + if (DUMP_PATHFINDING) DumpPathFinding(matrix, e, (targetPos.x, targetPos.y)); + + Tuple targetStep = null; + if (e.Y > 0 && matrix[e.X, e.Y - 1] >= 0 && matrix[e.X, e.Y - 1] < int.MaxValue && (targetStep == null || targetStep.Item3 > matrix[e.X, e.Y - 1])) targetStep = Tuple.Create(e.X, e.Y - 1, matrix[e.X, e.Y - 1]); + if (e.X > 0 && matrix[e.X - 1, e.Y] >= 0 && matrix[e.X - 1, e.Y] < int.MaxValue && (targetStep == null || targetStep.Item3 > matrix[e.X - 1, e.Y])) targetStep = Tuple.Create(e.X - 1, e.Y, matrix[e.X - 1, e.Y]); + if (e.X < Width - 1 && matrix[e.X + 1, e.Y] >= 0 && matrix[e.X + 1, e.Y] < int.MaxValue && (targetStep == null || targetStep.Item3 > matrix[e.X + 1, e.Y])) targetStep = Tuple.Create(e.X + 1, e.Y, matrix[e.X + 1, e.Y]); + if (e.Y < Height - 1 && matrix[e.X, e.Y + 1] >= 0 && matrix[e.X, e.Y + 1] < int.MaxValue && (targetStep == null || targetStep.Item3 > matrix[e.X, e.Y + 1])) targetStep = Tuple.Create(e.X, e.Y + 1, matrix[e.X, e.Y + 1]); + + //if (e.X > 0 && matrix[e.X - 1, e.Y] >= 0 && matrix[e.X - 1, e.Y] < int.MaxValue && (targetStep == null || targetStep.Item3 > matrix[e.X - 1, e.Y])) targetStep = Tuple.Create(e.X - 1, e.Y, matrix[e.X - 1, e.Y]); + //if (e.Y > 0 && matrix[e.X, e.Y - 1] >= 0 && matrix[e.X, e.Y - 1] < int.MaxValue && (targetStep == null || targetStep.Item3 > matrix[e.X, e.Y - 1])) targetStep = Tuple.Create(e.X, e.Y - 1, matrix[e.X, e.Y - 1]); + //if (e.Y < Height - 1 && matrix[e.X, e.Y + 1] >= 0 && matrix[e.X, e.Y + 1] < int.MaxValue && (targetStep == null || targetStep.Item3 > matrix[e.X, e.Y + 1])) targetStep = Tuple.Create(e.X, e.Y + 1, matrix[e.X, e.Y + 1]); + //if (e.X < Width - 1 && matrix[e.X + 1, e.Y] >= 0 && matrix[e.X + 1, e.Y] < int.MaxValue && (targetStep == null || targetStep.Item3 > matrix[e.X + 1, e.Y])) targetStep = Tuple.Create(e.X + 1, e.Y, matrix[e.X + 1, e.Y]); + + if (targetStep == null) { return false; } + Move(e, targetStep.Item1, targetStep.Item2); + + // [3] Normal Attack + if (targetStep.Item3 == 0) + { + Entity att = null; + if (e.Y > 0 && Map[e.X, e.Y - 1] != null && Map[e.X, e.Y - 1].Frac==enemyFraction && (att == null || att.HitPoints > Map[e.X, e.Y - 1].HitPoints)) att = Map[e.X, e.Y - 1]; + if (e.X > 0 && Map[e.X - 1, e.Y] != null && Map[e.X - 1, e.Y].Frac==enemyFraction && (att == null || att.HitPoints > Map[e.X - 1, e.Y].HitPoints)) att = Map[e.X - 1, e.Y]; + if (e.X < Width - 1 && Map[e.X + 1, e.Y] != null && Map[e.X + 1, e.Y].Frac == enemyFraction && (att == null || att.HitPoints > Map[e.X + 1, e.Y].HitPoints)) att = Map[e.X + 1, e.Y]; + if (e.X < Height - 1 && Map[e.X, e.Y + 1] != null && Map[e.X, e.Y + 1].Frac == enemyFraction && (att == null || att.HitPoints > Map[e.X, e.Y + 1].HitPoints)) att = Map[e.X, e.Y + 1]; + Attack(e, att); + return true; + } + return true; + } +} + +int? GetDistance((int x, int y) p1, (int x, int y) p2) +{ + int[,] dmap = new int[Width, Height]; + var workload = new Stack<(int, int)>(); // + workload.Push((p1.x, p1.y)); + + for (int yy = 0; yy < Height; yy++) for (int xx = 0; xx < Width; xx++) dmap[xx, yy] = (Map[xx, yy] != null) ? -1 : int.MaxValue; + dmap[p1.x, p1.y] = 0; + dmap[p2.x, p2.y] = int.MaxValue; + + while (workload.Any()) + { + (var x, var y) = workload.Pop(); + + if (y > 0 && dmap[x, y - 1] - 1 > dmap[x, y]) { dmap[x, y - 1] = dmap[x, y] + 1; workload.Push((x, y - 1)); } // [N] + if (x < Width - 1 && dmap[x + 1, y ] - 1 > dmap[x, y]) { dmap[x + 1, y] = dmap[x, y] + 1; workload.Push((x + 1, y )); } // [E] + if (x > 0 && dmap[x - 1, y ] - 1 > dmap[x, y]) { dmap[x - 1, y] = dmap[x, y] + 1; workload.Push((x - 1, y )); } // [W] + if (y < Height - 1 && dmap[x, y + 1] - 1 > dmap[x, y]) { dmap[x, y + 1] = dmap[x, y] + 1; workload.Push((x, y + 1)); } // [S] + } + + if (DUMP_REACHABLE) DumpReachable(dmap, p1, p2); + + return dmap[p2.x, p2.y]==int.MaxValue ? (int?)null : dmap[p2.x, p2.y]; +} + +void Move(Entity e, int x, int y) +{ + Map[e.X, e.Y] = null; + e.X = x; + e.Y = y; + Map[e.X, e.Y] = e; +} + +IEnumerable<(int x,int y, Entity e)> ListTargets(Fraction destFrac) +{ + foreach (var u in Units.Where(q => q.Frac==destFrac)) + { + if (u.Y > 0 && Map[u.X, u.Y - 1] == null) yield return (u.X, u.Y - 1, u); // [N] + if (u.X < Width - 1 && Map[u.X + 1, u.Y ] == null) yield return (u.X + 1, u.Y, u); // [E] + if (u.X > 0 && Map[u.X - 1, u.Y ] == null) yield return (u.X - 1, u.Y, u); // [W] + if (u.Y < Height - 1 && Map[u.X, u.Y + 1] == null) yield return (u.X, u.Y + 1, u); // [S] + } + +} + +int[,] DoPathFinding(int dx, int dy) +{ + int[,] dmap = new int[Width, Height]; + var workload = new Stack<(int, int)>(); // + workload.Push((dx, dy)); + + for (int yy = 0; yy < Height; yy++) for (int xx = 0; xx < Width; xx++) dmap[xx,yy] = (Map[xx,yy]!=null) ? -1 : int.MaxValue; + dmap[dx,dy]=0; + + while (workload.Any()) + { + (var x, var y) = workload.Pop(); + + if (y > 0 && dmap[x, y - 1] - 1 > dmap[x, y]) { dmap[x, y - 1] = dmap[x, y] + 1; workload.Push((x, y - 1)); } // [N] + if (x < Width - 1 && dmap[x + 1, y] - 1 > dmap[x, y]) { dmap[x + 1, y] = dmap[x, y] + 1; workload.Push((x + 1, y)); } // [E] + if (x > 0 && dmap[x - 1, y] - 1 > dmap[x, y]) { dmap[x - 1, y] = dmap[x, y] + 1; workload.Push((x - 1, y)); } // [W] + if (y < Height - 1 && dmap[x, y + 1] - 1 > dmap[x, y]) { dmap[x, y + 1] = dmap[x, y] + 1; workload.Push((x, y + 1)); } // [S] + } + + return dmap; +} + +void Attack(Entity src, Entity dst) +{ + dst.HitPoints -= src.AttackPower; + if (dst.HitPoints <= 0) { dst.Alive = false; Units.Remove(dst); Map[dst.X, dst.Y] = null; } +} + +void DumpPathFinding(int[,] dmap, Entity src, (int X, int Y) dst) +{ + StringBuilder b = new StringBuilder(); + for (int yy = 0; yy < Height; yy++) + { + b.Append(" "); + for (int xx = 0; xx < Width; xx++) + { + if (xx == src.X && yy == src.Y) b.Append('+'); + else if (xx == dst.X && yy == dst.Y) b.Append('O'); + else if (dmap[xx, yy] == int.MaxValue) b.Append(' '); + else if (dmap[xx, yy] < 0) b.Append('#'); + else if (dmap[xx, yy] <= 9) b.Append(dmap[xx, yy]); + else if (dmap[xx, yy] < 36) b.Append((char)('A' + (dmap[xx, yy] - 10))); + else b.Append('$'); + } + b.AppendLine(); + } + b.ToString().Dump(); +} + +void DumpReachable(int[,] rmap, (int X, int Y) src, (int X, int Y) dst) +{ + StringBuilder b = new StringBuilder(); + for (int yy = 0; yy < Height; yy++) + { + b.Append(": "); + for (int xx = 0; xx < Width; xx++) + { + if (xx == src.X && yy == src.Y) b.Append('+'); + else if (xx == dst.X && yy == dst.Y) b.Append('O'); + else if (Map[xx,yy]?.Frac==Fraction.Wall) b.Append('#'); + else if (rmap[xx, yy] < int.MaxValue) b.Append(' '); + else if (rmap[xx, yy] == int.MaxValue) b.Append('.'); + else b.Append('$'); + } + b.AppendLine(); + } + b.ToString().Dump(); +} + +void DumpMap(int gen) +{ + StringBuilder b = new StringBuilder(); + for (int yy = 0; yy < Height; yy++) + { + List extra = new List(); + + for (int xx = 0; xx < Width; xx++) + { + if (Map[xx, yy] == null) { b.Append('.'); } + else if (Map[xx, yy].Frac == Fraction.Wall) { b.Append('#'); } + else if (Map[xx, yy].Frac == Fraction.Elf) { b.Append('E'); extra.Add($"E({Map[xx, yy].HitPoints})"); } + else if (Map[xx, yy].Frac == Fraction.Goblin) { b.Append('G'); extra.Add($"G({Map[xx, yy].HitPoints})"); } + else throw new Exception($"[{xx}|{yy}] := {Map[xx,yy]}"); + } + b.Append($" {string.Join(", ", extra)}{(extra.Any()?", ":"")}"); + b.AppendLine(); + } + $"After {gen} rounds:".Dump(); + b.ToString().Trim().Dump(); + $"{new string(' ', Width)} HP[G] := {Units.Where(p => p.Frac == Fraction.Goblin).Sum(p => p.HitPoints)}".Dump(); + $"{new string(' ', Width)} HP[E] := {Units.Where(p => p.Frac == Fraction.Elf).Sum(p => p.HitPoints)}".Dump(); + "".Dump(); + "".Dump(); + "".Dump(); +} + +void Load(string[] input) +{ + Width = input[0].Length; + Height = input.Length; + Map = new UserQuery.Entity[Width, Height]; + Units = new List(); + + for (int yy = 0; yy < Height; yy++) + { + for (int xx = 0; xx < Width; xx++) + { + if (input[yy][xx] == '#') + Map[xx, yy] = new Entity { Frac = Fraction.Wall, AttackPower = 0, HitPoints = int.MaxValue, X=xx, Y=yy, Alive=true }; + else if (input[yy][xx] == '.') + Map[xx, yy] = null; + else if (input[yy][xx] == 'E') + Units.Add(Map[xx, yy] = new Entity { Frac = Fraction.Elf, AttackPower = 3, HitPoints = 200, X=xx, Y=yy, Alive=true }); + else if (input[yy][xx] == 'G') + Units.Add(Map[xx, yy] = new Entity { Frac = Fraction.Goblin, AttackPower = 3, HitPoints = 200, X=xx, Y=yy, Alive=true }); + else + throw new Exception($"[{xx}|{yy}] := {input[xx][yy]}"); + } + } +} + diff --git a/www/statics/aoc/2018/15-2.linq b/www/statics/aoc/2018/15-2.linq new file mode 100644 index 0000000..56f6220 --- /dev/null +++ b/www/statics/aoc/2018/15-2.linq @@ -0,0 +1,287 @@ + + +enum Fraction { Wall, Elf, Goblin } + +class Entity +{ + public Fraction Frac; + public int AttackPower; + public int HitPoints; + public int X, Y; + public bool Alive; + + public override string ToString() => $"{Frac}[{AttackPower};{HitPoints}]"; +} + +int Width = 0; +int Height = 0; +Entity[,] Map = null; +List Units = null; + +readonly bool DUMP_REACHABLE = false; +readonly bool DUMP_PATHFINDING = false; +readonly bool DUMP_MAP = false; + +void Main() +{ + var input = File.ReadAllLines(Path.Combine(Path.GetDirectoryName(Util.CurrentQueryPath), @"15_input.txt")); + + for (int pwr = 3; ; pwr++) + { + Load(input, pwr); + + try + { + for (int gen = 0; ; gen++) + { + if (DUMP_MAP) DumpMap(gen); + + //if (gen==60)Util.Break(); + foreach (var u in Units.OrderBy(p => p.Y).ThenBy(p => p.X).ToList()) + { + if (!u.Alive) continue; + var success = Tick(u); + if (!success && (Units.Count(q => q.Frac == Fraction.Elf) == 0 || Units.Count(q => q.Frac == Fraction.Goblin) == 0)) + { + if (DUMP_MAP) DumpMap(gen + 1); + + var winner = Units.Where(q => q.Frac != Fraction.Wall).Select(p => p.Frac).Distinct().Single(); + var count = Units.Count(q => q.Frac != Fraction.Wall); + var hpsum = Units.Where(q => q.Frac != Fraction.Wall).Sum(q => q.HitPoints); + $"Finished after {gen} rounds with {count} Units ({winner}), {hpsum} total HP and {pwr} Elf-power. The score is [ {hpsum * gen} ] ".Dump(); + return; + } + } + } + } + catch (Exception) {} + } + +} + +bool Tick(Entity e) +{ + var enemyFraction = e.Frac == Fraction.Elf ? Fraction.Goblin : Fraction.Elf; + + // [1] Fast Attack + { + Entity target = null; + if (e.Y > 0 && Map[e.X, e.Y - 1] != null && Map[e.X, e.Y - 1].Frac == enemyFraction && (target == null || Map[e.X, e.Y - 1].HitPoints < target.HitPoints)) target = Map[e.X, e.Y - 1]; + if (e.X > 0 && Map[e.X - 1, e.Y] != null && Map[e.X - 1, e.Y].Frac == enemyFraction && (target == null || Map[e.X - 1, e.Y].HitPoints < target.HitPoints)) target = Map[e.X - 1, e.Y]; + if (e.X < Width - 1 && Map[e.X + 1, e.Y] != null && Map[e.X + 1, e.Y].Frac == enemyFraction && (target == null || Map[e.X + 1, e.Y].HitPoints < target.HitPoints)) target = Map[e.X + 1, e.Y]; + if (e.Y < Height - 1 && Map[e.X, e.Y + 1] != null && Map[e.X, e.Y + 1].Frac == enemyFraction && (target == null || Map[e.X, e.Y + 1].HitPoints < target.HitPoints)) target = Map[e.X, e.Y + 1]; + + if (target != null) { Attack(e, target); return true; } + } + + // [2] Path Finding + { + var targetPos = ListTargets(enemyFraction) + .Select(p => (p, GetDistance((e.X, e.Y), (p.x, p.y)))) + .Where(p => p.Item2 != null) + .OrderBy(p => p.Item2) + .ThenBy(p => p.p.y) + .ThenBy(p => p.p.x) + .Select(p => p.p) + .FirstOrDefault(); + + if (targetPos == default) { return false; } + + int[,] matrix = DoPathFinding(targetPos.x, targetPos.y); + if (DUMP_PATHFINDING) DumpPathFinding(matrix, e, (targetPos.x, targetPos.y)); + + Tuple targetStep = null; + if (e.Y > 0 && matrix[e.X, e.Y - 1] >= 0 && matrix[e.X, e.Y - 1] < int.MaxValue && (targetStep == null || targetStep.Item3 > matrix[e.X, e.Y - 1])) targetStep = Tuple.Create(e.X, e.Y - 1, matrix[e.X, e.Y - 1]); + if (e.X > 0 && matrix[e.X - 1, e.Y] >= 0 && matrix[e.X - 1, e.Y] < int.MaxValue && (targetStep == null || targetStep.Item3 > matrix[e.X - 1, e.Y])) targetStep = Tuple.Create(e.X - 1, e.Y, matrix[e.X - 1, e.Y]); + if (e.X < Width - 1 && matrix[e.X + 1, e.Y] >= 0 && matrix[e.X + 1, e.Y] < int.MaxValue && (targetStep == null || targetStep.Item3 > matrix[e.X + 1, e.Y])) targetStep = Tuple.Create(e.X + 1, e.Y, matrix[e.X + 1, e.Y]); + if (e.Y < Height - 1 && matrix[e.X, e.Y + 1] >= 0 && matrix[e.X, e.Y + 1] < int.MaxValue && (targetStep == null || targetStep.Item3 > matrix[e.X, e.Y + 1])) targetStep = Tuple.Create(e.X, e.Y + 1, matrix[e.X, e.Y + 1]); + + //if (e.X > 0 && matrix[e.X - 1, e.Y] >= 0 && matrix[e.X - 1, e.Y] < int.MaxValue && (targetStep == null || targetStep.Item3 > matrix[e.X - 1, e.Y])) targetStep = Tuple.Create(e.X - 1, e.Y, matrix[e.X - 1, e.Y]); + //if (e.Y > 0 && matrix[e.X, e.Y - 1] >= 0 && matrix[e.X, e.Y - 1] < int.MaxValue && (targetStep == null || targetStep.Item3 > matrix[e.X, e.Y - 1])) targetStep = Tuple.Create(e.X, e.Y - 1, matrix[e.X, e.Y - 1]); + //if (e.Y < Height - 1 && matrix[e.X, e.Y + 1] >= 0 && matrix[e.X, e.Y + 1] < int.MaxValue && (targetStep == null || targetStep.Item3 > matrix[e.X, e.Y + 1])) targetStep = Tuple.Create(e.X, e.Y + 1, matrix[e.X, e.Y + 1]); + //if (e.X < Width - 1 && matrix[e.X + 1, e.Y] >= 0 && matrix[e.X + 1, e.Y] < int.MaxValue && (targetStep == null || targetStep.Item3 > matrix[e.X + 1, e.Y])) targetStep = Tuple.Create(e.X + 1, e.Y, matrix[e.X + 1, e.Y]); + + if (targetStep == null) { return false; } + Move(e, targetStep.Item1, targetStep.Item2); + + // [3] Normal Attack + if (targetStep.Item3 == 0) + { + Entity att = null; + if (e.Y > 0 && Map[e.X, e.Y - 1] != null && Map[e.X, e.Y - 1].Frac == enemyFraction && (att == null || att.HitPoints > Map[e.X, e.Y - 1].HitPoints)) att = Map[e.X, e.Y - 1]; + if (e.X > 0 && Map[e.X - 1, e.Y] != null && Map[e.X - 1, e.Y].Frac == enemyFraction && (att == null || att.HitPoints > Map[e.X - 1, e.Y].HitPoints)) att = Map[e.X - 1, e.Y]; + if (e.X < Width - 1 && Map[e.X + 1, e.Y] != null && Map[e.X + 1, e.Y].Frac == enemyFraction && (att == null || att.HitPoints > Map[e.X + 1, e.Y].HitPoints)) att = Map[e.X + 1, e.Y]; + if (e.X < Height - 1 && Map[e.X, e.Y + 1] != null && Map[e.X, e.Y + 1].Frac == enemyFraction && (att == null || att.HitPoints > Map[e.X, e.Y + 1].HitPoints)) att = Map[e.X, e.Y + 1]; + Attack(e, att); + return true; + } + return true; + } +} + +int? GetDistance((int x, int y) p1, (int x, int y) p2) +{ + int[,] dmap = new int[Width, Height]; + var workload = new Stack<(int, int)>(); // + workload.Push((p1.x, p1.y)); + + for (int yy = 0; yy < Height; yy++) for (int xx = 0; xx < Width; xx++) dmap[xx, yy] = (Map[xx, yy] != null) ? -1 : int.MaxValue; + dmap[p1.x, p1.y] = 0; + dmap[p2.x, p2.y] = int.MaxValue; + + while (workload.Any()) + { + (var x, var y) = workload.Pop(); + + if (y > 0 && dmap[x, y - 1] - 1 > dmap[x, y]) { dmap[x, y - 1] = dmap[x, y] + 1; workload.Push((x, y - 1)); } // [N] + if (x < Width - 1 && dmap[x + 1, y] - 1 > dmap[x, y]) { dmap[x + 1, y] = dmap[x, y] + 1; workload.Push((x + 1, y)); } // [E] + if (x > 0 && dmap[x - 1, y] - 1 > dmap[x, y]) { dmap[x - 1, y] = dmap[x, y] + 1; workload.Push((x - 1, y)); } // [W] + if (y < Height - 1 && dmap[x, y + 1] - 1 > dmap[x, y]) { dmap[x, y + 1] = dmap[x, y] + 1; workload.Push((x, y + 1)); } // [S] + } + + if (DUMP_REACHABLE) DumpReachable(dmap, p1, p2); + + return dmap[p2.x, p2.y] == int.MaxValue ? (int?)null : dmap[p2.x, p2.y]; +} + +void Move(Entity e, int x, int y) +{ + Map[e.X, e.Y] = null; + e.X = x; + e.Y = y; + Map[e.X, e.Y] = e; +} + +IEnumerable<(int x, int y, Entity e)> ListTargets(Fraction destFrac) +{ + foreach (var u in Units.Where(q => q.Frac == destFrac)) + { + if (u.Y > 0 && Map[u.X, u.Y - 1] == null) yield return (u.X, u.Y - 1, u); // [N] + if (u.X < Width - 1 && Map[u.X + 1, u.Y] == null) yield return (u.X + 1, u.Y, u); // [E] + if (u.X > 0 && Map[u.X - 1, u.Y] == null) yield return (u.X - 1, u.Y, u); // [W] + if (u.Y < Height - 1 && Map[u.X, u.Y + 1] == null) yield return (u.X, u.Y + 1, u); // [S] + } + +} + +int[,] DoPathFinding(int dx, int dy) +{ + int[,] dmap = new int[Width, Height]; + var workload = new Stack<(int, int)>(); // + workload.Push((dx, dy)); + + for (int yy = 0; yy < Height; yy++) for (int xx = 0; xx < Width; xx++) dmap[xx, yy] = (Map[xx, yy] != null) ? -1 : int.MaxValue; + dmap[dx, dy] = 0; + + while (workload.Any()) + { + (var x, var y) = workload.Pop(); + + if (y > 0 && dmap[x, y - 1] - 1 > dmap[x, y]) { dmap[x, y - 1] = dmap[x, y] + 1; workload.Push((x, y - 1)); } // [N] + if (x < Width - 1 && dmap[x + 1, y] - 1 > dmap[x, y]) { dmap[x + 1, y] = dmap[x, y] + 1; workload.Push((x + 1, y)); } // [E] + if (x > 0 && dmap[x - 1, y] - 1 > dmap[x, y]) { dmap[x - 1, y] = dmap[x, y] + 1; workload.Push((x - 1, y)); } // [W] + if (y < Height - 1 && dmap[x, y + 1] - 1 > dmap[x, y]) { dmap[x, y + 1] = dmap[x, y] + 1; workload.Push((x, y + 1)); } // [S] + } + + return dmap; +} + +void Attack(Entity src, Entity dst) +{ + dst.HitPoints -= src.AttackPower; + if (dst.HitPoints <= 0) { dst.Alive = false; Units.Remove(dst); Map[dst.X, dst.Y] = null; if (dst.Frac==Fraction.Elf)throw new Exception("DEATH"); } +} + +void DumpPathFinding(int[,] dmap, Entity src, (int X, int Y) dst) +{ + StringBuilder b = new StringBuilder(); + for (int yy = 0; yy < Height; yy++) + { + b.Append(" "); + for (int xx = 0; xx < Width; xx++) + { + if (xx == src.X && yy == src.Y) b.Append('+'); + else if (xx == dst.X && yy == dst.Y) b.Append('O'); + else if (dmap[xx, yy] == int.MaxValue) b.Append(' '); + else if (dmap[xx, yy] < 0) b.Append('#'); + else if (dmap[xx, yy] <= 9) b.Append(dmap[xx, yy]); + else if (dmap[xx, yy] < 36) b.Append((char)('A' + (dmap[xx, yy] - 10))); + else b.Append('$'); + } + b.AppendLine(); + } + b.ToString().Dump(); +} + +void DumpReachable(int[,] rmap, (int X, int Y) src, (int X, int Y) dst) +{ + StringBuilder b = new StringBuilder(); + for (int yy = 0; yy < Height; yy++) + { + b.Append(": "); + for (int xx = 0; xx < Width; xx++) + { + if (xx == src.X && yy == src.Y) b.Append('+'); + else if (xx == dst.X && yy == dst.Y) b.Append('O'); + else if (Map[xx, yy]?.Frac == Fraction.Wall) b.Append('#'); + else if (rmap[xx, yy] < int.MaxValue) b.Append(' '); + else if (rmap[xx, yy] == int.MaxValue) b.Append('.'); + else b.Append('$'); + } + b.AppendLine(); + } + b.ToString().Dump(); +} + +void DumpMap(int gen) +{ + StringBuilder b = new StringBuilder(); + for (int yy = 0; yy < Height; yy++) + { + List extra = new List(); + + for (int xx = 0; xx < Width; xx++) + { + if (Map[xx, yy] == null) { b.Append('.'); } + else if (Map[xx, yy].Frac == Fraction.Wall) { b.Append('#'); } + else if (Map[xx, yy].Frac == Fraction.Elf) { b.Append('E'); extra.Add($"E({Map[xx, yy].HitPoints})"); } + else if (Map[xx, yy].Frac == Fraction.Goblin) { b.Append('G'); extra.Add($"G({Map[xx, yy].HitPoints})"); } + else throw new Exception($"[{xx}|{yy}] := {Map[xx, yy]}"); + } + b.Append($" {string.Join(", ", extra)}{(extra.Any() ? ", " : "")}"); + b.AppendLine(); + } + $"After {gen} rounds:".Dump(); + b.ToString().Trim().Dump(); + $"{new string(' ', Width)} HP[G] := {Units.Where(p => p.Frac == Fraction.Goblin).Sum(p => p.HitPoints)}".Dump(); + $"{new string(' ', Width)} HP[E] := {Units.Where(p => p.Frac == Fraction.Elf).Sum(p => p.HitPoints)}".Dump(); + "".Dump(); + "".Dump(); + "".Dump(); +} + +void Load(string[] input, int pwr) +{ + Width = input[0].Length; + Height = input.Length; + Map = new UserQuery.Entity[Width, Height]; + Units = new List(); + + for (int yy = 0; yy < Height; yy++) + { + for (int xx = 0; xx < Width; xx++) + { + if (input[yy][xx] == '#') + Map[xx, yy] = new Entity { Frac = Fraction.Wall, AttackPower = 0, HitPoints = int.MaxValue, X = xx, Y = yy, Alive = true }; + else if (input[yy][xx] == '.') + Map[xx, yy] = null; + else if (input[yy][xx] == 'E') + Units.Add(Map[xx, yy] = new Entity { Frac = Fraction.Elf, AttackPower = pwr, HitPoints = 200, X = xx, Y = yy, Alive = true }); + else if (input[yy][xx] == 'G') + Units.Add(Map[xx, yy] = new Entity { Frac = Fraction.Goblin, AttackPower = 3, HitPoints = 200, X = xx, Y = yy, Alive = true }); + else + throw new Exception($"[{xx}|{yy}] := {input[xx][yy]}"); + } + } +} + diff --git a/www/statics/aoc/2018/15_challenge.txt b/www/statics/aoc/2018/15_challenge.txt new file mode 100644 index 0000000..71fec9e --- /dev/null +++ b/www/statics/aoc/2018/15_challenge.txt @@ -0,0 +1,369 @@ +--- Day 15: Beverage Bandits --- + +Having perfected their hot chocolate, the Elves have a new problem: the Goblins 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). + +Combat proceeds in rounds; in each round, each unit that is still alive takes a turn, resolving all of its actions before the next unit's turn begins. On each unit's turn, it tries to move into range of an enemy (if it isn't already) and then attack (if it is in range). + +All units are very disciplined and always follow very strict combat rules. Units never move or attack diagonally, as doing so would be dishonorable. When multiple choices are equally valid, ties are broken in reading order: top-to-bottom, then left-to-right. For instance, the order in which units take their turns within a round is the reading order of their starting positions in that round, regardless of the type of unit or whether other units have moved after the round started. For example: + + would take their +These units: turns in this order: + ####### ####### + #.G.E.# #.1.2.# + #E.G.E# #3.4.5# + #.G.E.# #.6.7.# + ####### ####### + +Each unit begins its turn by identifying all possible targets (enemy units). If no targets remain, combat ends. + +Then, the unit identifies all of the open squares (.) that are in range of each target; these are the squares which are adjacent (immediately up, down, left, or right) to any target and which aren't already occupied by a wall or another unit. Alternatively, the unit might already be in range of a target. If the unit is not already in range of a target, and there are no open squares which are in range of a target, the unit ends its turn. + +If the unit is already in range of a target, it does not move, but continues its turn with an attack. Otherwise, since it is not in range of a target, it moves. + +To move, the unit first considers the squares that are in range and determines which of those squares it could reach in the fewest steps. A step is a single movement to any adjacent (immediately up, down, left, or right) open (.) square. Units cannot move into walls or other units. The unit does this while considering the current positions of units and does not do any prediction about where units will be later. If the unit cannot reach (find an open path to) any of the squares that are in range, it ends its turn. If multiple squares are in range and tied for being reachable in the fewest steps, the square which is first in reading order is chosen. For example: + +Targets: In range: Reachable: Nearest: Chosen: +####### ####### ####### ####### ####### +#E..G.# #E.?G?# #E.@G.# #E.!G.# #E.+G.# +#...#.# --> #.?.#?# --> #.@.#.# --> #.!.#.# --> #...#.# +#.G.#G# #?G?#G# #@G@#G# #!G.#G# #.G.#G# +####### ####### ####### ####### ####### + +In the above scenario, the Elf has three targets (the three Goblins): + + Each of the Goblins has open, adjacent squares which are in range (marked with a ? on the map). + Of those squares, four are reachable (marked @); the other two (on the right) would require moving through a wall or unit to reach. + Three of these reachable squares are nearest, requiring the fewest steps (only 2) to reach (marked !). + Of those, the square which is first in reading order is chosen (+). + +The unit then takes a single step toward the chosen square along the shortest path to that square. If multiple steps would put the unit equally closer to its destination, the unit chooses the step which is first in reading order. (This requires knowing when there is more than one shortest path so that you can consider the first step of each such path.) For example: + +In range: Nearest: Chosen: Distance: Step: +####### ####### ####### ####### ####### +#.E...# #.E...# #.E...# #4E212# #..E..# +#...?.# --> #...!.# --> #...+.# --> #32101# --> #.....# +#..?G?# #..!G.# #...G.# #432G2# #...G.# +####### ####### ####### ####### ####### + +The Elf sees three squares in range of a target (?), two of which are nearest (!), and so the first in reading order is chosen (+). Under "Distance", each open square is marked with its distance from the destination square; the two squares to which the Elf could move on this turn (down and to the right) are both equally good moves and would leave the Elf 2 steps from being in range of the Goblin. Because the step which is first in reading order is chosen, the Elf moves right one square. + +Here's a larger example of movement: + +Initially: +######### +#G..G..G# +#.......# +#.......# +#G..E..G# +#.......# +#.......# +#G..G..G# +######### + +After 1 round: +######### +#.G...G.# +#...G...# +#...E..G# +#.G.....# +#.......# +#G..G..G# +#.......# +######### + +After 2 rounds: +######### +#..G.G..# +#...G...# +#.G.E.G.# +#.......# +#G..G..G# +#.......# +#.......# +######### + +After 3 rounds: +######### +#.......# +#..GGG..# +#..GEG..# +#G..G...# +#......G# +#.......# +#.......# +######### + +Once the Goblins and Elf reach the positions above, they all are either in range of a target or cannot find any square in range of a target, and so none of the units can move until a unit dies. + +After moving (or if the unit began its turn in range of a target), the unit attacks. + +To attack, the unit first determines all of the targets that are in range of it by being immediately adjacent to it. If there are no such targets, the unit ends its turn. Otherwise, the adjacent target with the fewest hit points is selected; in a tie, the adjacent target with the fewest hit points which is first in reading order is selected. + +The unit deals damage equal to its attack power to the selected target, reducing its hit points by that amount. If this reduces its hit points to 0 or fewer, the selected target dies: its square becomes . and it takes no further turns. + +Each unit, either Goblin or Elf, has 3 attack power and starts with 200 hit points. + +For example, suppose the only Elf is about to attack: + + HP: HP: +G.... 9 G.... 9 +..G.. 4 ..G.. 4 +..EG. 2 --> ..E.. +..G.. 2 ..G.. 2 +...G. 1 ...G. 1 + +The "HP" column shows the hit points of the Goblin to the left in the corresponding row. The Elf is in range of three targets: the Goblin above it (with 4 hit points), the Goblin to its right (with 2 hit points), and the Goblin below it (also with 2 hit points). Because three targets are in range, the ones with the lowest hit points are selected: the two Goblins with 2 hit points each (one to the right of the Elf and one below the Elf). Of those, the Goblin first in reading order (the one to the right of the Elf) is selected. The selected Goblin's hit points (2) are reduced by the Elf's attack power (3), reducing its hit points to -1, killing it. + +After attacking, the unit's turn ends. Regardless of how the unit's turn ends, the next unit in the round takes its turn. If all units have taken turns in this round, the round ends, and a new round begins. + +The Elves look quite outnumbered. You need to determine the outcome of the battle: the number of full rounds that were completed (not counting the round in which combat ends) multiplied by the sum of the hit points of all remaining units at the moment combat ends. (Combat only ends when a unit finds no targets during its turn.) + +Below is an entire sample combat. Next to each map, each row's units' hit points are listed from left to right. + +Initially: +####### +#.G...# G(200) +#...EG# E(200), G(200) +#.#.#G# G(200) +#..G#E# G(200), E(200) +#.....# +####### + +After 1 round: +####### +#..G..# G(200) +#...EG# E(197), G(197) +#.#G#G# G(200), G(197) +#...#E# E(197) +#.....# +####### + +After 2 rounds: +####### +#...G.# G(200) +#..GEG# G(200), E(188), G(194) +#.#.#G# G(194) +#...#E# E(194) +#.....# +####### + +Combat ensues; eventually, the top Elf dies: + +After 23 rounds: +####### +#...G.# G(200) +#..G.G# G(200), G(131) +#.#.#G# G(131) +#...#E# E(131) +#.....# +####### + +After 24 rounds: +####### +#..G..# G(200) +#...G.# G(131) +#.#G#G# G(200), G(128) +#...#E# E(128) +#.....# +####### + +After 25 rounds: +####### +#.G...# G(200) +#..G..# G(131) +#.#.#G# G(125) +#..G#E# G(200), E(125) +#.....# +####### + +After 26 rounds: +####### +#G....# G(200) +#.G...# G(131) +#.#.#G# G(122) +#...#E# E(122) +#..G..# G(200) +####### + +After 27 rounds: +####### +#G....# G(200) +#.G...# G(131) +#.#.#G# G(119) +#...#E# E(119) +#...G.# G(200) +####### + +After 28 rounds: +####### +#G....# G(200) +#.G...# G(131) +#.#.#G# G(116) +#...#E# E(113) +#....G# G(200) +####### + +More combat ensues; eventually, the bottom Elf dies: + +After 47 rounds: +####### +#G....# G(200) +#.G...# G(131) +#.#.#G# G(59) +#...#.# +#....G# G(200) +####### + +Before the 48th round can finish, the top-left Goblin finds that there are no targets remaining, and so combat ends. So, the number of full rounds that were completed is 47, and the sum of the hit points of all remaining units is 200+131+59+200 = 590. From these, the outcome of the battle is 47 * 590 = 27730. + +Here are a few example summarized combats: + +####### ####### +#G..#E# #...#E# E(200) +#E#E.E# #E#...# E(197) +#G.##.# --> #.E##.# E(185) +#...#E# #E..#E# E(200), E(200) +#...E.# #.....# +####### ####### + +Combat ends after 37 full rounds +Elves win with 982 total hit points left +Outcome: 37 * 982 = 36334 + +####### ####### +#E..EG# #.E.E.# E(164), E(197) +#.#G.E# #.#E..# E(200) +#E.##E# --> #E.##.# E(98) +#G..#.# #.E.#.# E(200) +#..E#.# #...#.# +####### ####### + +Combat ends after 46 full rounds +Elves win with 859 total hit points left +Outcome: 46 * 859 = 39514 + +####### ####### +#E.G#.# #G.G#.# G(200), G(98) +#.#G..# #.#G..# G(200) +#G.#.G# --> #..#..# +#G..#.# #...#G# G(95) +#...E.# #...G.# G(200) +####### ####### + +Combat ends after 35 full rounds +Goblins win with 793 total hit points left +Outcome: 35 * 793 = 27755 + +####### ####### +#.E...# #.....# +#.#..G# #.#G..# G(200) +#.###.# --> #.###.# +#E#G#G# #.#.#.# +#...#G# #G.G#G# G(98), G(38), G(200) +####### ####### + +Combat ends after 54 full rounds +Goblins win with 536 total hit points left +Outcome: 54 * 536 = 28944 + +######### ######### +#G......# #.G.....# G(137) +#.E.#...# #G.G#...# G(200), G(200) +#..##..G# #.G##...# G(200) +#...##..# --> #...##..# +#...#...# #.G.#...# G(200) +#.G...G.# #.......# +#.....G.# #.......# +######### ######### + +Combat ends after 20 full rounds +Goblins win with 937 total hit points left +Outcome: 20 * 937 = 18740 + +What is the outcome of the combat described in your puzzle input? + +--- Part Two --- + +According to your calculations, the Elves are going to lose badly. Surely, you won't mess up the timeline too much if you give them just a little advanced technology, right? + +You need to make sure the Elves not only win, but also suffer no losses: even the death of a single Elf is unacceptable. + +However, you can't go too far: larger changes will be more likely to permanently alter spacetime. + +So, you need to find the outcome of the battle in which the Elves have the lowest integer attack power (at least 4) that allows them to win without a single death. The Goblins always have an attack power of 3. + +In the first summarized example above, the lowest attack power the Elves need to win without losses is 15: + +####### ####### +#.G...# #..E..# E(158) +#...EG# #...E.# E(14) +#.#.#G# --> #.#.#.# +#..G#E# #...#.# +#.....# #.....# +####### ####### + +Combat ends after 29 full rounds +Elves win with 172 total hit points left +Outcome: 29 * 172 = 4988 + +In the second example above, the Elves need only 4 attack power: + +####### ####### +#E..EG# #.E.E.# E(200), E(23) +#.#G.E# #.#E..# E(200) +#E.##E# --> #E.##E# E(125), E(200) +#G..#.# #.E.#.# E(200) +#..E#.# #...#.# +####### ####### + +Combat ends after 33 full rounds +Elves win with 948 total hit points left +Outcome: 33 * 948 = 31284 + +In the third example above, the Elves need 15 attack power: + +####### ####### +#E.G#.# #.E.#.# E(8) +#.#G..# #.#E..# E(86) +#G.#.G# --> #..#..# +#G..#.# #...#.# +#...E.# #.....# +####### ####### + +Combat ends after 37 full rounds +Elves win with 94 total hit points left +Outcome: 37 * 94 = 3478 + +In the fourth example above, the Elves need 12 attack power: + +####### ####### +#.E...# #...E.# E(14) +#.#..G# #.#..E# E(152) +#.###.# --> #.###.# +#E#G#G# #.#.#.# +#...#G# #...#.# +####### ####### + +Combat ends after 39 full rounds +Elves win with 166 total hit points left +Outcome: 39 * 166 = 6474 + +In the last example above, the lone Elf needs 34 attack power: + +######### ######### +#G......# #.......# +#.E.#...# #.E.#...# E(38) +#..##..G# #..##...# +#...##..# --> #...##..# +#...#...# #...#...# +#.G...G.# #.......# +#.....G.# #.......# +######### ######### + +Combat ends after 30 full rounds +Elves win with 38 total hit points left +Outcome: 30 * 38 = 1140 + +After increasing the Elves' attack power until it is just barely enough for them to win without any Elves dying, what is the outcome of the combat described in your puzzle input? diff --git a/www/statics/aoc/2018/15_input.txt b/www/statics/aoc/2018/15_input.txt new file mode 100644 index 0000000..36086ec --- /dev/null +++ b/www/statics/aoc/2018/15_input.txt @@ -0,0 +1,32 @@ +################################ +#######..G###################### +########.....################### +##########....############.....# +###########...#####..#####.....# +###########G..###GG....G.......# +##########.G#####G...#######..## +###########...G.#...############ +#####.#####..........####....### +####.....###.........##.#....### +####.#................G....##### +####......#.................#### +##....#G......#####........##### +########....G#######.......##### +########..G.#########.E...###### +########....#########.....###### +#######.....#########.....###### +#######...G.#########....####### +#######...#.#########....####### +####.G.G.....#######...#.####### +##...#...G....#####E...#.####### +###..#.G.##...E....E.......###.# +######...................#....E# +#######...............E.######## +#G###...#######....E...######### +#..##.######.E#.#.....########## +#..#....##......##.E...######### +#G......###.#..##......######### +#....#######....G....E.######### +#.##########..........########## +#############.###.......######## +################################ \ No newline at end of file diff --git a/www/statics/aoc/2018/16-1.linq b/www/statics/aoc/2018/16-1.linq new file mode 100644 index 0000000..5ddbc3b --- /dev/null +++ b/www/statics/aoc/2018/16-1.linq @@ -0,0 +1,75 @@ + + +class Command +{ + public int OpCode, Arg1, Arg2, Dst; + public Command(int[] a) { OpCode=a[0];Arg1=a[1];Arg2=a[2];Dst=a[3]; } +} + +(string, Action)[] Operations = new (string, Action)[] +{ + ("addr", (reg, cmd) => { reg[cmd.Dst] = reg[cmd.Arg1] + reg[cmd.Arg2]; } ), + ("addi", (reg, cmd) => { reg[cmd.Dst] = reg[cmd.Arg1] + cmd.Arg2; } ), + ("mulr", (reg, cmd) => { reg[cmd.Dst] = reg[cmd.Arg1] * reg[cmd.Arg2]; } ), + ("muli", (reg, cmd) => { reg[cmd.Dst] = reg[cmd.Arg1] * cmd.Arg2; } ), + ("banr", (reg, cmd) => { reg[cmd.Dst] = reg[cmd.Arg1] & reg[cmd.Arg2]; } ), + ("bani", (reg, cmd) => { reg[cmd.Dst] = reg[cmd.Arg1] & cmd.Arg2; } ), + ("borr", (reg, cmd) => { reg[cmd.Dst] = reg[cmd.Arg1] | reg[cmd.Arg2]; } ), + ("bori", (reg, cmd) => { reg[cmd.Dst] = reg[cmd.Arg1] | cmd.Arg2; } ), + ("setr", (reg, cmd) => { reg[cmd.Dst] = reg[cmd.Arg1]; } ), + ("seti", (reg, cmd) => { reg[cmd.Dst] = cmd.Arg1; } ), + ("gtir", (reg, cmd) => { reg[cmd.Dst] = cmd.Arg1 > reg[cmd.Arg2] ? 1:0; } ), + ("gtri", (reg, cmd) => { reg[cmd.Dst] = reg[cmd.Arg1] > cmd.Arg2 ? 1:0; } ), + ("gtrr", (reg, cmd) => { reg[cmd.Dst] = reg[cmd.Arg1] > reg[cmd.Arg2] ? 1:0; } ), + ("eqir", (reg, cmd) => { reg[cmd.Dst] = cmd.Arg1 == reg[cmd.Arg2] ? 1:0; } ), + ("eqri", (reg, cmd) => { reg[cmd.Dst] = reg[cmd.Arg1] == cmd.Arg2 ? 1:0; } ), + ("eqrr", (reg, cmd) => { reg[cmd.Dst] = reg[cmd.Arg1] == reg[cmd.Arg2] ? 1:0; } ), +}; + +void Main() +{ + (var input1, var input2) = Load(File.ReadAllLines(Path.Combine(Path.GetDirectoryName(Util.CurrentQueryPath), @"16_input.txt"))); + + input1.Count(ip => Operations.Count(op => Test(ip.Item1, op.Item2, ip.Item2, ip.Item3)) >= 3 ).Dump(); +} + +(List<(int[],Command,int[])>, List) Load(string[] lines) +{ + var r1 = new List<(int[], Command, int[])>(); + + int i = 0; + for (;; i+=4) + { + if (string.IsNullOrWhiteSpace(lines[i])) break; + + var a = lines[i + 0].Substring(8).TrimStart('[').TrimEnd(']').Split(',').Select(p => int.Parse(p.Trim())).ToArray(); + var b = new Command(lines[i + 1].Split(' ').Select(p => int.Parse(p.Trim())).ToArray()); + var c = lines[i + 2].Substring(8).TrimStart('[').TrimEnd(']').Split(',').Select(p => int.Parse(p.Trim())).ToArray(); + r1.Add( (a,b,c) ); + } + + for (; string.IsNullOrWhiteSpace(lines[i]); i++); + + var r2 = new List(); + + for (; i < lines.Length; i++) r2.Add(new Command(lines[i].Split(' ').Select(p => int.Parse(p.Trim())).ToArray())); + + return (r1, r2); +} + +bool ArrayEquals(int[] a, int[] b) +{ + if (a.Length != b.Length) return false; + for (int i = 0; i < a.Length; i++) if (a[i] != b[i]) return false; + return true; +} + +bool Test(int[] before, Action op, Command cmd, int[] after) +{ + var register=before.ToArray(); + op(register, cmd); + + if (register.Length != after.Length) return false; + for (int i = 0; i < register.Length; i++) if (register[i] != after[i]) return false; + return true; +} \ No newline at end of file diff --git a/www/statics/aoc/2018/16-2.linq b/www/statics/aoc/2018/16-2.linq new file mode 100644 index 0000000..f568dee --- /dev/null +++ b/www/statics/aoc/2018/16-2.linq @@ -0,0 +1,113 @@ + + +class Command +{ + public int OpCode, Arg1, Arg2, Dst; + public Command(int[] a) { OpCode = a[0]; Arg1 = a[1]; Arg2 = a[2]; Dst = a[3]; } +} + +(string, Action)[] Operations = new(string, Action)[] +{ + ("addr", (reg, cmd) => { reg[cmd.Dst] = reg[cmd.Arg1] + reg[cmd.Arg2]; } ), + ("addi", (reg, cmd) => { reg[cmd.Dst] = reg[cmd.Arg1] + cmd.Arg2; } ), + ("mulr", (reg, cmd) => { reg[cmd.Dst] = reg[cmd.Arg1] * reg[cmd.Arg2]; } ), + ("muli", (reg, cmd) => { reg[cmd.Dst] = reg[cmd.Arg1] * cmd.Arg2; } ), + ("banr", (reg, cmd) => { reg[cmd.Dst] = reg[cmd.Arg1] & reg[cmd.Arg2]; } ), + ("bani", (reg, cmd) => { reg[cmd.Dst] = reg[cmd.Arg1] & cmd.Arg2; } ), + ("borr", (reg, cmd) => { reg[cmd.Dst] = reg[cmd.Arg1] | reg[cmd.Arg2]; } ), + ("bori", (reg, cmd) => { reg[cmd.Dst] = reg[cmd.Arg1] | cmd.Arg2; } ), + ("setr", (reg, cmd) => { reg[cmd.Dst] = reg[cmd.Arg1]; } ), + ("seti", (reg, cmd) => { reg[cmd.Dst] = cmd.Arg1; } ), + ("gtir", (reg, cmd) => { reg[cmd.Dst] = cmd.Arg1 > reg[cmd.Arg2] ? 1:0; } ), + ("gtri", (reg, cmd) => { reg[cmd.Dst] = reg[cmd.Arg1] > cmd.Arg2 ? 1:0; } ), + ("gtrr", (reg, cmd) => { reg[cmd.Dst] = reg[cmd.Arg1] > reg[cmd.Arg2] ? 1:0; } ), + ("eqir", (reg, cmd) => { reg[cmd.Dst] = cmd.Arg1 == reg[cmd.Arg2] ? 1:0; } ), + ("eqri", (reg, cmd) => { reg[cmd.Dst] = reg[cmd.Arg1] == cmd.Arg2 ? 1:0; } ), + ("eqrr", (reg, cmd) => { reg[cmd.Dst] = reg[cmd.Arg1] == reg[cmd.Arg2] ? 1:0; } ), +}; + +void Main() +{ + (var input1, var input2) = Load(File.ReadAllLines(Path.Combine(Path.GetDirectoryName(Util.CurrentQueryPath), @"16_input.txt"))); + + var mapping = GenerateMapping(input1); + + int[] data = new int[128]; + foreach (var cmd in input2) mapping[cmd.OpCode].Item2(data, cmd); + data[0].Dump(); +} + +(List<(int[], Command, int[])>, List) Load(string[] lines) +{ + var r1 = new List<(int[], Command, int[])>(); + + int i = 0; + for (; ; i += 4) + { + if (string.IsNullOrWhiteSpace(lines[i])) break; + + var a = lines[i + 0].Substring(8).TrimStart('[').TrimEnd(']').Split(',').Select(p => int.Parse(p.Trim())).ToArray(); + var b = new Command(lines[i + 1].Split(' ').Select(p => int.Parse(p.Trim())).ToArray()); + var c = lines[i + 2].Substring(8).TrimStart('[').TrimEnd(']').Split(',').Select(p => int.Parse(p.Trim())).ToArray(); + r1.Add((a, b, c)); + } + + for (; string.IsNullOrWhiteSpace(lines[i]); i++) ; + + var r2 = new List(); + + for (; i < lines.Length; i++) r2.Add(new Command(lines[i].Split(' ').Select(p => int.Parse(p.Trim())).ToArray())); + + return (r1, r2); +} + +bool ArrayEquals(int[] a, int[] b) +{ + if (a.Length != b.Length) return false; + for (int i = 0; i < a.Length; i++) if (a[i] != b[i]) return false; + return true; +} + +bool Test(int[] before, Action op, Command cmd, int[] after) +{ + var register = before.ToArray(); + op(register, cmd); + + if (register.Length != after.Length) return false; + for (int i = 0; i < register.Length; i++) if (register[i] != after[i]) return false; + return true; +} + +(string, Action)[] GenerateMapping(List<(int[], Command,int[])> input) +{ + var mapping = Enumerable + .Range(0,16) + .Select(p => Operations.ToList() ) + .ToArray(); + + foreach (var test in input) + { + if (mapping[test.Item2.OpCode].Count == 1) { Assert(Test(test.Item1, mapping[test.Item2.OpCode][0].Item2, test.Item2, test.Item3)); continue;} + + mapping[test.Item2.OpCode] = mapping[test.Item2.OpCode].Where(op => Test(test.Item1, op.Item2, test.Item2, test.Item3)).ToList(); + Assert(mapping[test.Item2.OpCode].Any()); + } + + for (int i_ = 0; i_ < 16; i_++) + { + foreach (var rm in mapping.Select((m,i) => (m,i)).Where(m => m.m.Count==1).ToList()) + { + for (int j = 0; j < 16; j++) + { + if (j==rm.i) continue; + mapping[j] = mapping[j].Where(m => m.Item1 != rm.m.Single().Item1).ToList(); + } + } + } + + Assert(mapping.Select(p => p.Single().Item1).Distinct().Count() == 16); + + return mapping.Select(p => p.Single()).ToArray(); +} + +void Assert(bool b) { if (!b) throw new Exception(); } \ No newline at end of file diff --git a/www/statics/aoc/2018/16_challenge.txt b/www/statics/aoc/2018/16_challenge.txt new file mode 100644 index 0000000..63d72d9 --- /dev/null +++ b/www/statics/aoc/2018/16_challenge.txt @@ -0,0 +1,76 @@ +--- 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. + +According to the manual, the device has four registers (numbered 0 through 3) that can be manipulated by instructions containing one of 16 opcodes. The registers start with the value 0. + +Every instruction consists of four values: an opcode, two inputs (named A and B), and an output (named C), in that order. The opcode specifies the behavior of the instruction and how the inputs are interpreted. The output, C, is always treated as a register. + +In the opcode descriptions below, if something says "value A", it means to take the number given as A literally. (This is also called an "immediate" value.) If something says "register A", it means to use the number given as A to read from (or write to) the register with that number. So, if the opcode addi adds register A and value B, storing the result in register C, and the instruction addi 0 7 3 is encountered, it would add 7 to the value contained by register 0 and store the sum in register 3, never modifying registers 0, 1, or 2 in the process. + +Many opcodes are similar except for how they interpret their arguments. The opcodes fall into seven general categories: + +Addition: + + addr (add register) stores into register C the result of adding register A and register B. + addi (add immediate) stores into register C the result of adding register A and value B. + +Multiplication: + + mulr (multiply register) stores into register C the result of multiplying register A and register B. + muli (multiply immediate) stores into register C the result of multiplying register A and value B. + +Bitwise AND: + + banr (bitwise AND register) stores into register C the result of the bitwise AND of register A and register B. + bani (bitwise AND immediate) stores into register C the result of the bitwise AND of register A and value B. + +Bitwise OR: + + borr (bitwise OR register) stores into register C the result of the bitwise OR of register A and register B. + bori (bitwise OR immediate) stores into register C the result of the bitwise OR of register A and value B. + +Assignment: + + setr (set register) copies the contents of register A into register C. (Input B is ignored.) + seti (set immediate) stores value A into register C. (Input B is ignored.) + +Greater-than testing: + + gtir (greater-than immediate/register) sets register C to 1 if value A is greater than register B. Otherwise, register C is set to 0. + gtri (greater-than register/immediate) sets register C to 1 if register A is greater than value B. Otherwise, register C is set to 0. + gtrr (greater-than register/register) sets register C to 1 if register A is greater than register B. Otherwise, register C is set to 0. + +Equality testing: + + eqir (equal immediate/register) sets register C to 1 if value A is equal to register B. Otherwise, register C is set to 0. + eqri (equal register/immediate) sets register C to 1 if register A is equal to value B. Otherwise, register C is set to 0. + eqrr (equal register/register) sets register C to 1 if register A is equal to register B. Otherwise, register C is set to 0. + +Unfortunately, while the manual gives the name of each opcode, it doesn't seem to indicate the number. However, you can monitor the CPU to see the contents of the registers before and after instructions are executed to try to work them out. Each opcode has a number from 0 through 15, but the manual doesn't say which is which. For example, suppose you capture the following sample: + +Before: [3, 2, 1, 1] +9 2 1 2 +After: [3, 2, 2, 1] + +This sample shows the effect of the instruction 9 2 1 2 on the registers. Before the instruction is executed, register 0 has value 3, register 1 has value 2, and registers 2 and 3 have value 1. After the instruction is executed, register 2's value becomes 2. + +The instruction itself, 9 2 1 2, means that opcode 9 was executed with A=2, B=1, and C=2. Opcode 9 could be any of the 16 opcodes listed above, but only three of them behave in a way that would cause the result shown in the sample: + + Opcode 9 could be mulr: register 2 (which has a value of 1) times register 1 (which has a value of 2) produces 2, which matches the value stored in the output register, register 2. + Opcode 9 could be addi: register 2 (which has a value of 1) plus value 1 produces 2, which matches the value stored in the output register, register 2. + Opcode 9 could be seti: value 2 matches the value stored in the output register, register 2; the number given for B is irrelevant. + +None of the other opcodes produce the result captured in the sample. Because of this, the sample above behaves like three opcodes. + +You collect many of these samples (the first section of your puzzle input). The manual also includes a small test program (the second section of your puzzle input) - you can ignore it for now. + +Ignoring the opcode numbers, how many samples in your puzzle input behave like three or more opcodes? + +--- Part Two --- + +Using the samples you collected, work out the number of each opcode and execute the test program (the second section of your puzzle input). + +What value is contained in register 0 after executing the test program? diff --git a/www/statics/aoc/2018/16_input.txt b/www/statics/aoc/2018/16_input.txt new file mode 100644 index 0000000..935ba61 --- /dev/null +++ b/www/statics/aoc/2018/16_input.txt @@ -0,0 +1,4152 @@ +Before: [1, 2, 3, 2] +3 1 3 0 +After: [1, 2, 3, 2] + +Before: [1, 1, 1, 3] +5 1 3 0 +After: [3, 1, 1, 3] + +Before: [2, 3, 0, 2] +0 1 0 2 +After: [2, 3, 6, 2] + +Before: [1, 2, 2, 3] +11 0 3 3 +After: [1, 2, 2, 0] + +Before: [0, 0, 3, 3] +9 0 0 1 +After: [0, 0, 3, 3] + +Before: [1, 0, 1, 2] +10 1 2 0 +After: [1, 0, 1, 2] + +Before: [0, 2, 0, 2] +13 1 1 1 +After: [0, 1, 0, 2] + +Before: [3, 1, 1, 1] +6 1 0 1 +After: [3, 3, 1, 1] + +Before: [2, 3, 2, 0] +4 1 2 2 +After: [2, 3, 1, 0] + +Before: [1, 2, 0, 2] +3 1 3 2 +After: [1, 2, 1, 2] + +Before: [0, 1, 3, 3] +2 1 0 2 +After: [0, 1, 1, 3] + +Before: [0, 3, 1, 3] +6 2 1 2 +After: [0, 3, 3, 3] + +Before: [3, 1, 1, 1] +6 1 0 2 +After: [3, 1, 3, 1] + +Before: [0, 2, 3, 2] +3 1 3 0 +After: [1, 2, 3, 2] + +Before: [0, 0, 1, 3] +7 2 1 0 +After: [1, 0, 1, 3] + +Before: [3, 1, 2, 3] +15 2 3 1 +After: [3, 3, 2, 3] + +Before: [3, 2, 3, 2] +3 1 3 3 +After: [3, 2, 3, 1] + +Before: [0, 2, 1, 2] +3 1 3 0 +After: [1, 2, 1, 2] + +Before: [1, 0, 1, 1] +1 1 0 1 +After: [1, 1, 1, 1] + +Before: [3, 2, 2, 2] +3 1 3 1 +After: [3, 1, 2, 2] + +Before: [2, 3, 2, 3] +8 2 2 3 +After: [2, 3, 2, 4] + +Before: [2, 1, 0, 2] +8 0 1 0 +After: [3, 1, 0, 2] + +Before: [1, 1, 2, 3] +5 0 3 1 +After: [1, 3, 2, 3] + +Before: [1, 0, 3, 1] +1 1 0 0 +After: [1, 0, 3, 1] + +Before: [0, 1, 3, 1] +14 3 2 1 +After: [0, 3, 3, 1] + +Before: [3, 3, 1, 1] +0 1 0 1 +After: [3, 9, 1, 1] + +Before: [2, 3, 0, 3] +15 0 3 2 +After: [2, 3, 3, 3] + +Before: [2, 2, 3, 3] +15 1 3 2 +After: [2, 2, 3, 3] + +Before: [1, 1, 3, 2] +12 0 2 3 +After: [1, 1, 3, 3] + +Before: [2, 1, 1, 3] +15 0 3 3 +After: [2, 1, 1, 3] + +Before: [0, 2, 3, 2] +9 0 0 2 +After: [0, 2, 0, 2] + +Before: [3, 2, 1, 0] +6 2 0 0 +After: [3, 2, 1, 0] + +Before: [3, 3, 3, 2] +13 1 0 0 +After: [1, 3, 3, 2] + +Before: [3, 2, 2, 3] +8 2 2 3 +After: [3, 2, 2, 4] + +Before: [1, 0, 2, 3] +1 1 0 2 +After: [1, 0, 1, 3] + +Before: [1, 0, 2, 0] +8 2 2 2 +After: [1, 0, 4, 0] + +Before: [1, 3, 3, 2] +12 0 2 1 +After: [1, 3, 3, 2] + +Before: [0, 1, 2, 2] +2 1 0 2 +After: [0, 1, 1, 2] + +Before: [3, 0, 2, 3] +0 3 0 0 +After: [9, 0, 2, 3] + +Before: [2, 0, 3, 1] +7 3 1 3 +After: [2, 0, 3, 1] + +Before: [1, 2, 1, 3] +10 1 0 0 +After: [1, 2, 1, 3] + +Before: [2, 3, 3, 0] +4 1 0 2 +After: [2, 3, 1, 0] + +Before: [0, 1, 1, 2] +2 1 0 3 +After: [0, 1, 1, 1] + +Before: [1, 0, 0, 2] +7 0 1 1 +After: [1, 1, 0, 2] + +Before: [2, 3, 2, 2] +4 1 2 1 +After: [2, 1, 2, 2] + +Before: [1, 2, 1, 0] +13 1 1 2 +After: [1, 2, 1, 0] + +Before: [1, 0, 2, 2] +1 1 0 2 +After: [1, 0, 1, 2] + +Before: [2, 2, 1, 3] +11 0 3 2 +After: [2, 2, 0, 3] + +Before: [0, 1, 3, 1] +2 1 0 0 +After: [1, 1, 3, 1] + +Before: [0, 1, 2, 2] +2 1 0 1 +After: [0, 1, 2, 2] + +Before: [2, 3, 1, 1] +6 2 1 1 +After: [2, 3, 1, 1] + +Before: [1, 2, 1, 0] +10 1 0 1 +After: [1, 1, 1, 0] + +Before: [3, 1, 0, 3] +5 1 3 3 +After: [3, 1, 0, 3] + +Before: [2, 1, 3, 1] +12 1 2 0 +After: [3, 1, 3, 1] + +Before: [0, 0, 2, 3] +10 0 1 0 +After: [1, 0, 2, 3] + +Before: [0, 1, 2, 0] +2 1 0 1 +After: [0, 1, 2, 0] + +Before: [0, 1, 0, 3] +5 1 3 1 +After: [0, 3, 0, 3] + +Before: [0, 1, 1, 1] +2 1 0 0 +After: [1, 1, 1, 1] + +Before: [2, 0, 2, 1] +7 3 1 2 +After: [2, 0, 1, 1] + +Before: [1, 0, 1, 0] +7 2 1 1 +After: [1, 1, 1, 0] + +Before: [3, 2, 3, 3] +15 1 3 1 +After: [3, 3, 3, 3] + +Before: [1, 2, 0, 3] +10 1 0 0 +After: [1, 2, 0, 3] + +Before: [1, 2, 0, 0] +13 1 1 3 +After: [1, 2, 0, 1] + +Before: [2, 3, 2, 3] +0 1 0 2 +After: [2, 3, 6, 3] + +Before: [3, 3, 3, 1] +13 1 0 1 +After: [3, 1, 3, 1] + +Before: [1, 2, 3, 1] +14 3 2 2 +After: [1, 2, 3, 1] + +Before: [0, 0, 1, 3] +8 0 3 1 +After: [0, 3, 1, 3] + +Before: [0, 2, 2, 3] +0 3 1 2 +After: [0, 2, 6, 3] + +Before: [1, 1, 3, 3] +5 0 3 2 +After: [1, 1, 3, 3] + +Before: [0, 1, 1, 0] +2 1 0 2 +After: [0, 1, 1, 0] + +Before: [1, 0, 3, 0] +1 1 0 0 +After: [1, 0, 3, 0] + +Before: [0, 1, 2, 0] +2 1 0 0 +After: [1, 1, 2, 0] + +Before: [1, 1, 3, 2] +14 3 1 1 +After: [1, 3, 3, 2] + +Before: [1, 3, 2, 2] +6 0 1 1 +After: [1, 3, 2, 2] + +Before: [1, 0, 0, 2] +1 1 0 1 +After: [1, 1, 0, 2] + +Before: [2, 3, 3, 0] +4 1 0 3 +After: [2, 3, 3, 1] + +Before: [1, 0, 2, 1] +10 1 3 2 +After: [1, 0, 1, 1] + +Before: [2, 1, 1, 1] +0 3 0 3 +After: [2, 1, 1, 2] + +Before: [1, 0, 0, 1] +7 0 1 3 +After: [1, 0, 0, 1] + +Before: [2, 0, 0, 1] +7 3 1 3 +After: [2, 0, 0, 1] + +Before: [2, 3, 3, 2] +13 1 2 0 +After: [1, 3, 3, 2] + +Before: [2, 2, 0, 1] +13 1 0 3 +After: [2, 2, 0, 1] + +Before: [2, 3, 1, 3] +5 2 3 3 +After: [2, 3, 1, 3] + +Before: [3, 2, 3, 2] +3 1 3 2 +After: [3, 2, 1, 2] + +Before: [1, 3, 3, 1] +12 0 2 2 +After: [1, 3, 3, 1] + +Before: [1, 0, 1, 3] +7 2 1 0 +After: [1, 0, 1, 3] + +Before: [1, 3, 2, 0] +6 0 1 1 +After: [1, 3, 2, 0] + +Before: [2, 0, 3, 1] +14 3 2 3 +After: [2, 0, 3, 3] + +Before: [0, 1, 3, 1] +8 0 1 1 +After: [0, 1, 3, 1] + +Before: [1, 1, 2, 3] +15 2 3 2 +After: [1, 1, 3, 3] + +Before: [1, 2, 2, 2] +3 1 3 3 +After: [1, 2, 2, 1] + +Before: [0, 1, 0, 2] +2 1 0 1 +After: [0, 1, 0, 2] + +Before: [1, 2, 3, 3] +5 0 3 2 +After: [1, 2, 3, 3] + +Before: [0, 0, 2, 0] +8 2 2 1 +After: [0, 4, 2, 0] + +Before: [2, 3, 3, 1] +0 0 2 1 +After: [2, 6, 3, 1] + +Before: [1, 0, 3, 2] +12 0 2 1 +After: [1, 3, 3, 2] + +Before: [3, 1, 0, 3] +5 1 3 0 +After: [3, 1, 0, 3] + +Before: [0, 0, 3, 1] +10 0 1 1 +After: [0, 1, 3, 1] + +Before: [3, 3, 0, 2] +13 1 0 2 +After: [3, 3, 1, 2] + +Before: [1, 1, 0, 3] +5 0 3 1 +After: [1, 3, 0, 3] + +Before: [3, 3, 3, 1] +14 3 2 0 +After: [3, 3, 3, 1] + +Before: [1, 3, 2, 3] +5 0 3 0 +After: [3, 3, 2, 3] + +Before: [1, 0, 0, 3] +7 0 1 2 +After: [1, 0, 1, 3] + +Before: [2, 2, 3, 1] +14 3 2 3 +After: [2, 2, 3, 3] + +Before: [0, 1, 3, 1] +12 1 2 0 +After: [3, 1, 3, 1] + +Before: [0, 1, 2, 3] +9 0 0 3 +After: [0, 1, 2, 0] + +Before: [1, 3, 2, 3] +5 0 3 3 +After: [1, 3, 2, 3] + +Before: [0, 2, 2, 3] +8 1 2 2 +After: [0, 2, 4, 3] + +Before: [2, 3, 3, 0] +0 2 0 3 +After: [2, 3, 3, 6] + +Before: [2, 3, 3, 1] +14 3 2 3 +After: [2, 3, 3, 3] + +Before: [3, 1, 2, 2] +8 2 2 0 +After: [4, 1, 2, 2] + +Before: [2, 3, 3, 3] +11 0 3 2 +After: [2, 3, 0, 3] + +Before: [2, 2, 3, 2] +13 1 0 3 +After: [2, 2, 3, 1] + +Before: [3, 0, 3, 3] +0 3 0 0 +After: [9, 0, 3, 3] + +Before: [2, 3, 2, 3] +4 1 2 2 +After: [2, 3, 1, 3] + +Before: [0, 0, 1, 1] +7 2 1 0 +After: [1, 0, 1, 1] + +Before: [1, 0, 3, 0] +1 1 0 2 +After: [1, 0, 1, 0] + +Before: [0, 1, 2, 3] +8 2 2 1 +After: [0, 4, 2, 3] + +Before: [0, 1, 3, 0] +2 1 0 3 +After: [0, 1, 3, 1] + +Before: [3, 3, 3, 1] +13 1 0 2 +After: [3, 3, 1, 1] + +Before: [0, 1, 3, 0] +2 1 0 2 +After: [0, 1, 1, 0] + +Before: [0, 0, 3, 1] +7 3 1 3 +After: [0, 0, 3, 1] + +Before: [1, 0, 3, 0] +1 1 0 3 +After: [1, 0, 3, 1] + +Before: [0, 3, 1, 2] +6 2 1 2 +After: [0, 3, 3, 2] + +Before: [2, 1, 1, 3] +5 2 3 3 +After: [2, 1, 1, 3] + +Before: [2, 0, 0, 3] +11 0 3 3 +After: [2, 0, 0, 0] + +Before: [1, 0, 2, 1] +1 1 0 3 +After: [1, 0, 2, 1] + +Before: [1, 3, 2, 3] +4 1 2 0 +After: [1, 3, 2, 3] + +Before: [0, 2, 1, 2] +3 1 3 3 +After: [0, 2, 1, 1] + +Before: [0, 0, 0, 0] +9 0 0 3 +After: [0, 0, 0, 0] + +Before: [1, 0, 3, 3] +1 1 0 1 +After: [1, 1, 3, 3] + +Before: [1, 1, 3, 1] +12 0 2 3 +After: [1, 1, 3, 3] + +Before: [2, 3, 0, 0] +4 1 0 2 +After: [2, 3, 1, 0] + +Before: [0, 1, 2, 3] +9 0 0 0 +After: [0, 1, 2, 3] + +Before: [1, 0, 0, 3] +1 1 0 3 +After: [1, 0, 0, 1] + +Before: [2, 2, 2, 0] +13 1 0 3 +After: [2, 2, 2, 1] + +Before: [3, 3, 3, 3] +13 1 0 2 +After: [3, 3, 1, 3] + +Before: [1, 2, 1, 3] +15 1 3 3 +After: [1, 2, 1, 3] + +Before: [1, 3, 2, 1] +4 1 2 2 +After: [1, 3, 1, 1] + +Before: [3, 3, 3, 3] +13 1 0 1 +After: [3, 1, 3, 3] + +Before: [1, 0, 1, 1] +7 2 1 0 +After: [1, 0, 1, 1] + +Before: [2, 1, 0, 3] +5 1 3 2 +After: [2, 1, 3, 3] + +Before: [1, 0, 1, 2] +7 0 1 2 +After: [1, 0, 1, 2] + +Before: [2, 1, 3, 2] +8 1 3 3 +After: [2, 1, 3, 3] + +Before: [1, 2, 2, 3] +15 1 3 0 +After: [3, 2, 2, 3] + +Before: [1, 0, 2, 3] +11 0 3 3 +After: [1, 0, 2, 0] + +Before: [1, 3, 2, 2] +4 1 2 0 +After: [1, 3, 2, 2] + +Before: [2, 2, 2, 3] +15 0 3 2 +After: [2, 2, 3, 3] + +Before: [3, 1, 3, 1] +12 1 2 2 +After: [3, 1, 3, 1] + +Before: [1, 0, 2, 1] +1 1 0 2 +After: [1, 0, 1, 1] + +Before: [0, 3, 2, 0] +0 2 1 2 +After: [0, 3, 6, 0] + +Before: [0, 2, 3, 2] +13 1 1 0 +After: [1, 2, 3, 2] + +Before: [2, 3, 3, 2] +4 1 0 2 +After: [2, 3, 1, 2] + +Before: [3, 3, 2, 1] +4 1 2 1 +After: [3, 1, 2, 1] + +Before: [1, 3, 1, 2] +8 2 3 3 +After: [1, 3, 1, 3] + +Before: [1, 3, 1, 1] +6 0 1 0 +After: [3, 3, 1, 1] + +Before: [0, 3, 2, 1] +14 3 2 2 +After: [0, 3, 3, 1] + +Before: [1, 0, 0, 3] +1 1 0 0 +After: [1, 0, 0, 3] + +Before: [0, 0, 1, 1] +10 0 1 2 +After: [0, 0, 1, 1] + +Before: [1, 1, 2, 2] +8 2 2 0 +After: [4, 1, 2, 2] + +Before: [1, 2, 3, 2] +3 1 3 1 +After: [1, 1, 3, 2] + +Before: [1, 2, 1, 2] +10 1 0 1 +After: [1, 1, 1, 2] + +Before: [2, 3, 2, 0] +4 1 0 1 +After: [2, 1, 2, 0] + +Before: [1, 0, 1, 0] +1 1 0 1 +After: [1, 1, 1, 0] + +Before: [2, 0, 1, 2] +10 1 2 1 +After: [2, 1, 1, 2] + +Before: [3, 3, 3, 0] +13 1 0 2 +After: [3, 3, 1, 0] + +Before: [2, 0, 3, 3] +11 0 3 3 +After: [2, 0, 3, 0] + +Before: [0, 1, 2, 3] +5 1 3 3 +After: [0, 1, 2, 3] + +Before: [1, 0, 2, 3] +1 1 0 0 +After: [1, 0, 2, 3] + +Before: [0, 0, 3, 3] +10 0 1 0 +After: [1, 0, 3, 3] + +Before: [1, 0, 2, 2] +1 1 0 0 +After: [1, 0, 2, 2] + +Before: [1, 0, 0, 2] +1 1 0 2 +After: [1, 0, 1, 2] + +Before: [2, 3, 1, 1] +6 2 1 2 +After: [2, 3, 3, 1] + +Before: [2, 2, 3, 1] +14 3 2 2 +After: [2, 2, 3, 1] + +Before: [3, 3, 1, 3] +6 2 1 3 +After: [3, 3, 1, 3] + +Before: [0, 1, 1, 2] +2 1 0 0 +After: [1, 1, 1, 2] + +Before: [2, 0, 3, 3] +0 2 2 3 +After: [2, 0, 3, 9] + +Before: [0, 1, 0, 0] +9 0 0 1 +After: [0, 0, 0, 0] + +Before: [0, 1, 2, 1] +2 1 0 3 +After: [0, 1, 2, 1] + +Before: [2, 2, 0, 3] +15 0 3 3 +After: [2, 2, 0, 3] + +Before: [0, 3, 2, 1] +14 3 2 3 +After: [0, 3, 2, 3] + +Before: [1, 2, 1, 3] +15 1 3 0 +After: [3, 2, 1, 3] + +Before: [0, 3, 0, 2] +9 0 0 3 +After: [0, 3, 0, 0] + +Before: [1, 2, 0, 1] +13 1 1 1 +After: [1, 1, 0, 1] + +Before: [2, 3, 3, 1] +14 3 2 1 +After: [2, 3, 3, 1] + +Before: [0, 2, 1, 3] +15 1 3 3 +After: [0, 2, 1, 3] + +Before: [1, 0, 2, 1] +7 3 1 2 +After: [1, 0, 1, 1] + +Before: [0, 2, 3, 2] +3 1 3 3 +After: [0, 2, 3, 1] + +Before: [3, 3, 1, 3] +13 1 0 3 +After: [3, 3, 1, 1] + +Before: [3, 2, 2, 2] +3 1 3 3 +After: [3, 2, 2, 1] + +Before: [0, 1, 1, 1] +9 0 0 1 +After: [0, 0, 1, 1] + +Before: [0, 1, 2, 3] +9 0 0 1 +After: [0, 0, 2, 3] + +Before: [0, 1, 3, 2] +9 0 0 0 +After: [0, 1, 3, 2] + +Before: [1, 1, 3, 3] +11 0 3 2 +After: [1, 1, 0, 3] + +Before: [1, 1, 1, 3] +5 0 3 1 +After: [1, 3, 1, 3] + +Before: [3, 1, 1, 2] +14 3 1 1 +After: [3, 3, 1, 2] + +Before: [0, 3, 1, 0] +0 1 1 2 +After: [0, 3, 9, 0] + +Before: [0, 1, 1, 1] +2 1 0 1 +After: [0, 1, 1, 1] + +Before: [2, 2, 2, 1] +8 2 2 3 +After: [2, 2, 2, 4] + +Before: [1, 2, 3, 0] +12 0 2 0 +After: [3, 2, 3, 0] + +Before: [3, 3, 2, 1] +4 1 2 2 +After: [3, 3, 1, 1] + +Before: [2, 2, 2, 1] +14 3 2 0 +After: [3, 2, 2, 1] + +Before: [1, 1, 2, 1] +8 2 1 2 +After: [1, 1, 3, 1] + +Before: [0, 3, 2, 2] +4 1 2 1 +After: [0, 1, 2, 2] + +Before: [1, 0, 0, 0] +1 1 0 0 +After: [1, 0, 0, 0] + +Before: [0, 1, 3, 2] +2 1 0 1 +After: [0, 1, 3, 2] + +Before: [3, 3, 2, 0] +0 0 1 1 +After: [3, 9, 2, 0] + +Before: [2, 3, 3, 3] +15 0 3 2 +After: [2, 3, 3, 3] + +Before: [1, 0, 0, 2] +1 1 0 0 +After: [1, 0, 0, 2] + +Before: [0, 3, 2, 3] +4 1 2 3 +After: [0, 3, 2, 1] + +Before: [0, 1, 1, 2] +2 1 0 2 +After: [0, 1, 1, 2] + +Before: [1, 2, 1, 2] +3 1 3 0 +After: [1, 2, 1, 2] + +Before: [2, 2, 0, 3] +15 0 3 2 +After: [2, 2, 3, 3] + +Before: [1, 3, 3, 0] +6 0 1 3 +After: [1, 3, 3, 3] + +Before: [3, 2, 2, 3] +15 2 3 2 +After: [3, 2, 3, 3] + +Before: [2, 2, 0, 2] +3 1 3 0 +After: [1, 2, 0, 2] + +Before: [0, 1, 3, 1] +12 1 2 1 +After: [0, 3, 3, 1] + +Before: [2, 0, 3, 3] +15 0 3 1 +After: [2, 3, 3, 3] + +Before: [1, 1, 0, 2] +14 3 1 0 +After: [3, 1, 0, 2] + +Before: [3, 3, 1, 2] +0 1 1 0 +After: [9, 3, 1, 2] + +Before: [3, 1, 0, 0] +6 1 0 1 +After: [3, 3, 0, 0] + +Before: [2, 2, 3, 1] +13 1 1 0 +After: [1, 2, 3, 1] + +Before: [1, 0, 3, 2] +7 0 1 1 +After: [1, 1, 3, 2] + +Before: [0, 1, 2, 1] +8 2 2 0 +After: [4, 1, 2, 1] + +Before: [1, 0, 3, 1] +7 0 1 2 +After: [1, 0, 1, 1] + +Before: [0, 3, 1, 1] +6 2 1 0 +After: [3, 3, 1, 1] + +Before: [1, 0, 3, 3] +12 0 2 1 +After: [1, 3, 3, 3] + +Before: [1, 3, 3, 3] +12 0 2 2 +After: [1, 3, 3, 3] + +Before: [2, 1, 3, 1] +12 1 2 3 +After: [2, 1, 3, 3] + +Before: [0, 2, 3, 2] +3 1 3 1 +After: [0, 1, 3, 2] + +Before: [3, 2, 0, 1] +0 0 0 3 +After: [3, 2, 0, 9] + +Before: [2, 0, 1, 3] +15 0 3 2 +After: [2, 0, 3, 3] + +Before: [3, 1, 1, 2] +6 2 0 3 +After: [3, 1, 1, 3] + +Before: [0, 0, 3, 1] +7 3 1 2 +After: [0, 0, 1, 1] + +Before: [2, 2, 3, 3] +15 1 3 0 +After: [3, 2, 3, 3] + +Before: [0, 0, 1, 1] +7 2 1 3 +After: [0, 0, 1, 1] + +Before: [0, 1, 3, 2] +12 1 2 2 +After: [0, 1, 3, 2] + +Before: [0, 1, 3, 3] +0 2 2 2 +After: [0, 1, 9, 3] + +Before: [0, 0, 2, 3] +10 0 1 3 +After: [0, 0, 2, 1] + +Before: [1, 3, 1, 1] +6 0 1 3 +After: [1, 3, 1, 3] + +Before: [1, 0, 1, 2] +10 1 2 1 +After: [1, 1, 1, 2] + +Before: [0, 1, 0, 2] +14 3 1 0 +After: [3, 1, 0, 2] + +Before: [0, 1, 3, 2] +9 0 0 2 +After: [0, 1, 0, 2] + +Before: [1, 0, 1, 2] +1 1 0 0 +After: [1, 0, 1, 2] + +Before: [3, 0, 2, 1] +7 3 1 0 +After: [1, 0, 2, 1] + +Before: [2, 2, 1, 3] +5 2 3 2 +After: [2, 2, 3, 3] + +Before: [1, 3, 0, 3] +5 0 3 2 +After: [1, 3, 3, 3] + +Before: [0, 1, 3, 1] +12 1 2 2 +After: [0, 1, 3, 1] + +Before: [2, 3, 2, 3] +15 2 3 1 +After: [2, 3, 2, 3] + +Before: [2, 1, 1, 3] +11 0 3 2 +After: [2, 1, 0, 3] + +Before: [2, 2, 0, 2] +3 1 3 3 +After: [2, 2, 0, 1] + +Before: [2, 3, 2, 3] +15 0 3 2 +After: [2, 3, 3, 3] + +Before: [3, 2, 1, 3] +5 2 3 1 +After: [3, 3, 1, 3] + +Before: [1, 0, 1, 3] +5 2 3 2 +After: [1, 0, 3, 3] + +Before: [0, 1, 3, 1] +2 1 0 2 +After: [0, 1, 1, 1] + +Before: [1, 0, 3, 2] +7 0 1 3 +After: [1, 0, 3, 1] + +Before: [1, 2, 2, 2] +3 1 3 1 +After: [1, 1, 2, 2] + +Before: [2, 3, 0, 3] +4 1 0 0 +After: [1, 3, 0, 3] + +Before: [3, 3, 1, 1] +6 2 0 2 +After: [3, 3, 3, 1] + +Before: [2, 3, 3, 1] +0 0 2 3 +After: [2, 3, 3, 6] + +Before: [1, 1, 2, 1] +14 3 2 0 +After: [3, 1, 2, 1] + +Before: [1, 3, 1, 3] +11 0 3 0 +After: [0, 3, 1, 3] + +Before: [2, 2, 0, 3] +15 0 3 1 +After: [2, 3, 0, 3] + +Before: [1, 2, 2, 0] +10 1 0 1 +After: [1, 1, 2, 0] + +Before: [1, 0, 1, 0] +10 1 2 1 +After: [1, 1, 1, 0] + +Before: [1, 2, 0, 3] +10 1 0 2 +After: [1, 2, 1, 3] + +Before: [0, 1, 1, 1] +2 1 0 3 +After: [0, 1, 1, 1] + +Before: [2, 0, 1, 0] +7 2 1 2 +After: [2, 0, 1, 0] + +Before: [0, 3, 1, 3] +6 2 1 1 +After: [0, 3, 1, 3] + +Before: [3, 1, 3, 3] +5 1 3 1 +After: [3, 3, 3, 3] + +Before: [0, 3, 3, 1] +0 1 2 2 +After: [0, 3, 9, 1] + +Before: [2, 3, 2, 2] +8 3 2 0 +After: [4, 3, 2, 2] + +Before: [2, 3, 1, 2] +4 1 0 3 +After: [2, 3, 1, 1] + +Before: [1, 0, 3, 2] +12 0 2 0 +After: [3, 0, 3, 2] + +Before: [2, 1, 2, 2] +8 2 1 0 +After: [3, 1, 2, 2] + +Before: [0, 0, 0, 0] +10 0 1 3 +After: [0, 0, 0, 1] + +Before: [1, 3, 0, 3] +11 0 3 2 +After: [1, 3, 0, 3] + +Before: [2, 0, 3, 1] +7 3 1 1 +After: [2, 1, 3, 1] + +Before: [0, 0, 3, 0] +10 0 1 2 +After: [0, 0, 1, 0] + +Before: [2, 3, 1, 3] +4 1 0 0 +After: [1, 3, 1, 3] + +Before: [3, 3, 2, 0] +13 1 0 3 +After: [3, 3, 2, 1] + +Before: [1, 2, 2, 2] +10 1 0 1 +After: [1, 1, 2, 2] + +Before: [3, 1, 3, 3] +12 1 2 1 +After: [3, 3, 3, 3] + +Before: [3, 3, 2, 1] +14 3 2 0 +After: [3, 3, 2, 1] + +Before: [2, 3, 2, 1] +4 1 2 1 +After: [2, 1, 2, 1] + +Before: [0, 2, 2, 3] +15 2 3 3 +After: [0, 2, 2, 3] + +Before: [3, 2, 3, 1] +0 2 0 1 +After: [3, 9, 3, 1] + +Before: [0, 2, 0, 2] +3 1 3 3 +After: [0, 2, 0, 1] + +Before: [3, 2, 3, 0] +0 2 2 3 +After: [3, 2, 3, 9] + +Before: [0, 2, 1, 3] +9 0 0 1 +After: [0, 0, 1, 3] + +Before: [0, 0, 0, 2] +9 0 0 1 +After: [0, 0, 0, 2] + +Before: [1, 0, 3, 1] +1 1 0 1 +After: [1, 1, 3, 1] + +Before: [1, 0, 1, 1] +7 3 1 3 +After: [1, 0, 1, 1] + +Before: [0, 3, 3, 2] +9 0 0 0 +After: [0, 3, 3, 2] + +Before: [1, 0, 1, 1] +1 1 0 2 +After: [1, 0, 1, 1] + +Before: [3, 2, 1, 3] +6 2 0 0 +After: [3, 2, 1, 3] + +Before: [2, 3, 2, 0] +4 1 2 0 +After: [1, 3, 2, 0] + +Before: [1, 0, 2, 2] +1 1 0 1 +After: [1, 1, 2, 2] + +Before: [1, 2, 1, 3] +11 0 3 1 +After: [1, 0, 1, 3] + +Before: [0, 0, 2, 1] +7 3 1 2 +After: [0, 0, 1, 1] + +Before: [1, 3, 1, 0] +6 2 1 1 +After: [1, 3, 1, 0] + +Before: [1, 0, 1, 3] +1 1 0 0 +After: [1, 0, 1, 3] + +Before: [3, 2, 2, 3] +15 2 3 0 +After: [3, 2, 2, 3] + +Before: [1, 0, 1, 3] +11 0 3 1 +After: [1, 0, 1, 3] + +Before: [3, 2, 1, 1] +13 1 1 2 +After: [3, 2, 1, 1] + +Before: [1, 3, 0, 3] +5 0 3 1 +After: [1, 3, 0, 3] + +Before: [2, 2, 2, 3] +8 0 2 1 +After: [2, 4, 2, 3] + +Before: [0, 0, 3, 0] +9 0 0 3 +After: [0, 0, 3, 0] + +Before: [1, 0, 2, 2] +1 1 0 3 +After: [1, 0, 2, 1] + +Before: [0, 0, 3, 2] +10 0 1 3 +After: [0, 0, 3, 1] + +Before: [0, 0, 0, 1] +10 1 3 1 +After: [0, 1, 0, 1] + +Before: [0, 3, 3, 2] +0 3 1 2 +After: [0, 3, 6, 2] + +Before: [2, 1, 3, 3] +12 1 2 1 +After: [2, 3, 3, 3] + +Before: [0, 0, 2, 0] +8 0 2 1 +After: [0, 2, 2, 0] + +Before: [3, 1, 1, 2] +14 3 1 3 +After: [3, 1, 1, 3] + +Before: [0, 3, 2, 1] +4 1 2 2 +After: [0, 3, 1, 1] + +Before: [3, 0, 1, 3] +5 2 3 0 +After: [3, 0, 1, 3] + +Before: [1, 0, 3, 2] +0 3 2 2 +After: [1, 0, 6, 2] + +Before: [2, 1, 3, 3] +11 0 3 3 +After: [2, 1, 3, 0] + +Before: [1, 0, 0, 2] +1 1 0 3 +After: [1, 0, 0, 1] + +Before: [3, 0, 1, 1] +7 3 1 0 +After: [1, 0, 1, 1] + +Before: [2, 1, 2, 3] +5 1 3 3 +After: [2, 1, 2, 3] + +Before: [1, 2, 0, 1] +10 1 0 3 +After: [1, 2, 0, 1] + +Before: [2, 1, 0, 3] +15 0 3 0 +After: [3, 1, 0, 3] + +Before: [1, 3, 3, 1] +12 0 2 3 +After: [1, 3, 3, 3] + +Before: [2, 2, 3, 2] +3 1 3 1 +After: [2, 1, 3, 2] + +Before: [2, 3, 3, 2] +4 1 0 1 +After: [2, 1, 3, 2] + +Before: [3, 0, 1, 0] +7 2 1 1 +After: [3, 1, 1, 0] + +Before: [1, 1, 0, 2] +14 3 1 2 +After: [1, 1, 3, 2] + +Before: [2, 3, 1, 2] +6 2 1 3 +After: [2, 3, 1, 3] + +Before: [2, 0, 0, 1] +10 1 3 2 +After: [2, 0, 1, 1] + +Before: [1, 3, 1, 3] +5 0 3 0 +After: [3, 3, 1, 3] + +Before: [0, 0, 1, 0] +7 2 1 2 +After: [0, 0, 1, 0] + +Before: [1, 2, 1, 3] +11 0 3 2 +After: [1, 2, 0, 3] + +Before: [2, 3, 0, 0] +4 1 0 3 +After: [2, 3, 0, 1] + +Before: [1, 3, 1, 1] +6 2 1 0 +After: [3, 3, 1, 1] + +Before: [0, 2, 2, 2] +3 1 3 2 +After: [0, 2, 1, 2] + +Before: [3, 0, 3, 1] +10 1 3 3 +After: [3, 0, 3, 1] + +Before: [2, 2, 1, 2] +13 1 1 1 +After: [2, 1, 1, 2] + +Before: [0, 1, 3, 0] +9 0 0 3 +After: [0, 1, 3, 0] + +Before: [2, 3, 0, 3] +4 1 0 3 +After: [2, 3, 0, 1] + +Before: [0, 3, 2, 2] +4 1 2 2 +After: [0, 3, 1, 2] + +Before: [2, 3, 3, 0] +4 1 0 0 +After: [1, 3, 3, 0] + +Before: [0, 2, 3, 3] +15 1 3 1 +After: [0, 3, 3, 3] + +Before: [0, 0, 2, 2] +8 0 2 3 +After: [0, 0, 2, 2] + +Before: [1, 2, 2, 3] +11 0 3 0 +After: [0, 2, 2, 3] + +Before: [0, 1, 0, 3] +2 1 0 3 +After: [0, 1, 0, 1] + +Before: [3, 2, 3, 2] +3 1 3 0 +After: [1, 2, 3, 2] + +Before: [3, 3, 1, 0] +0 0 0 2 +After: [3, 3, 9, 0] + +Before: [1, 0, 0, 3] +7 0 1 1 +After: [1, 1, 0, 3] + +Before: [0, 0, 0, 1] +7 3 1 1 +After: [0, 1, 0, 1] + +Before: [1, 0, 0, 3] +1 1 0 1 +After: [1, 1, 0, 3] + +Before: [1, 0, 2, 1] +14 3 2 2 +After: [1, 0, 3, 1] + +Before: [1, 3, 2, 1] +14 3 2 2 +After: [1, 3, 3, 1] + +Before: [2, 3, 3, 2] +0 2 2 3 +After: [2, 3, 3, 9] + +Before: [0, 1, 2, 1] +2 1 0 2 +After: [0, 1, 1, 1] + +Before: [1, 0, 3, 1] +1 1 0 3 +After: [1, 0, 3, 1] + +Before: [3, 0, 3, 0] +0 2 2 2 +After: [3, 0, 9, 0] + +Before: [0, 1, 2, 0] +2 1 0 3 +After: [0, 1, 2, 1] + +Before: [2, 2, 3, 3] +11 0 3 0 +After: [0, 2, 3, 3] + +Before: [0, 1, 0, 0] +2 1 0 1 +After: [0, 1, 0, 0] + +Before: [0, 1, 0, 3] +2 1 0 0 +After: [1, 1, 0, 3] + +Before: [3, 0, 2, 3] +15 2 3 2 +After: [3, 0, 3, 3] + +Before: [0, 3, 1, 3] +9 0 0 1 +After: [0, 0, 1, 3] + +Before: [3, 3, 2, 2] +0 2 0 3 +After: [3, 3, 2, 6] + +Before: [1, 0, 2, 3] +1 1 0 3 +After: [1, 0, 2, 1] + +Before: [1, 3, 3, 0] +12 0 2 2 +After: [1, 3, 3, 0] + +Before: [3, 1, 3, 1] +12 1 2 3 +After: [3, 1, 3, 3] + +Before: [2, 0, 1, 1] +7 3 1 0 +After: [1, 0, 1, 1] + +Before: [0, 2, 0, 2] +3 1 3 1 +After: [0, 1, 0, 2] + +Before: [1, 2, 1, 2] +8 0 3 3 +After: [1, 2, 1, 3] + +Before: [3, 1, 1, 3] +6 1 0 2 +After: [3, 1, 3, 3] + +Before: [1, 1, 3, 3] +5 0 3 1 +After: [1, 3, 3, 3] + +Before: [0, 1, 3, 0] +2 1 0 1 +After: [0, 1, 3, 0] + +Before: [0, 1, 2, 3] +2 1 0 2 +After: [0, 1, 1, 3] + +Before: [0, 2, 0, 2] +13 1 1 3 +After: [0, 2, 0, 1] + +Before: [1, 0, 1, 3] +1 1 0 2 +After: [1, 0, 1, 3] + +Before: [1, 1, 0, 3] +5 0 3 3 +After: [1, 1, 0, 3] + +Before: [1, 2, 3, 1] +14 3 2 1 +After: [1, 3, 3, 1] + +Before: [2, 3, 2, 3] +15 2 3 2 +After: [2, 3, 3, 3] + +Before: [1, 1, 2, 2] +8 2 1 1 +After: [1, 3, 2, 2] + +Before: [1, 2, 1, 2] +3 1 3 2 +After: [1, 2, 1, 2] + +Before: [0, 0, 1, 3] +5 2 3 2 +After: [0, 0, 3, 3] + +Before: [2, 3, 0, 1] +4 1 0 2 +After: [2, 3, 1, 1] + +Before: [0, 1, 3, 0] +9 0 0 2 +After: [0, 1, 0, 0] + +Before: [3, 0, 0, 1] +7 3 1 0 +After: [1, 0, 0, 1] + +Before: [1, 1, 3, 2] +12 1 2 1 +After: [1, 3, 3, 2] + +Before: [1, 2, 3, 2] +3 1 3 3 +After: [1, 2, 3, 1] + +Before: [2, 0, 1, 2] +10 1 2 3 +After: [2, 0, 1, 1] + +Before: [3, 1, 3, 1] +6 1 0 2 +After: [3, 1, 3, 1] + +Before: [3, 2, 2, 3] +13 1 1 2 +After: [3, 2, 1, 3] + +Before: [1, 2, 0, 2] +3 1 3 3 +After: [1, 2, 0, 1] + +Before: [0, 1, 0, 1] +2 1 0 3 +After: [0, 1, 0, 1] + +Before: [3, 1, 1, 1] +6 1 0 3 +After: [3, 1, 1, 3] + +Before: [3, 0, 3, 0] +0 2 0 3 +After: [3, 0, 3, 9] + +Before: [1, 0, 1, 2] +1 1 0 2 +After: [1, 0, 1, 2] + +Before: [0, 1, 2, 1] +8 2 1 1 +After: [0, 3, 2, 1] + +Before: [3, 0, 2, 1] +7 3 1 2 +After: [3, 0, 1, 1] + +Before: [0, 1, 1, 3] +2 1 0 1 +After: [0, 1, 1, 3] + +Before: [1, 1, 2, 2] +8 1 2 2 +After: [1, 1, 3, 2] + +Before: [3, 1, 3, 3] +6 1 0 0 +After: [3, 1, 3, 3] + +Before: [1, 0, 3, 1] +12 0 2 3 +After: [1, 0, 3, 3] + +Before: [1, 3, 3, 2] +6 0 1 1 +After: [1, 3, 3, 2] + +Before: [0, 0, 3, 1] +10 1 3 1 +After: [0, 1, 3, 1] + +Before: [3, 2, 3, 2] +3 1 3 1 +After: [3, 1, 3, 2] + +Before: [3, 3, 1, 2] +6 2 0 2 +After: [3, 3, 3, 2] + +Before: [0, 1, 0, 2] +2 1 0 2 +After: [0, 1, 1, 2] + +Before: [2, 1, 2, 3] +8 0 1 1 +After: [2, 3, 2, 3] + +Before: [3, 3, 1, 0] +6 2 0 3 +After: [3, 3, 1, 3] + +Before: [1, 3, 3, 2] +13 1 2 1 +After: [1, 1, 3, 2] + +Before: [0, 0, 2, 3] +15 2 3 0 +After: [3, 0, 2, 3] + +Before: [0, 1, 1, 1] +2 1 0 2 +After: [0, 1, 1, 1] + +Before: [0, 0, 0, 2] +10 0 1 2 +After: [0, 0, 1, 2] + +Before: [0, 1, 1, 0] +2 1 0 1 +After: [0, 1, 1, 0] + +Before: [0, 0, 2, 2] +8 3 2 2 +After: [0, 0, 4, 2] + +Before: [2, 3, 1, 1] +4 1 0 3 +After: [2, 3, 1, 1] + +Before: [1, 0, 0, 0] +1 1 0 3 +After: [1, 0, 0, 1] + +Before: [1, 0, 3, 3] +7 0 1 2 +After: [1, 0, 1, 3] + +Before: [1, 0, 3, 2] +1 1 0 1 +After: [1, 1, 3, 2] + +Before: [0, 1, 1, 0] +9 0 0 0 +After: [0, 1, 1, 0] + +Before: [3, 0, 3, 1] +14 3 2 2 +After: [3, 0, 3, 1] + +Before: [2, 2, 2, 3] +15 1 3 1 +After: [2, 3, 2, 3] + +Before: [0, 3, 3, 0] +9 0 0 0 +After: [0, 3, 3, 0] + +Before: [0, 1, 3, 3] +2 1 0 3 +After: [0, 1, 3, 1] + +Before: [1, 2, 2, 3] +15 2 3 2 +After: [1, 2, 3, 3] + +Before: [3, 2, 2, 2] +0 3 0 2 +After: [3, 2, 6, 2] + +Before: [0, 2, 3, 3] +13 1 1 3 +After: [0, 2, 3, 1] + +Before: [0, 3, 2, 3] +4 1 2 1 +After: [0, 1, 2, 3] + +Before: [0, 0, 3, 1] +10 0 1 3 +After: [0, 0, 3, 1] + +Before: [2, 0, 2, 3] +15 0 3 2 +After: [2, 0, 3, 3] + +Before: [1, 1, 3, 2] +12 1 2 3 +After: [1, 1, 3, 3] + +Before: [1, 0, 2, 1] +7 0 1 3 +After: [1, 0, 2, 1] + +Before: [0, 1, 3, 0] +0 2 2 3 +After: [0, 1, 3, 9] + +Before: [2, 2, 2, 1] +14 3 2 2 +After: [2, 2, 3, 1] + +Before: [0, 1, 0, 1] +2 1 0 0 +After: [1, 1, 0, 1] + +Before: [0, 0, 2, 3] +15 2 3 1 +After: [0, 3, 2, 3] + +Before: [1, 3, 0, 1] +6 0 1 2 +After: [1, 3, 3, 1] + +Before: [1, 2, 2, 3] +10 1 0 3 +After: [1, 2, 2, 1] + +Before: [0, 2, 3, 3] +13 1 1 2 +After: [0, 2, 1, 3] + +Before: [0, 0, 0, 1] +10 1 3 0 +After: [1, 0, 0, 1] + +Before: [2, 2, 3, 2] +3 1 3 0 +After: [1, 2, 3, 2] + +Before: [0, 1, 2, 2] +14 3 1 1 +After: [0, 3, 2, 2] + +Before: [0, 1, 3, 3] +2 1 0 1 +After: [0, 1, 3, 3] + +Before: [3, 3, 3, 3] +0 2 0 0 +After: [9, 3, 3, 3] + +Before: [1, 3, 2, 2] +8 0 3 1 +After: [1, 3, 2, 2] + +Before: [2, 2, 0, 3] +15 1 3 2 +After: [2, 2, 3, 3] + +Before: [1, 1, 2, 3] +5 0 3 0 +After: [3, 1, 2, 3] + +Before: [2, 3, 3, 3] +11 0 3 3 +After: [2, 3, 3, 0] + +Before: [2, 3, 2, 3] +4 1 0 1 +After: [2, 1, 2, 3] + +Before: [2, 0, 0, 3] +11 0 3 1 +After: [2, 0, 0, 3] + +Before: [3, 3, 1, 3] +5 2 3 1 +After: [3, 3, 1, 3] + +Before: [1, 0, 3, 0] +12 0 2 2 +After: [1, 0, 3, 0] + +Before: [1, 1, 3, 3] +5 1 3 2 +After: [1, 1, 3, 3] + +Before: [1, 2, 0, 2] +3 1 3 1 +After: [1, 1, 0, 2] + +Before: [2, 2, 3, 2] +3 1 3 2 +After: [2, 2, 1, 2] + +Before: [3, 1, 2, 1] +6 1 0 1 +After: [3, 3, 2, 1] + +Before: [0, 1, 3, 0] +2 1 0 0 +After: [1, 1, 3, 0] + +Before: [1, 0, 1, 3] +8 1 3 2 +After: [1, 0, 3, 3] + +Before: [1, 1, 2, 3] +11 0 3 2 +After: [1, 1, 0, 3] + +Before: [0, 3, 2, 3] +9 0 0 0 +After: [0, 3, 2, 3] + +Before: [3, 2, 2, 0] +13 1 1 0 +After: [1, 2, 2, 0] + +Before: [1, 0, 0, 1] +1 1 0 1 +After: [1, 1, 0, 1] + +Before: [2, 0, 0, 3] +15 0 3 0 +After: [3, 0, 0, 3] + +Before: [3, 2, 0, 2] +3 1 3 3 +After: [3, 2, 0, 1] + +Before: [1, 0, 1, 3] +5 2 3 1 +After: [1, 3, 1, 3] + +Before: [2, 3, 3, 1] +4 1 0 1 +After: [2, 1, 3, 1] + +Before: [2, 2, 1, 3] +5 2 3 1 +After: [2, 3, 1, 3] + +Before: [0, 1, 0, 0] +9 0 0 2 +After: [0, 1, 0, 0] + +Before: [0, 1, 0, 1] +2 1 0 2 +After: [0, 1, 1, 1] + +Before: [0, 1, 0, 2] +2 1 0 3 +After: [0, 1, 0, 1] + +Before: [1, 2, 2, 2] +13 1 1 1 +After: [1, 1, 2, 2] + +Before: [1, 2, 1, 2] +3 1 3 3 +After: [1, 2, 1, 1] + +Before: [1, 0, 2, 3] +11 0 3 1 +After: [1, 0, 2, 3] + +Before: [0, 2, 0, 3] +15 1 3 0 +After: [3, 2, 0, 3] + +Before: [1, 2, 3, 3] +15 1 3 2 +After: [1, 2, 3, 3] + +Before: [0, 0, 1, 1] +10 1 2 2 +After: [0, 0, 1, 1] + +Before: [1, 3, 1, 3] +5 2 3 3 +After: [1, 3, 1, 3] + +Before: [1, 3, 1, 3] +6 0 1 2 +After: [1, 3, 3, 3] + +Before: [0, 1, 2, 2] +2 1 0 0 +After: [1, 1, 2, 2] + +Before: [2, 2, 2, 2] +3 1 3 0 +After: [1, 2, 2, 2] + +Before: [0, 1, 3, 2] +2 1 0 3 +After: [0, 1, 3, 1] + +Before: [2, 2, 3, 1] +13 1 0 1 +After: [2, 1, 3, 1] + +Before: [2, 0, 2, 1] +7 3 1 0 +After: [1, 0, 2, 1] + +Before: [1, 0, 3, 3] +12 0 2 0 +After: [3, 0, 3, 3] + +Before: [0, 0, 3, 3] +10 0 1 3 +After: [0, 0, 3, 1] + +Before: [0, 2, 0, 2] +9 0 0 0 +After: [0, 2, 0, 2] + +Before: [1, 2, 0, 3] +11 0 3 0 +After: [0, 2, 0, 3] + +Before: [2, 0, 0, 3] +11 0 3 0 +After: [0, 0, 0, 3] + +Before: [0, 2, 0, 2] +3 1 3 0 +After: [1, 2, 0, 2] + +Before: [1, 3, 1, 3] +6 0 1 1 +After: [1, 3, 1, 3] + +Before: [0, 1, 3, 2] +2 1 0 2 +After: [0, 1, 1, 2] + +Before: [1, 0, 3, 1] +1 1 0 2 +After: [1, 0, 1, 1] + +Before: [1, 0, 2, 0] +7 0 1 1 +After: [1, 1, 2, 0] + +Before: [2, 3, 1, 3] +15 0 3 3 +After: [2, 3, 1, 3] + +Before: [1, 2, 0, 3] +11 0 3 1 +After: [1, 0, 0, 3] + +Before: [1, 3, 0, 1] +6 0 1 0 +After: [3, 3, 0, 1] + +Before: [2, 2, 1, 2] +3 1 3 2 +After: [2, 2, 1, 2] + +Before: [1, 0, 3, 3] +1 1 0 2 +After: [1, 0, 1, 3] + +Before: [3, 1, 0, 3] +5 1 3 2 +After: [3, 1, 3, 3] + +Before: [0, 1, 2, 3] +8 2 1 1 +After: [0, 3, 2, 3] + +Before: [0, 2, 2, 2] +3 1 3 1 +After: [0, 1, 2, 2] + +Before: [1, 1, 2, 2] +0 0 3 1 +After: [1, 2, 2, 2] + +Before: [2, 3, 1, 3] +11 0 3 1 +After: [2, 0, 1, 3] + +Before: [3, 3, 2, 3] +4 1 2 0 +After: [1, 3, 2, 3] + +Before: [3, 1, 3, 3] +5 1 3 2 +After: [3, 1, 3, 3] + +Before: [2, 2, 1, 0] +13 1 1 1 +After: [2, 1, 1, 0] + +Before: [0, 1, 3, 2] +2 1 0 0 +After: [1, 1, 3, 2] + +Before: [3, 2, 0, 3] +15 1 3 0 +After: [3, 2, 0, 3] + +Before: [2, 3, 0, 2] +0 1 0 0 +After: [6, 3, 0, 2] + +Before: [2, 3, 0, 2] +4 1 0 1 +After: [2, 1, 0, 2] + +Before: [1, 0, 1, 2] +1 1 0 3 +After: [1, 0, 1, 1] + +Before: [2, 3, 3, 2] +0 3 2 1 +After: [2, 6, 3, 2] + +Before: [0, 1, 3, 1] +2 1 0 3 +After: [0, 1, 3, 1] + +Before: [2, 0, 0, 3] +15 0 3 3 +After: [2, 0, 0, 3] + +Before: [2, 1, 3, 3] +5 1 3 3 +After: [2, 1, 3, 3] + +Before: [3, 1, 3, 2] +12 1 2 3 +After: [3, 1, 3, 3] + +Before: [0, 2, 1, 2] +3 1 3 1 +After: [0, 1, 1, 2] + +Before: [0, 1, 0, 0] +2 1 0 3 +After: [0, 1, 0, 1] + +Before: [0, 2, 3, 1] +14 3 2 0 +After: [3, 2, 3, 1] + +Before: [3, 2, 2, 1] +13 1 1 1 +After: [3, 1, 2, 1] + +Before: [3, 3, 1, 3] +6 2 0 3 +After: [3, 3, 1, 3] + +Before: [3, 0, 3, 1] +14 3 2 3 +After: [3, 0, 3, 3] + +Before: [2, 3, 2, 3] +11 0 3 0 +After: [0, 3, 2, 3] + +Before: [2, 0, 1, 3] +5 2 3 2 +After: [2, 0, 3, 3] + +Before: [1, 3, 1, 3] +11 0 3 1 +After: [1, 0, 1, 3] + +Before: [1, 0, 1, 1] +7 3 1 1 +After: [1, 1, 1, 1] + +Before: [1, 2, 2, 1] +14 3 2 0 +After: [3, 2, 2, 1] + +Before: [1, 0, 2, 3] +8 1 2 1 +After: [1, 2, 2, 3] + +Before: [1, 0, 1, 0] +7 2 1 0 +After: [1, 0, 1, 0] + +Before: [2, 2, 1, 0] +13 1 1 2 +After: [2, 2, 1, 0] + +Before: [1, 0, 1, 2] +7 2 1 2 +After: [1, 0, 1, 2] + +Before: [2, 2, 2, 2] +3 1 3 2 +After: [2, 2, 1, 2] + +Before: [2, 1, 0, 3] +11 0 3 1 +After: [2, 0, 0, 3] + +Before: [2, 1, 2, 3] +11 0 3 1 +After: [2, 0, 2, 3] + +Before: [0, 0, 1, 1] +7 3 1 1 +After: [0, 1, 1, 1] + +Before: [1, 1, 0, 2] +14 3 1 1 +After: [1, 3, 0, 2] + +Before: [1, 0, 1, 0] +7 0 1 3 +After: [1, 0, 1, 1] + +Before: [0, 1, 2, 2] +8 3 2 1 +After: [0, 4, 2, 2] + +Before: [1, 3, 0, 2] +6 0 1 0 +After: [3, 3, 0, 2] + +Before: [1, 0, 1, 2] +7 0 1 0 +After: [1, 0, 1, 2] + +Before: [3, 0, 3, 1] +7 3 1 2 +After: [3, 0, 1, 1] + +Before: [0, 2, 0, 0] +9 0 0 0 +After: [0, 2, 0, 0] + +Before: [1, 1, 2, 3] +8 1 2 2 +After: [1, 1, 3, 3] + +Before: [0, 1, 2, 1] +2 1 0 1 +After: [0, 1, 2, 1] + +Before: [1, 3, 3, 3] +11 0 3 1 +After: [1, 0, 3, 3] + +Before: [3, 3, 1, 0] +6 2 0 0 +After: [3, 3, 1, 0] + +Before: [2, 2, 0, 3] +11 0 3 3 +After: [2, 2, 0, 0] + +Before: [3, 0, 1, 0] +7 2 1 0 +After: [1, 0, 1, 0] + +Before: [1, 0, 3, 3] +1 1 0 0 +After: [1, 0, 3, 3] + +Before: [1, 3, 3, 1] +14 3 2 3 +After: [1, 3, 3, 3] + +Before: [2, 2, 0, 0] +13 1 0 1 +After: [2, 1, 0, 0] + +Before: [2, 2, 2, 3] +15 2 3 0 +After: [3, 2, 2, 3] + +Before: [3, 3, 0, 3] +0 0 0 3 +After: [3, 3, 0, 9] + +Before: [2, 2, 1, 3] +15 1 3 0 +After: [3, 2, 1, 3] + +Before: [2, 1, 3, 2] +0 2 0 3 +After: [2, 1, 3, 6] + +Before: [0, 1, 1, 3] +2 1 0 2 +After: [0, 1, 1, 3] + +Before: [2, 0, 1, 1] +7 2 1 0 +After: [1, 0, 1, 1] + +Before: [1, 0, 2, 3] +8 1 3 2 +After: [1, 0, 3, 3] + +Before: [0, 1, 0, 3] +2 1 0 1 +After: [0, 1, 0, 3] + +Before: [0, 1, 2, 2] +2 1 0 3 +After: [0, 1, 2, 1] + +Before: [1, 0, 1, 3] +1 1 0 3 +After: [1, 0, 1, 1] + +Before: [2, 3, 1, 3] +4 1 0 3 +After: [2, 3, 1, 1] + +Before: [2, 3, 2, 1] +4 1 0 3 +After: [2, 3, 2, 1] + +Before: [1, 1, 1, 2] +0 0 3 0 +After: [2, 1, 1, 2] + +Before: [0, 0, 0, 1] +9 0 0 0 +After: [0, 0, 0, 1] + +Before: [1, 0, 3, 3] +5 0 3 1 +After: [1, 3, 3, 3] + +Before: [0, 1, 1, 0] +2 1 0 3 +After: [0, 1, 1, 1] + +Before: [1, 2, 1, 3] +10 1 0 3 +After: [1, 2, 1, 1] + +Before: [0, 2, 0, 2] +3 1 3 2 +After: [0, 2, 1, 2] + +Before: [2, 2, 1, 2] +3 1 3 3 +After: [2, 2, 1, 1] + +Before: [2, 1, 3, 2] +12 1 2 3 +After: [2, 1, 3, 3] + +Before: [2, 1, 2, 3] +15 2 3 3 +After: [2, 1, 2, 3] + +Before: [0, 1, 2, 2] +9 0 0 2 +After: [0, 1, 0, 2] + +Before: [0, 2, 2, 2] +8 0 2 0 +After: [2, 2, 2, 2] + +Before: [0, 3, 2, 3] +4 1 2 0 +After: [1, 3, 2, 3] + +Before: [1, 1, 3, 2] +8 0 3 0 +After: [3, 1, 3, 2] + +Before: [1, 1, 3, 1] +12 1 2 1 +After: [1, 3, 3, 1] + +Before: [2, 1, 1, 3] +5 1 3 3 +After: [2, 1, 1, 3] + +Before: [3, 1, 1, 2] +6 1 0 1 +After: [3, 3, 1, 2] + +Before: [1, 2, 2, 3] +15 2 3 0 +After: [3, 2, 2, 3] + +Before: [3, 1, 3, 2] +6 1 0 1 +After: [3, 3, 3, 2] + +Before: [2, 2, 0, 2] +3 1 3 1 +After: [2, 1, 0, 2] + +Before: [3, 0, 1, 3] +5 2 3 3 +After: [3, 0, 1, 3] + +Before: [3, 3, 1, 2] +8 2 3 2 +After: [3, 3, 3, 2] + +Before: [2, 1, 2, 0] +8 3 2 2 +After: [2, 1, 2, 0] + +Before: [1, 2, 3, 0] +12 0 2 2 +After: [1, 2, 3, 0] + +Before: [3, 2, 0, 2] +3 1 3 1 +After: [3, 1, 0, 2] + +Before: [1, 2, 1, 3] +5 0 3 2 +After: [1, 2, 3, 3] + +Before: [0, 1, 0, 3] +9 0 0 0 +After: [0, 1, 0, 3] + +Before: [1, 2, 3, 3] +10 1 0 2 +After: [1, 2, 1, 3] + +Before: [2, 2, 1, 1] +13 1 0 3 +After: [2, 2, 1, 1] + +Before: [2, 0, 2, 3] +15 2 3 0 +After: [3, 0, 2, 3] + +Before: [2, 0, 0, 1] +10 1 3 1 +After: [2, 1, 0, 1] + +Before: [1, 0, 2, 1] +1 1 0 1 +After: [1, 1, 2, 1] + +Before: [3, 0, 1, 3] +10 1 2 3 +After: [3, 0, 1, 1] + +Before: [1, 1, 3, 3] +5 1 3 1 +After: [1, 3, 3, 3] + +Before: [1, 1, 2, 3] +5 0 3 3 +After: [1, 1, 2, 3] + +Before: [3, 0, 1, 0] +6 2 0 3 +After: [3, 0, 1, 3] + +Before: [1, 2, 0, 0] +10 1 0 3 +After: [1, 2, 0, 1] + +Before: [0, 1, 0, 2] +2 1 0 0 +After: [1, 1, 0, 2] + +Before: [0, 1, 2, 0] +9 0 0 1 +After: [0, 0, 2, 0] + +Before: [1, 1, 0, 3] +8 2 3 1 +After: [1, 3, 0, 3] + +Before: [2, 3, 1, 3] +4 1 0 1 +After: [2, 1, 1, 3] + +Before: [0, 1, 3, 3] +9 0 0 3 +After: [0, 1, 3, 0] + +Before: [0, 0, 1, 3] +10 0 1 0 +After: [1, 0, 1, 3] + +Before: [2, 0, 1, 1] +10 1 3 3 +After: [2, 0, 1, 1] + +Before: [3, 3, 0, 0] +0 0 1 1 +After: [3, 9, 0, 0] + +Before: [1, 3, 2, 0] +4 1 2 0 +After: [1, 3, 2, 0] + +Before: [0, 1, 1, 3] +9 0 0 0 +After: [0, 1, 1, 3] + +Before: [0, 1, 2, 0] +2 1 0 2 +After: [0, 1, 1, 0] + +Before: [2, 3, 3, 0] +0 2 1 1 +After: [2, 9, 3, 0] + +Before: [0, 0, 1, 2] +10 1 2 3 +After: [0, 0, 1, 1] + +Before: [2, 2, 0, 2] +13 1 0 3 +After: [2, 2, 0, 1] + +Before: [1, 0, 1, 1] +10 1 2 0 +After: [1, 0, 1, 1] + +Before: [3, 3, 2, 2] +13 1 0 1 +After: [3, 1, 2, 2] + +Before: [1, 0, 2, 1] +8 0 2 1 +After: [1, 3, 2, 1] + +Before: [1, 1, 2, 2] +8 2 2 2 +After: [1, 1, 4, 2] + +Before: [0, 0, 1, 3] +5 2 3 3 +After: [0, 0, 1, 3] + +Before: [2, 3, 1, 0] +6 2 1 3 +After: [2, 3, 1, 3] + +Before: [1, 3, 1, 0] +6 2 1 3 +After: [1, 3, 1, 3] + +Before: [1, 0, 2, 3] +7 0 1 2 +After: [1, 0, 1, 3] + +Before: [2, 0, 3, 1] +0 3 0 0 +After: [2, 0, 3, 1] + +Before: [2, 2, 3, 2] +3 1 3 3 +After: [2, 2, 3, 1] + +Before: [0, 1, 0, 3] +2 1 0 2 +After: [0, 1, 1, 3] + +Before: [3, 1, 1, 3] +6 1 0 1 +After: [3, 3, 1, 3] + +Before: [1, 2, 2, 3] +13 1 1 1 +After: [1, 1, 2, 3] + +Before: [2, 2, 1, 3] +15 0 3 2 +After: [2, 2, 3, 3] + +Before: [1, 0, 0, 0] +1 1 0 1 +After: [1, 1, 0, 0] + +Before: [2, 2, 0, 3] +11 0 3 0 +After: [0, 2, 0, 3] + +Before: [1, 0, 3, 2] +1 1 0 0 +After: [1, 0, 3, 2] + +Before: [1, 0, 3, 0] +1 1 0 1 +After: [1, 1, 3, 0] + +Before: [0, 2, 2, 0] +9 0 0 3 +After: [0, 2, 2, 0] + +Before: [0, 3, 3, 3] +0 3 1 0 +After: [9, 3, 3, 3] + +Before: [3, 2, 1, 2] +3 1 3 2 +After: [3, 2, 1, 2] + +Before: [3, 1, 2, 2] +14 3 1 3 +After: [3, 1, 2, 3] + +Before: [3, 1, 3, 1] +12 1 2 1 +After: [3, 3, 3, 1] + +Before: [3, 3, 3, 3] +0 3 0 0 +After: [9, 3, 3, 3] + +Before: [1, 3, 3, 2] +12 0 2 2 +After: [1, 3, 3, 2] + +Before: [2, 0, 1, 3] +11 0 3 1 +After: [2, 0, 1, 3] + +Before: [1, 0, 1, 0] +1 1 0 2 +After: [1, 0, 1, 0] + +Before: [1, 2, 0, 2] +3 1 3 0 +After: [1, 2, 0, 2] + +Before: [1, 0, 1, 3] +11 0 3 2 +After: [1, 0, 0, 3] + +Before: [2, 0, 2, 1] +7 3 1 3 +After: [2, 0, 2, 1] + +Before: [0, 2, 3, 2] +3 1 3 2 +After: [0, 2, 1, 2] + +Before: [3, 1, 2, 1] +14 3 2 3 +After: [3, 1, 2, 3] + +Before: [1, 0, 2, 3] +1 1 0 1 +After: [1, 1, 2, 3] + +Before: [0, 1, 3, 1] +2 1 0 1 +After: [0, 1, 3, 1] + +Before: [1, 0, 2, 0] +1 1 0 3 +After: [1, 0, 2, 1] + +Before: [1, 2, 0, 3] +13 1 1 3 +After: [1, 2, 0, 1] + +Before: [0, 2, 2, 2] +9 0 0 3 +After: [0, 2, 2, 0] + +Before: [0, 2, 0, 1] +13 1 1 3 +After: [0, 2, 0, 1] + +Before: [1, 2, 2, 3] +13 1 1 0 +After: [1, 2, 2, 3] + +Before: [1, 0, 1, 2] +7 0 1 3 +After: [1, 0, 1, 1] + +Before: [2, 3, 2, 3] +15 2 3 3 +After: [2, 3, 2, 3] + +Before: [2, 3, 0, 3] +4 1 0 1 +After: [2, 1, 0, 3] + +Before: [1, 0, 0, 1] +7 0 1 0 +After: [1, 0, 0, 1] + +Before: [0, 1, 3, 2] +12 1 2 3 +After: [0, 1, 3, 3] + +Before: [2, 2, 1, 3] +11 0 3 1 +After: [2, 0, 1, 3] + +Before: [0, 3, 2, 2] +0 2 1 3 +After: [0, 3, 2, 6] + +Before: [3, 0, 3, 1] +14 3 2 1 +After: [3, 3, 3, 1] + +Before: [3, 3, 2, 0] +4 1 2 0 +After: [1, 3, 2, 0] + +Before: [2, 0, 3, 3] +15 0 3 3 +After: [2, 0, 3, 3] + +Before: [1, 0, 2, 0] +1 1 0 0 +After: [1, 0, 2, 0] + +Before: [2, 3, 1, 1] +6 2 1 0 +After: [3, 3, 1, 1] + +Before: [0, 1, 0, 0] +2 1 0 0 +After: [1, 1, 0, 0] + +Before: [0, 2, 1, 2] +9 0 0 2 +After: [0, 2, 0, 2] + +Before: [0, 2, 2, 1] +14 3 2 3 +After: [0, 2, 2, 3] + +Before: [2, 3, 2, 1] +4 1 2 0 +After: [1, 3, 2, 1] + +Before: [3, 3, 0, 3] +8 2 3 1 +After: [3, 3, 0, 3] + +Before: [3, 3, 3, 0] +13 1 0 0 +After: [1, 3, 3, 0] + +Before: [1, 3, 0, 3] +0 3 1 0 +After: [9, 3, 0, 3] + +Before: [1, 0, 1, 0] +1 1 0 3 +After: [1, 0, 1, 1] + +Before: [0, 0, 1, 3] +5 2 3 1 +After: [0, 3, 1, 3] + +Before: [3, 1, 3, 2] +12 1 2 1 +After: [3, 3, 3, 2] + +Before: [1, 3, 2, 1] +6 0 1 3 +After: [1, 3, 2, 3] + +Before: [2, 0, 2, 1] +8 0 2 1 +After: [2, 4, 2, 1] + +Before: [2, 0, 2, 2] +8 1 2 2 +After: [2, 0, 2, 2] + +Before: [0, 0, 1, 1] +7 3 1 2 +After: [0, 0, 1, 1] + +Before: [3, 0, 2, 2] +8 1 2 1 +After: [3, 2, 2, 2] + +Before: [3, 1, 3, 3] +5 1 3 3 +After: [3, 1, 3, 3] + +Before: [0, 1, 0, 2] +9 0 0 0 +After: [0, 1, 0, 2] + +Before: [3, 1, 2, 2] +6 1 0 0 +After: [3, 1, 2, 2] + +Before: [3, 0, 1, 0] +6 2 0 0 +After: [3, 0, 1, 0] + +Before: [0, 1, 1, 1] +9 0 0 2 +After: [0, 1, 0, 1] + +Before: [1, 2, 0, 3] +15 1 3 2 +After: [1, 2, 3, 3] + +Before: [2, 3, 1, 0] +4 1 0 2 +After: [2, 3, 1, 0] + +Before: [2, 1, 2, 2] +14 3 1 1 +After: [2, 3, 2, 2] + +Before: [3, 2, 0, 3] +15 1 3 3 +After: [3, 2, 0, 3] + +Before: [1, 3, 0, 0] +6 0 1 0 +After: [3, 3, 0, 0] + +Before: [0, 1, 1, 3] +2 1 0 0 +After: [1, 1, 1, 3] + +Before: [0, 3, 3, 1] +14 3 2 0 +After: [3, 3, 3, 1] + +Before: [1, 3, 3, 3] +13 1 2 1 +After: [1, 1, 3, 3] + +Before: [0, 3, 2, 0] +4 1 2 1 +After: [0, 1, 2, 0] + +Before: [1, 0, 3, 1] +12 0 2 0 +After: [3, 0, 3, 1] + +Before: [1, 1, 2, 2] +14 3 1 2 +After: [1, 1, 3, 2] + +Before: [2, 1, 1, 3] +5 2 3 2 +After: [2, 1, 3, 3] + +Before: [0, 2, 2, 3] +15 1 3 1 +After: [0, 3, 2, 3] + +Before: [3, 3, 2, 2] +4 1 2 3 +After: [3, 3, 2, 1] + +Before: [0, 1, 3, 1] +9 0 0 2 +After: [0, 1, 0, 1] + +Before: [3, 1, 1, 3] +5 2 3 0 +After: [3, 1, 1, 3] + +Before: [1, 0, 1, 3] +1 1 0 1 +After: [1, 1, 1, 3] + +Before: [1, 0, 0, 3] +1 1 0 2 +After: [1, 0, 1, 3] + +Before: [3, 2, 1, 2] +3 1 3 1 +After: [3, 1, 1, 2] + +Before: [3, 2, 3, 3] +15 1 3 0 +After: [3, 2, 3, 3] + +Before: [1, 2, 3, 3] +0 2 2 2 +After: [1, 2, 9, 3] + +Before: [3, 0, 0, 1] +7 3 1 3 +After: [3, 0, 0, 1] + +Before: [0, 1, 0, 1] +2 1 0 1 +After: [0, 1, 0, 1] + +Before: [2, 1, 1, 3] +5 2 3 0 +After: [3, 1, 1, 3] + +Before: [0, 1, 1, 2] +2 1 0 1 +After: [0, 1, 1, 2] + +Before: [0, 0, 2, 3] +9 0 0 0 +After: [0, 0, 2, 3] + +Before: [0, 2, 1, 2] +8 2 3 3 +After: [0, 2, 1, 3] + +Before: [1, 0, 1, 1] +1 1 0 3 +After: [1, 0, 1, 1] + +Before: [1, 0, 1, 3] +8 1 3 0 +After: [3, 0, 1, 3] + +Before: [3, 1, 3, 2] +14 3 1 0 +After: [3, 1, 3, 2] + +Before: [2, 2, 0, 0] +13 1 0 2 +After: [2, 2, 1, 0] + +Before: [3, 1, 3, 1] +12 1 2 0 +After: [3, 1, 3, 1] + +Before: [0, 3, 3, 0] +13 1 2 1 +After: [0, 1, 3, 0] + +Before: [3, 1, 3, 3] +12 1 2 0 +After: [3, 1, 3, 3] + +Before: [1, 2, 2, 3] +8 0 2 1 +After: [1, 3, 2, 3] + +Before: [3, 0, 1, 0] +7 2 1 3 +After: [3, 0, 1, 1] + +Before: [0, 1, 2, 3] +2 1 0 3 +After: [0, 1, 2, 1] + +Before: [0, 0, 1, 0] +9 0 0 1 +After: [0, 0, 1, 0] + +Before: [3, 2, 3, 1] +13 1 1 1 +After: [3, 1, 3, 1] + +Before: [2, 2, 0, 2] +3 1 3 2 +After: [2, 2, 1, 2] + +Before: [3, 3, 3, 2] +0 2 0 0 +After: [9, 3, 3, 2] + +Before: [0, 0, 2, 3] +10 0 1 1 +After: [0, 1, 2, 3] + +Before: [2, 3, 2, 2] +8 0 2 3 +After: [2, 3, 2, 4] + +Before: [3, 3, 2, 1] +14 3 2 1 +After: [3, 3, 2, 1] + +Before: [0, 0, 1, 1] +9 0 0 1 +After: [0, 0, 1, 1] + +Before: [0, 2, 2, 2] +3 1 3 0 +After: [1, 2, 2, 2] + +Before: [2, 2, 1, 2] +3 1 3 1 +After: [2, 1, 1, 2] + +Before: [2, 1, 2, 3] +11 0 3 2 +After: [2, 1, 0, 3] + +Before: [1, 2, 2, 2] +3 1 3 2 +After: [1, 2, 1, 2] + +Before: [1, 3, 2, 0] +4 1 2 2 +After: [1, 3, 1, 0] + +Before: [1, 1, 3, 3] +12 1 2 2 +After: [1, 1, 3, 3] + +Before: [1, 2, 0, 3] +15 1 3 3 +After: [1, 2, 0, 3] + +Before: [1, 2, 3, 3] +12 0 2 3 +After: [1, 2, 3, 3] + +Before: [0, 2, 1, 2] +3 1 3 2 +After: [0, 2, 1, 2] + +Before: [1, 1, 1, 2] +8 1 3 1 +After: [1, 3, 1, 2] + +Before: [1, 1, 2, 1] +14 3 2 1 +After: [1, 3, 2, 1] + +Before: [1, 0, 1, 1] +1 1 0 0 +After: [1, 0, 1, 1] + +Before: [2, 1, 1, 3] +15 0 3 0 +After: [3, 1, 1, 3] + +Before: [2, 1, 1, 3] +11 0 3 1 +After: [2, 0, 1, 3] + +Before: [2, 3, 1, 3] +11 0 3 0 +After: [0, 3, 1, 3] + +Before: [0, 3, 1, 1] +9 0 0 0 +After: [0, 3, 1, 1] + +Before: [1, 0, 2, 1] +7 0 1 2 +After: [1, 0, 1, 1] + +Before: [1, 0, 0, 0] +1 1 0 2 +After: [1, 0, 1, 0] + +Before: [1, 0, 2, 1] +1 1 0 0 +After: [1, 0, 2, 1] + +Before: [0, 3, 3, 0] +13 1 2 2 +After: [0, 3, 1, 0] + +Before: [3, 2, 0, 2] +0 0 0 2 +After: [3, 2, 9, 2] + +Before: [2, 1, 2, 3] +5 1 3 0 +After: [3, 1, 2, 3] + +Before: [2, 2, 2, 2] +3 1 3 3 +After: [2, 2, 2, 1] + +Before: [1, 3, 2, 3] +5 0 3 1 +After: [1, 3, 2, 3] + +Before: [2, 1, 3, 2] +0 1 0 0 +After: [2, 1, 3, 2] + +Before: [1, 0, 0, 1] +1 1 0 2 +After: [1, 0, 1, 1] + +Before: [3, 3, 3, 0] +0 2 2 0 +After: [9, 3, 3, 0] + +Before: [2, 2, 3, 3] +15 0 3 3 +After: [2, 2, 3, 3] + +Before: [0, 3, 2, 3] +15 2 3 2 +After: [0, 3, 3, 3] + +Before: [1, 2, 0, 2] +13 1 1 1 +After: [1, 1, 0, 2] + +Before: [0, 3, 1, 1] +9 0 0 2 +After: [0, 3, 0, 1] + +Before: [0, 1, 2, 2] +8 2 2 3 +After: [0, 1, 2, 4] + +Before: [0, 0, 2, 1] +9 0 0 1 +After: [0, 0, 2, 1] + +Before: [2, 3, 0, 3] +4 1 0 2 +After: [2, 3, 1, 3] + +Before: [1, 0, 2, 2] +7 0 1 0 +After: [1, 0, 2, 2] + +Before: [3, 1, 3, 3] +0 3 2 0 +After: [9, 1, 3, 3] + +Before: [2, 3, 2, 3] +11 0 3 1 +After: [2, 0, 2, 3] + +Before: [1, 0, 3, 0] +7 0 1 0 +After: [1, 0, 3, 0] + +Before: [1, 3, 2, 3] +15 2 3 0 +After: [3, 3, 2, 3] + +Before: [1, 3, 3, 0] +6 0 1 0 +After: [3, 3, 3, 0] + +Before: [3, 0, 1, 2] +7 2 1 1 +After: [3, 1, 1, 2] + +Before: [0, 3, 1, 1] +6 2 1 1 +After: [0, 3, 1, 1] + +Before: [3, 3, 3, 0] +0 2 1 3 +After: [3, 3, 3, 9] + +Before: [3, 2, 1, 1] +6 2 0 3 +After: [3, 2, 1, 3] + +Before: [1, 0, 3, 0] +12 0 2 0 +After: [3, 0, 3, 0] + +Before: [1, 2, 1, 0] +10 1 0 2 +After: [1, 2, 1, 0] + +Before: [1, 3, 2, 1] +0 1 1 1 +After: [1, 9, 2, 1] + +Before: [2, 3, 1, 3] +11 0 3 2 +After: [2, 3, 0, 3] + +Before: [0, 1, 1, 0] +2 1 0 0 +After: [1, 1, 1, 0] + +Before: [2, 2, 3, 3] +15 1 3 1 +After: [2, 3, 3, 3] + +Before: [2, 3, 0, 1] +0 3 0 1 +After: [2, 2, 0, 1] + +Before: [1, 0, 1, 0] +1 1 0 0 +After: [1, 0, 1, 0] + +Before: [2, 2, 0, 0] +13 1 1 2 +After: [2, 2, 1, 0] + +Before: [2, 0, 3, 1] +14 3 2 0 +After: [3, 0, 3, 1] + +Before: [2, 1, 3, 1] +14 3 2 2 +After: [2, 1, 3, 1] + +Before: [3, 3, 1, 3] +6 2 1 2 +After: [3, 3, 3, 3] + +Before: [1, 2, 1, 2] +3 1 3 1 +After: [1, 1, 1, 2] + +Before: [1, 2, 2, 3] +10 1 0 0 +After: [1, 2, 2, 3] + +Before: [0, 1, 3, 3] +5 1 3 2 +After: [0, 1, 3, 3] + +Before: [2, 1, 2, 1] +14 3 2 3 +After: [2, 1, 2, 3] + +Before: [3, 3, 2, 3] +4 1 2 3 +After: [3, 3, 2, 1] + +Before: [1, 3, 2, 3] +11 0 3 0 +After: [0, 3, 2, 3] + +Before: [1, 2, 0, 2] +0 0 3 1 +After: [1, 2, 0, 2] + +Before: [2, 2, 2, 2] +13 1 0 3 +After: [2, 2, 2, 1] + +Before: [1, 3, 2, 1] +6 0 1 1 +After: [1, 3, 2, 1] + +Before: [1, 3, 2, 1] +14 3 2 0 +After: [3, 3, 2, 1] + +Before: [2, 3, 3, 1] +14 3 2 0 +After: [3, 3, 3, 1] + +Before: [1, 2, 1, 3] +5 2 3 0 +After: [3, 2, 1, 3] + +Before: [1, 1, 3, 3] +11 0 3 1 +After: [1, 0, 3, 3] + +Before: [3, 1, 2, 1] +6 1 0 3 +After: [3, 1, 2, 3] + +Before: [1, 0, 1, 0] +7 0 1 2 +After: [1, 0, 1, 0] + +Before: [3, 0, 1, 2] +8 2 3 0 +After: [3, 0, 1, 2] + +Before: [2, 3, 0, 2] +4 1 0 3 +After: [2, 3, 0, 1] + +Before: [0, 2, 2, 2] +8 1 2 0 +After: [4, 2, 2, 2] + +Before: [3, 2, 2, 0] +8 3 2 1 +After: [3, 2, 2, 0] + +Before: [2, 1, 2, 0] +8 0 2 1 +After: [2, 4, 2, 0] + +Before: [3, 1, 3, 1] +14 3 2 2 +After: [3, 1, 3, 1] + +Before: [3, 3, 1, 2] +0 0 0 3 +After: [3, 3, 1, 9] + +Before: [2, 1, 0, 2] +0 1 0 3 +After: [2, 1, 0, 2] + +Before: [3, 3, 1, 3] +0 0 0 2 +After: [3, 3, 9, 3] + +Before: [1, 0, 2, 0] +1 1 0 1 +After: [1, 1, 2, 0] + +Before: [1, 2, 1, 1] +10 1 0 0 +After: [1, 2, 1, 1] + +Before: [1, 0, 1, 2] +1 1 0 1 +After: [1, 1, 1, 2] + + + +5 1 0 0 +12 0 2 0 +5 0 0 2 +12 2 3 2 +5 0 0 3 +12 3 1 3 +0 3 0 0 +5 0 3 0 +8 0 1 1 +2 1 1 3 +14 2 3 2 +14 0 2 1 +14 1 1 0 +2 0 2 0 +5 0 1 0 +8 3 0 3 +2 3 3 1 +14 2 1 3 +14 1 1 2 +14 2 0 0 +3 0 3 2 +5 2 1 2 +5 2 3 2 +8 1 2 1 +2 1 1 3 +5 2 0 1 +12 1 2 1 +14 1 1 0 +14 2 3 2 +2 0 2 2 +5 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3 +5 3 2 3 +8 3 0 0 +2 0 0 2 +5 0 0 3 +12 3 2 3 +14 0 3 1 +14 2 2 0 +3 0 3 1 +5 1 3 1 +5 1 3 1 +8 2 1 2 +5 1 0 1 +12 1 2 1 +14 3 0 0 +9 0 1 3 +5 3 1 3 +8 2 3 2 +2 2 2 1 +14 2 3 0 +14 2 2 3 +14 3 0 2 +6 0 2 3 +5 3 1 3 +5 3 1 3 +8 1 3 1 +2 1 0 3 +14 3 3 0 +14 2 2 1 +9 0 1 1 +5 1 1 1 +8 1 3 3 +14 1 0 2 +14 3 0 1 +14 1 0 0 +7 1 2 0 +5 0 3 0 +5 0 2 0 +8 3 0 3 +5 1 0 0 +12 0 3 0 +14 1 0 1 +7 0 2 2 +5 2 1 2 +8 3 2 3 +2 3 1 2 +14 2 3 3 +14 1 2 0 +0 1 3 1 +5 1 2 1 +8 2 1 2 +2 2 3 1 +5 1 0 0 +12 0 2 0 +14 0 3 2 +3 0 3 0 +5 0 3 0 +5 0 3 0 +8 1 0 1 +2 1 2 2 +14 2 2 0 +14 0 3 1 +14 0 1 3 +14 3 0 0 +5 0 2 0 +8 0 2 2 +2 2 2 3 +14 1 3 0 +5 1 0 1 +12 1 1 1 +14 0 2 2 +8 1 0 1 +5 1 3 1 +5 1 1 1 +8 1 3 3 +2 3 0 0 diff --git a/www/statics/aoc/2018/17-1.linq b/www/statics/aoc/2018/17-1.linq new file mode 100644 index 0000000..861ec4b --- /dev/null +++ b/www/statics/aoc/2018/17-1.linq @@ -0,0 +1,173 @@ + + System.Drawing + + +bool[,] Map; +int X0; +int Y0; +int Width; +int Height; + +enum Water { None=0, Flow=1, Rest=2 } +Water[,] water; + +void Main() +{ + Load(File.ReadAllLines(Path.Combine(Path.GetDirectoryName(Util.CurrentQueryPath), @"17_input.txt"))); + //DumpMap(); + + water[500, 0] = Water.Flow; + int w = 0; + Water[,] wold = new Water[Width, Height]; + for (int gen = 0; ; gen++) + { + Tick(); + //Util.ClearResults(); + //DumpMap(); + int w0 = WaterCount(); + if (w == w0 && WaterEquals(wold,water)) { $"{w0} after {gen} generations".Dump(); DumpMap(); /* DumpMapASCII(); */ return; } + w=w0; + for (int y = 0; y < Height; y++) for (int x = 0; x < Width; x++) wold[x,y]=water[x,y]; + } + + +} + +bool WaterEquals(Water[,] a, Water[,] b) +{ + for (int y = 0; y < Height; y++) for (int x = 0; x < Width; x++) if (a[x,y] != b[x,y])return false; + return true; +} + +int WaterCount() +{ + int c = 0; + for (int y = Y0; y < Height; y++) for (int x = 0; x < Width; x++) if (water[x,y] != Water.None)c++; + return c; +} + +void Tick() +{ + for (int xx = 0; xx < Width; xx++) for (int yy = 0; yy < Height; yy++) if (water[xx,yy]==Water.Flow) water[xx,yy]=Water.None; + + var next = new Stack<(int,int)>(); + next.Push( (500, 0) ); + while (next.Any()) + { + (var x, var y) = next.Pop(); + + if (y==Height-1) continue; + + if (Map[x,y+1] || water[x,y+1]==Water.Rest) + { + var l = false; + var r = false; + if (!Map[x - 1, y] && water[x - 1, y] == Water.None) { l = true; water[x - 1, y] = Water.Flow; next.Push((x - 1, y)); } + if (!Map[x + 1, y] && water[x + 1, y] == Water.None) { r = true; water[x + 1, y] = Water.Flow; next.Push((x + 1, y)); } + + if (!l && !r) + { + var solid = true; + for (int xx = x; solid; xx++) + { + if (water[xx, y] == Water.None) { solid = false; break; } + if (!(Map[xx, y + 1] || water[xx, y + 1] == Water.Rest)) { solid = false; break; } + if (Map[xx + 1, y]) break; + } + for (int xx = x; solid; xx--) + { + if (water[xx, y] == Water.None) { solid = false; break; } + if (!(Map[xx, y + 1] || water[xx, y + 1] == Water.Rest)) { solid = false; break; } + if (Map[xx - 1, y]) break; + } + + if (solid) + { + for (int xx = x; !Map[xx, y]; xx++) { Assert(water[xx, y] != Water.None); water[xx, y] = Water.Rest; } + for (int xx = x; !Map[xx, y]; xx--) { Assert(water[xx, y] != Water.None); water[xx, y] = Water.Rest; } + } + } + } + else + { + water[x, y+1] = Water.Flow; + next.Push( (x,y+1) ); + } + } +} + +void Load(string[] v) +{ + var data = new List<(int,int,int,int)>(); + + for (int i = 0; i < v.Length; i++) + { + var a = v[i].Split(',')[0].Trim(); + var b = v[i].Split(',')[1].Trim(); + + if (b.StartsWith("x")) { var t = b; b = a; a = t; } + + a = a.Substring(2); + b = b.Substring(2); + + var a1 = int.Parse(a.Contains("..") ? a.Split('.')[0] : a); + var a2 = int.Parse(a.Contains("..") ? a.Split('.')[2] : a); + var b1 = int.Parse(b.Contains("..") ? b.Split('.')[0] : b); + var b2 = int.Parse(b.Contains("..") ? b.Split('.')[2] : b); + + data.Add( (a1,a2,b1,b2) ); + } + + Width = data.Max(m => Math.Max(m.Item1, m.Item2)) + 1; + Height = data.Max(m => Math.Max(m.Item3, m.Item4)) + 1; + X0 = data.Min(m => Math.Min(m.Item1, m.Item2)) - 1; + Y0 = data.Min(m => Math.Min(m.Item3, m.Item4)); + Map = new bool[Width, Height]; + + foreach ((var x1, var x2, var y1, var y2) in data) + { + for (int x = x1; x <= x2; x++) for (int y = y1; y <= y2; y++) Map[x, y] = true; + } + + water = new Water[Width, Height]; +} + +void DumpMap() +{ + Bitmap bmp = new Bitmap(Width - X0, Height, System.Drawing.Imaging.PixelFormat.Format24bppRgb); + using (Graphics g = Graphics.FromImage(bmp)) + { + g.Clear(Color.Wheat); + for (int y = 0; y < Height; y++) + { + for (int x = X0; x < Width; x++) + { + if (x == (500 - X0) && y == 0) g.FillRectangle(Brushes.DarkBlue, x - X0, y, 1, 1); + else if (Map[x, y]) g.FillRectangle(Brushes.Black, x - X0, y, 1, 1); + else if (water[x, y] == Water.Flow) g.FillRectangle(Brushes.Cyan, x - X0, y, 1, 1); + else if (water[x, y] == Water.Rest) g.FillRectangle(Brushes.LightBlue, x - X0, y, 1, 1); + } + } + } + bmp.Dump(); +} + +void DumpMapASCII() +{ + StringBuilder b = new StringBuilder(); + for (int y = 0; y < Height; y++) + { + for (int x = 0; x < Width; x++) + { + if (x == (500) && y == 0) b.Append('+'); + else if (Map[x, y]) b.Append('#'); + else if (water[x, y] == Water.Flow) b.Append('|'); + else if (water[x, y] == Water.Rest) b.Append('~'); + else b.Append('.'); + } + b.AppendLine(); + } + b.ToString().Dump(); +} + +void Assert(bool b) { if (!b) throw new Exception(); } \ No newline at end of file diff --git a/www/statics/aoc/2018/17-2.linq b/www/statics/aoc/2018/17-2.linq new file mode 100644 index 0000000..f9f3ca6 --- /dev/null +++ b/www/statics/aoc/2018/17-2.linq @@ -0,0 +1,180 @@ + + System.Drawing + + +bool[,] Map; +int X0; +int Y0; +int Width; +int Height; + +enum Water { None=0, Flow=1, Rest=2 } +Water[,] water; + +void Main() +{ + Load(File.ReadAllLines(Path.Combine(Path.GetDirectoryName(Util.CurrentQueryPath), @"17_input.txt"))); + //DumpMap(); + + water[500, 0] = Water.Flow; + int w = 0; + Water[,] wold = new Water[Width, Height]; + for (int gen = 0; ; gen++) + { + Tick(); + //Util.ClearResults(); + //DumpMap(); + int w0 = WaterCount(); + if (w == w0 && WaterEquals(wold, water)) { $"{StillWaterCount()} after {gen} generations (all = {w0})".Dump(); DumpMap(); /* DumpMapASCII(); */ return; } + w=w0; + for (int y = 0; y < Height; y++) for (int x = 0; x < Width; x++) wold[x,y]=water[x,y]; + } + + +} + +bool WaterEquals(Water[,] a, Water[,] b) +{ + for (int y = 0; y < Height; y++) for (int x = 0; x < Width; x++) if (a[x,y] != b[x,y])return false; + return true; +} + +int WaterCount() +{ + int c = 0; + for (int y = Y0; y < Height; y++) for (int x = 0; x < Width; x++) if (water[x, y] != Water.None) c++; + return c; +} + +int StillWaterCount() +{ + int c = 0; + for (int y = Y0; y < Height; y++) for (int x = 0; x < Width; x++) if (water[x, y] == Water.Rest) c++; + return c; +} + +void Tick() +{ + for (int xx = 0; xx < Width; xx++) for (int yy = 0; yy < Height; yy++) if (water[xx,yy]==Water.Flow) water[xx,yy]=Water.None; + + var next = new Stack<(int,int)>(); + next.Push( (500, 0) ); + while (next.Any()) + { + (var x, var y) = next.Pop(); + + if (y==Height-1) continue; + + if (Map[x,y+1] || water[x,y+1]==Water.Rest) + { + var l = false; + var r = false; + if (!Map[x - 1, y] && water[x - 1, y] == Water.None) { l = true; water[x - 1, y] = Water.Flow; next.Push((x - 1, y)); } + if (!Map[x + 1, y] && water[x + 1, y] == Water.None) { r = true; water[x + 1, y] = Water.Flow; next.Push((x + 1, y)); } + + if (!l && !r) + { + var solid = true; + for (int xx = x; solid; xx++) + { + if (water[xx, y] == Water.None) { solid = false; break; } + if (!(Map[xx, y + 1] || water[xx, y + 1] == Water.Rest)) { solid = false; break; } + if (Map[xx + 1, y]) break; + } + for (int xx = x; solid; xx--) + { + if (water[xx, y] == Water.None) { solid = false; break; } + if (!(Map[xx, y + 1] || water[xx, y + 1] == Water.Rest)) { solid = false; break; } + if (Map[xx - 1, y]) break; + } + + if (solid) + { + for (int xx = x; !Map[xx, y]; xx++) { Assert(water[xx, y] != Water.None); water[xx, y] = Water.Rest; } + for (int xx = x; !Map[xx, y]; xx--) { Assert(water[xx, y] != Water.None); water[xx, y] = Water.Rest; } + } + } + } + else + { + water[x, y+1] = Water.Flow; + next.Push( (x,y+1) ); + } + } +} + +void Load(string[] v) +{ + var data = new List<(int,int,int,int)>(); + + for (int i = 0; i < v.Length; i++) + { + var a = v[i].Split(',')[0].Trim(); + var b = v[i].Split(',')[1].Trim(); + + if (b.StartsWith("x")) { var t = b; b = a; a = t; } + + a = a.Substring(2); + b = b.Substring(2); + + var a1 = int.Parse(a.Contains("..") ? a.Split('.')[0] : a); + var a2 = int.Parse(a.Contains("..") ? a.Split('.')[2] : a); + var b1 = int.Parse(b.Contains("..") ? b.Split('.')[0] : b); + var b2 = int.Parse(b.Contains("..") ? b.Split('.')[2] : b); + + data.Add( (a1,a2,b1,b2) ); + } + + Width = data.Max(m => Math.Max(m.Item1, m.Item2)) + 1; + Height = data.Max(m => Math.Max(m.Item3, m.Item4)) + 1; + X0 = data.Min(m => Math.Min(m.Item1, m.Item2)) - 1; + Y0 = data.Min(m => Math.Min(m.Item3, m.Item4)); + Map = new bool[Width, Height]; + + foreach ((var x1, var x2, var y1, var y2) in data) + { + for (int x = x1; x <= x2; x++) for (int y = y1; y <= y2; y++) Map[x, y] = true; + } + + water = new Water[Width, Height]; +} + +void DumpMap() +{ + Bitmap bmp = new Bitmap(Width - X0, Height, System.Drawing.Imaging.PixelFormat.Format24bppRgb); + using (Graphics g = Graphics.FromImage(bmp)) + { + g.Clear(Color.Wheat); + for (int y = 0; y < Height; y++) + { + for (int x = X0; x < Width; x++) + { + if (x == (500 - X0) && y == 0) g.FillRectangle(Brushes.DarkBlue, x - X0, y, 1, 1); + else if (Map[x, y]) g.FillRectangle(Brushes.Black, x - X0, y, 1, 1); + else if (water[x, y] == Water.Flow) g.FillRectangle(Brushes.Cyan, x - X0, y, 1, 1); + else if (water[x, y] == Water.Rest) g.FillRectangle(Brushes.LightBlue, x - X0, y, 1, 1); + } + } + } + bmp.Dump(); +} + +void DumpMapASCII() +{ + StringBuilder b = new StringBuilder(); + for (int y = 0; y < Height; y++) + { + for (int x = 0; x < Width; x++) + { + if (x == (500) && y == 0) b.Append('+'); + else if (Map[x, y]) b.Append('#'); + else if (water[x, y] == Water.Flow) b.Append('|'); + else if (water[x, y] == Water.Rest) b.Append('~'); + else b.Append('.'); + } + b.AppendLine(); + } + b.ToString().Dump(); +} + +void Assert(bool b) { if (!b) throw new Exception(); } \ No newline at end of file diff --git a/www/statics/aoc/2018/17_challenge.txt b/www/statics/aoc/2018/17_challenge.txt new file mode 100644 index 0000000..9f752c7 --- /dev/null +++ b/www/statics/aoc/2018/17_challenge.txt @@ -0,0 +1,161 @@ +--- 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? + +You scan a two-dimensional vertical slice of the ground nearby and discover that it is mostly sand with veins of clay. The scan only provides data with a granularity of square meters, but it should be good enough to determine how much water is trapped there. In the scan, x represents the distance to the right, and y represents the distance down. There is also a spring of water near the surface at x=500, y=0. The scan identifies which square meters are clay (your puzzle input). + +For example, suppose your scan shows the following veins of clay: + +x=495, y=2..7 +y=7, x=495..501 +x=501, y=3..7 +x=498, y=2..4 +x=506, y=1..2 +x=498, y=10..13 +x=504, y=10..13 +y=13, x=498..504 + +Rendering clay as #, sand as ., and the water spring as +, and with x increasing to the right and y increasing downward, this becomes: + + 44444455555555 + 99999900000000 + 45678901234567 + 0 ......+....... + 1 ............#. + 2 .#..#.......#. + 3 .#..#..#...... + 4 .#..#..#...... + 5 .#.....#...... + 6 .#.....#...... + 7 .#######...... + 8 .............. + 9 .............. +10 ....#.....#... +11 ....#.....#... +12 ....#.....#... +13 ....#######... + +The spring of water will produce water forever. Water can move through sand, but is blocked by clay. Water always moves down when possible, and spreads to the left and right otherwise, filling space that has clay on both sides and falling out otherwise. + +For example, if five squares of water are created, they will flow downward until they reach the clay and settle there. Water that has come to rest is shown here as ~, while sand through which water has passed (but which is now dry again) is shown as |: + +......+....... +......|.....#. +.#..#.|.....#. +.#..#.|#...... +.#..#.|#...... +.#....|#...... +.#~~~~~#...... +.#######...... +.............. +.............. +....#.....#... +....#.....#... +....#.....#... +....#######... + +Two squares of water can't occupy the same location. If another five squares of water are created, they will settle on the first five, filling the clay reservoir a little more: + +......+....... +......|.....#. +.#..#.|.....#. +.#..#.|#...... +.#..#.|#...... +.#~~~~~#...... +.#~~~~~#...... +.#######...... +.............. +.............. +....#.....#... +....#.....#... +....#.....#... +....#######... + +Water pressure does not apply in this scenario. If another four squares of water are created, they will stay on the right side of the barrier, and no water will reach the left side: + +......+....... +......|.....#. +.#..#.|.....#. +.#..#~~#...... +.#..#~~#...... +.#~~~~~#...... +.#~~~~~#...... +.#######...... +.............. +.............. +....#.....#... +....#.....#... +....#.....#... +....#######... + +At this point, the top reservoir overflows. While water can reach the tiles above the surface of the water, it cannot settle there, and so the next five squares of water settle like this: + +......+....... +......|.....#. +.#..#||||...#. +.#..#~~#|..... +.#..#~~#|..... +.#~~~~~#|..... +.#~~~~~#|..... +.#######|..... +........|..... +........|..... +....#...|.#... +....#...|.#... +....#~~~~~#... +....#######... + +Note especially the leftmost |: the new squares of water can reach this tile, but cannot stop there. Instead, eventually, they all fall to the right and settle in the reservoir below. + +After 10 more squares of water, the bottom reservoir is also full: + +......+....... +......|.....#. +.#..#||||...#. +.#..#~~#|..... +.#..#~~#|..... +.#~~~~~#|..... +.#~~~~~#|..... +.#######|..... +........|..... +........|..... +....#~~~~~#... +....#~~~~~#... +....#~~~~~#... +....#######... + +Finally, while there is nowhere left for the water to settle, it can reach a few more tiles before overflowing beyond the bottom of the scanned data: + +......+....... (line not counted: above minimum y value) +......|.....#. +.#..#||||...#. +.#..#~~#|..... +.#..#~~#|..... +.#~~~~~#|..... +.#~~~~~#|..... +.#######|..... +........|..... +...|||||||||.. +...|#~~~~~#|.. +...|#~~~~~#|.. +...|#~~~~~#|.. +...|#######|.. +...|.......|.. (line not counted: below maximum y value) +...|.......|.. (line not counted: below maximum y value) +...|.......|.. (line not counted: below maximum y value) + +How many tiles can be reached by the water? To prevent counting forever, ignore tiles with a y coordinate smaller than the smallest y coordinate in your scan data or larger than the largest one. Any x coordinate is valid. In this example, the lowest y coordinate given is 1, and the highest is 13, causing the water spring (in row 0) and the water falling off the bottom of the render (in rows 14 through infinity) to be ignored. + +So, in the example above, counting both water at rest (~) and other sand tiles the water can hypothetically reach (|), the total number of tiles the water can reach is 57. + +How many tiles can the water reach within the range of y values in your scan? + +--- Part Two --- + +After a very long time, the water spring will run dry. How much water will be retained? + +In the example above, water that won't eventually drain out is shown as ~, a total of 29 tiles. + +How many water tiles are left after the water spring stops producing water and all remaining water not at rest has drained? diff --git a/www/statics/aoc/2018/17_input.txt b/www/statics/aoc/2018/17_input.txt new file mode 100644 index 0000000..243d615 --- /dev/null +++ b/www/statics/aoc/2018/17_input.txt @@ -0,0 +1,1117 @@ +x=573, y=917..931 +x=574, y=1553..1568 +x=544, y=1152..1162 +x=567, y=1883..1895 +x=535, y=230..233 +x=566, y=360..373 +y=1537, x=512..531 +x=556, y=675..687 +y=41, x=499..515 +x=496, y=1586..1594 +x=483, y=237..250 +y=69, x=498..507 +y=1912, x=560..569 +y=756, x=493..495 +x=487, y=1548..1556 +y=1036, x=522..524 +y=21, x=493..507 +y=1096, x=530..532 +x=506, y=1669..1674 +x=537, y=919..936 +x=563, y=1772..1777 +y=1260, x=486..488 +x=578, y=1538..1540 +y=1159, x=551..555 +y=1015, x=533..549 +x=486, y=1424..1430 +x=520, y=183..199 +y=167, x=537..543 +x=531, y=15..25 +y=1333, x=486..492 +x=570, y=398..408 +x=539, y=1282..1293 +x=569, y=721..723 +y=1719, x=494..497 +x=575, y=865..875 +y=973, x=528..548 +y=576, x=558..561 +y=164, x=512..515 +y=1567, x=508..519 +x=508, y=1670..1674 +x=523, y=296..310 +x=517, y=1793..1797 +x=493, y=653..666 +x=542, y=1925..1937 +y=355, x=568..591 +x=556, y=1776..1783 +y=924, x=497..513 +x=552, y=180..197 +x=520, y=1430..1440 +y=167, x=507..527 +y=1331, x=518..520 +x=558, y=1398..1416 +y=1674, x=506..508 +x=565, y=1140..1156 +y=325, x=529..531 +y=529, x=491..494 +x=560, y=197..207 +x=513, y=1371..1389 +x=547, y=1068..1078 +x=508, y=826..829 +x=565, y=843..854 +x=570, y=773..785 +y=1039, x=515..533 +x=543, y=93..104 +y=301, x=534..559 +x=507, y=319..331 +x=564, y=899..912 +y=1252, x=522..539 +x=576, y=1260..1262 +y=1654, x=545..548 +x=533, y=456..470 +y=1384, x=505..507 +x=528, y=963..973 +x=531, y=1670..1674 +x=512, y=1527..1537 +y=1187, x=522..551 +y=1078, x=547..549 +y=633, x=512..514 +x=524, y=1202..1216 +x=516, y=1491..1498 +x=553, y=162..172 +y=408, x=505..570 +x=530, y=1624..1632 +y=687, x=556..576 +x=503, y=1599..1604 +x=564, y=322..325 +x=525, y=1582..1594 +y=1556, x=487..502 +x=507, y=68..69 +y=1632, x=524..530 +x=511, y=400..405 +y=697, x=485..500 +x=559, y=1573..1595 +x=588, y=659..685 +y=1568, x=532..538 +y=895, x=497..499 +x=579, y=1760..1764 +y=760, x=520..524 +y=101, x=551..554 +y=224, x=552..557 +x=520, y=1321..1331 +x=510, y=1408..1419 +x=522, y=911..930 +y=625, x=501..503 +x=566, y=862..872 +y=1361, x=559..562 +y=579, x=552..570 +x=507, y=157..167 +x=484, y=495..504 +y=854, x=563..565 +y=763, x=506..513 +y=1535, x=535..557 +x=580, y=775..781 +x=566, y=45..65 +x=544, y=1469..1482 +x=568, y=353..355 +y=1316, x=509..514 +x=581, y=1065..1078 +y=1782, x=524..526 +x=567, y=969..971 +y=1636, x=518..536 +x=491, y=1664..1667 +y=1019, x=567..577 +x=559, y=1346..1361 +x=579, y=566..574 +x=562, y=417..430 +y=1228, x=584..591 +x=574, y=1149..1153 +x=527, y=227..237 +x=486, y=390..405 +y=1437, x=527..529 +x=544, y=1390..1394 +y=207, x=560..581 +x=541, y=1540..1551 +x=497, y=1600..1604 +y=936, x=532..537 +y=343, x=543..547 +x=549, y=154..158 +x=524, y=1667..1677 +y=1760, x=496..503 +x=529, y=322..325 +x=543, y=70..82 +x=581, y=1760..1764 +x=497, y=1451..1456 +x=493, y=746..756 +x=533, y=1375..1377 +x=497, y=821..833 +x=544, y=827..847 +y=1143, x=521..544 +x=541, y=454..467 +y=197, x=544..552 +x=548, y=1674..1681 +y=1233, x=530..546 +x=549, y=899..908 +x=498, y=596..610 +x=514, y=597..610 +x=588, y=446..469 +x=557, y=206..224 +y=1705, x=564..572 +x=498, y=296..310 +x=541, y=1706..1715 +x=531, y=259..271 +x=564, y=1044..1052 +x=494, y=520..529 +y=1715, x=538..541 +x=485, y=695..697 +x=542, y=380..384 +x=557, y=864..875 +y=1368, x=502..505 +x=521, y=1131..1143 +y=912, x=564..589 +x=551, y=1174..1187 +y=1359, x=526..546 +y=1614, x=520..524 +x=498, y=1081..1084 +x=499, y=873..895 +y=328, x=515..538 +x=509, y=1113..1125 +y=104, x=543..563 +x=583, y=775..781 +x=540, y=486..490 +x=566, y=77..102 +x=553, y=479..489 +x=507, y=1583..1594 +y=322, x=564..570 +x=562, y=653..663 +x=518, y=1627..1636 +x=582, y=1618..1631 +x=581, y=736..748 +y=1052, x=564..581 +x=498, y=90..103 +y=706, x=554..572 +x=563, y=692..703 +x=542, y=29..54 +y=1870, x=502..504 +y=1852, x=550..571 +x=577, y=634..652 +x=573, y=1439..1444 +y=164, x=561..584 +x=564, y=1679..1705 +x=568, y=116..142 +y=99, x=506..509 +x=555, y=155..158 +x=521, y=52..55 +x=483, y=1569..1571 +x=508, y=414..419 +y=65, x=557..566 +y=1125, x=509..511 +y=489, x=553..570 +x=562, y=477..486 +x=486, y=1309..1333 +x=567, y=1016..1019 +x=550, y=827..847 +y=1742, x=543..560 +x=535, y=1050..1059 +y=1591, x=512..519 +x=532, y=1565..1568 +y=1718, x=533..549 +x=541, y=521..531 +x=541, y=713..725 +x=507, y=10..21 +y=765, x=554..578 +x=548, y=962..973 +x=582, y=1418..1423 +y=1848, x=556..559 +y=1742, x=510..528 +x=549, y=1751..1762 +x=543, y=334..343 +x=544, y=1131..1143 +x=489, y=361..374 +x=559, y=113..127 +y=436, x=538..546 +x=589, y=888..889 +x=560, y=1485..1494 +y=1414, x=518..521 +x=535, y=182..199 +y=467, x=541..543 +x=533, y=1003..1015 +x=565, y=735..745 +x=534, y=139..141 +x=550, y=634..643 +y=102, x=566..585 +x=567, y=1096..1116 +x=551, y=794..806 +x=529, y=1375..1377 +x=580, y=1448..1472 +x=519, y=1203..1216 +x=510, y=1734..1742 +x=510, y=1816..1834 +x=485, y=1169..1173 +x=559, y=278..301 +y=785, x=505..507 +x=585, y=1538..1540 +x=513, y=884..893 +x=522, y=256..264 +y=267, x=492..504 +y=663, x=539..562 +x=544, y=587..600 +x=525, y=1093..1102 +y=1477, x=484..488 +y=944, x=495..501 +x=526, y=984..987 +y=1498, x=510..516 +x=513, y=361..374 +x=589, y=1333..1343 +x=561, y=1925..1937 +x=498, y=67..69 +x=548, y=1611..1627 +y=1456, x=487..497 +x=506, y=654..666 +x=527, y=1435..1437 +x=512, y=1765..1771 +x=545, y=1643..1654 +x=533, y=1708..1718 +x=532, y=920..936 +x=512, y=1713..1726 +x=561, y=1820..1833 +x=512, y=154..164 +y=1102, x=500..508 +y=705, x=542..544 +x=524, y=202..212 +x=507, y=1378..1384 +x=530, y=1451..1464 +y=430, x=562..585 +x=543, y=155..167 +y=127, x=541..559 +y=1808, x=531..551 +y=1440, x=520..535 +x=567, y=1292..1302 +x=580, y=1168..1170 +x=558, y=1777..1783 +y=1674, x=531..536 +y=52, x=521..524 +x=522, y=1240..1252 +y=172, x=551..553 +x=562, y=880..893 +x=511, y=519..521 +x=577, y=1016..1019 +x=580, y=1862..1872 +y=1872, x=561..580 +x=553, y=1387..1397 +x=571, y=1448..1472 +x=515, y=154..164 +y=21, x=569..585 +x=551, y=496..509 +y=500, x=525..533 +y=721, x=546..548 +x=544, y=1562..1573 +x=518, y=1321..1331 +y=1653, x=512..526 +y=785, x=570..589 +x=488, y=1475..1477 +x=509, y=137..146 +y=1548, x=573..591 +x=495, y=937..944 +x=584, y=150..164 +x=498, y=389..405 +y=1288, x=531..533 +x=544, y=688..705 +y=1845, x=486..488 +x=566, y=1438..1444 +x=575, y=1233..1243 +x=551, y=1795..1808 +y=1262, x=574..576 +x=564, y=477..486 +x=556, y=846..859 +x=555, y=1070..1082 +x=551, y=1024..1042 +y=346, x=538..557 +x=578, y=9..14 +x=500, y=1150..1162 +y=1888, x=523..534 +x=551, y=1149..1159 +x=538, y=1390..1394 +x=552, y=1907..1917 +x=568, y=543..554 +y=1530, x=521..525 +y=1460, x=545..559 +y=269, x=548..573 +x=508, y=1095..1102 +x=559, y=1844..1848 +x=526, y=1645..1653 +x=530, y=279..289 +x=552, y=899..908 +y=405, x=511..547 +x=497, y=177..191 +x=582, y=1650..1673 +x=487, y=570..580 +y=271, x=514..531 +y=1604, x=497..503 +y=285, x=521..523 +y=1785, x=518..537 +x=566, y=176..178 +x=522, y=1047..1054 +x=580, y=1838..1849 +y=1595, x=549..559 +x=534, y=279..301 +x=563, y=608..622 +x=497, y=874..895 +x=560, y=1909..1912 +x=490, y=1227..1229 +x=500, y=495..504 +x=591, y=447..469 +y=521, x=508..511 +x=532, y=1096..1098 +y=703, x=563..565 +y=666, x=493..506 +x=533, y=1026..1039 +x=544, y=28..54 +x=528, y=1910..1922 +y=509, x=551..569 +y=930, x=520..522 +x=526, y=1346..1359 +x=565, y=1346..1374 +y=191, x=497..515 +x=512, y=1072..1094 +x=498, y=1168..1173 +x=552, y=1304..1314 +y=748, x=578..581 +x=506, y=453..459 +x=550, y=1840..1852 +y=1777, x=563..572 +x=556, y=964..975 +x=530, y=943..955 +y=1042, x=543..551 +x=558, y=902..911 +x=552, y=543..554 +x=580, y=580..585 +x=585, y=78..102 +y=889, x=579..589 +x=522, y=1506..1517 +y=580, x=487..502 +y=1820, x=579..587 +y=1271, x=539..558 +x=533, y=984..987 +y=1284, x=512..516 +x=504, y=1866..1870 +x=570, y=322..325 +x=591, y=1525..1548 +y=1162, x=544..562 +x=557, y=307..309 +x=589, y=37..57 +x=538, y=1343..1356 +y=829, x=505..508 +y=237, x=527..545 +x=569, y=497..509 +y=373, x=566..581 +x=569, y=1909..1912 +x=544, y=612..624 +y=1763, x=556..570 +y=1865, x=513..521 +y=299, x=515..517 +x=505, y=1157..1159 +x=537, y=156..167 +x=530, y=613..624 +y=1094, x=512..517 +y=987, x=526..533 +x=561, y=150..164 +y=469, x=588..591 +x=495, y=1764..1771 +y=771, x=536..549 +y=685, x=584..588 +x=483, y=189..206 +y=1026, x=559..584 +y=478, x=496..516 +x=513, y=1848..1865 +x=501, y=423..447 +x=560, y=1552..1568 +x=540, y=1686..1696 +x=560, y=1729..1742 +y=1288, x=483..485 +x=539, y=652..663 +x=546, y=1411..1414 +y=1352, x=573..577 +y=1380, x=518..539 +x=515, y=1227..1229 +y=1078, x=558..581 +x=483, y=1279..1288 +y=911, x=540..558 +y=1216, x=571..576 +x=523, y=674..681 +x=563, y=714..725 +y=1170, x=556..580 +x=558, y=1064..1078 +x=512, y=1816..1834 +x=483, y=13..32 +x=515, y=30..41 +x=591, y=1837..1849 +x=551, y=91..101 +y=823, x=558..582 +x=513, y=913..924 +y=1617, x=515..534 +x=548, y=1364..1374 +x=514, y=258..271 +y=195, x=527..529 +x=512, y=665..685 +x=570, y=1510..1512 +x=551, y=669..680 +x=538, y=960..968 +y=325, x=499..501 +x=592, y=1883..1895 +x=500, y=286..292 +x=575, y=606..616 +y=1937, x=542..561 +x=538, y=1507..1517 +y=1501, x=499..522 +y=1631, x=574..582 +x=576, y=1201..1216 +x=551, y=111..122 +y=103, x=498..517 +x=515, y=846..867 +x=528, y=339..349 +x=502, y=1910..1922 +x=577, y=1352..1360 +x=538, y=336..346 +y=1084, x=494..498 +x=493, y=1839..1862 +x=547, y=485..490 +x=536, y=760..771 +x=559, y=1007..1026 +x=538, y=1706..1715 +y=57, x=575..589 +y=32, x=483..488 +y=1302, x=567..576 +x=502, y=1361..1368 +x=524, y=1469..1482 +y=971, x=567..571 +x=585, y=6..21 +x=517, y=377..389 +y=419, x=483..508 +x=506, y=743..763 +y=908, x=549..552 +y=1268, x=545..547 +x=520, y=1611..1614 +x=545, y=1246..1253 +x=573, y=606..616 +y=1932, x=547..554 +x=565, y=1486..1494 +x=515, y=318..328 +y=1430, x=486..501 +x=492, y=1309..1333 +y=585, x=580..585 +x=585, y=579..585 +x=576, y=818..820 +x=571, y=1202..1216 +y=742, x=555..559 +x=547, y=334..343 +x=515, y=1025..1039 +x=556, y=494..505 +x=562, y=1029..1034 +y=329, x=557..580 +x=492, y=1793..1796 +x=543, y=1540..1551 +y=624, x=530..544 +x=538, y=426..436 +y=310, x=498..523 +x=520, y=743..760 +x=576, y=1906..1917 +x=553, y=111..122 +x=506, y=88..99 +x=551, y=1542..1555 +x=555, y=377..389 +y=505, x=556..561 +x=527, y=156..167 +x=505, y=397..408 +x=584, y=659..685 +y=813, x=502..527 +x=516, y=1270..1284 +y=55, x=521..524 +x=494, y=1081..1084 +y=504, x=484..500 +x=531, y=1528..1537 +x=574, y=1261..1262 +x=558, y=520..531 +x=532, y=1504..1514 +x=538, y=318..328 +x=508, y=984..993 +y=448, x=553..575 +y=680, x=546..551 +x=504, y=1027..1032 +x=561, y=1862..1872 +y=1243, x=563..575 +x=503, y=620..625 +x=591, y=1215..1228 +x=541, y=960..968 +x=572, y=1772..1777 +y=1673, x=582..590 +y=1771, x=495..512 +x=555, y=733..742 +x=534, y=1109..1123 +x=490, y=1815..1821 +x=583, y=117..142 +x=503, y=1886..1896 +x=588, y=942..955 +x=523, y=1870..1888 +x=529, y=665..685 +x=522, y=1173..1187 +x=527, y=139..141 +y=1159, x=505..520 +y=1009, x=485..493 +y=867, x=506..515 +y=1658, x=536..554 +x=577, y=236..252 +y=1762, x=528..549 +y=1356, x=536..538 +x=576, y=674..687 +y=1173, x=485..498 +x=547, y=400..405 +y=141, x=527..534 +x=552, y=565..579 +y=230, x=504..523 +x=548, y=1643..1654 +x=554, y=91..101 +y=349, x=504..528 +x=564, y=1397..1416 +x=543, y=1730..1742 +y=1360, x=573..577 +y=1149, x=570..574 +y=725, x=541..563 +x=515, y=299..305 +x=487, y=1452..1456 +x=485, y=48..62 +x=501, y=621..625 +x=583, y=722..723 +y=1793, x=510..517 +y=206, x=483..492 +x=546, y=1055..1061 +x=524, y=453..459 +y=1070, x=566..572 +y=380, x=532..542 +x=542, y=880..893 +y=1844, x=503..506 +x=569, y=6..21 +x=510, y=427..433 +x=539, y=1819..1833 +x=533, y=1151..1162 +x=505, y=1378..1384 +y=1153, x=570..574 +x=521, y=629..647 +x=509, y=1298..1316 +x=502, y=570..580 +y=433, x=510..512 +x=509, y=88..99 +x=516, y=118..122 +x=527, y=788..813 +y=984, x=526..533 +x=523, y=276..285 +x=514, y=1299..1316 +x=512, y=1270..1284 +y=1517, x=522..538 +x=584, y=1008..1026 +x=539, y=1369..1380 +y=616, x=573..575 +x=526, y=1305..1314 +y=1374, x=565..586 +y=1116, x=567..590 +y=588, x=512..527 +x=551, y=136..146 +y=1555, x=533..551 +x=499, y=321..325 +x=557, y=314..329 +x=512, y=1644..1653 +x=516, y=1049..1059 +x=543, y=454..467 +x=527, y=1504..1514 +y=459, x=506..524 +y=1551, x=541..543 +x=529, y=192..195 +x=538, y=1565..1568 +y=999, x=557..566 +x=581, y=1044..1052 +x=591, y=352..355 +x=561, y=236..252 +x=517, y=91..103 +x=503, y=1743..1760 +x=546, y=717..721 +x=546, y=736..745 +x=499, y=717..721 +x=573, y=1525..1548 +y=643, x=550..569 +y=1211, x=540..563 +x=578, y=1418..1423 +y=681, x=521..523 +x=518, y=1368..1380 +x=501, y=1424..1430 +y=639, x=512..514 +y=1389, x=495..513 +y=1229, x=490..515 +x=575, y=947..950 +x=537, y=230..233 +y=1917, x=552..576 +y=1696, x=536..540 +x=514, y=822..833 +x=588, y=846..858 +x=578, y=737..748 +x=494, y=118..122 +x=514, y=633..639 +y=1394, x=538..544 +x=507, y=285..292 +y=1673, x=483..498 +x=525, y=1530..1534 +x=565, y=19..23 +x=563, y=843..854 +x=575, y=831..840 +x=539, y=982..992 +x=491, y=520..529 +x=543, y=1023..1042 +y=1423, x=578..582 +y=1156, x=565..580 +y=1642, x=493..505 +x=519, y=1551..1567 +x=524, y=1777..1782 +y=893, x=542..562 +x=589, y=772..785 +x=534, y=884..893 +x=552, y=1612..1627 +y=1397, x=527..553 +x=508, y=520..521 +x=512, y=278..289 +x=573, y=818..820 +x=556, y=1750..1763 +x=576, y=1292..1302 +x=578, y=755..765 +y=975, x=556..581 +x=505, y=985..993 +x=552, y=205..224 +x=547, y=1257..1268 +x=506, y=847..867 +x=567, y=920..927 +y=931, x=552..573 +y=199, x=520..535 +x=492, y=190..206 +x=556, y=792..803 +x=546, y=1345..1359 +x=484, y=318..331 +y=1087, x=488..506 +y=470, x=533..553 +x=510, y=217..226 +x=517, y=299..305 +x=526, y=1323..1334 +y=1472, x=571..580 +x=573, y=262..269 +y=14, x=574..578 +y=858, x=580..588 +x=518, y=1406..1414 +y=8, x=535..557 +y=1377, x=529..533 +x=571, y=969..971 +x=585, y=1586..1611 +x=593, y=830..840 +x=510, y=1452..1464 +x=583, y=609..622 +x=525, y=1563..1573 +y=122, x=551..553 +x=533, y=1543..1555 +y=1783, x=556..558 +x=502, y=1547..1556 +y=187, x=569..579 +y=1274, x=562..568 +x=552, y=917..931 +x=563, y=1232..1243 +x=496, y=463..478 +y=1594, x=496..502 +x=566, y=1070..1074 +x=525, y=354..367 +y=178, x=563..566 +x=500, y=696..697 +x=501, y=321..325 +x=561, y=494..505 +y=712, x=490..509 +x=553, y=457..470 +x=565, y=947..950 +x=513, y=744..763 +x=508, y=1062..1069 +x=498, y=1657..1673 +y=1895, x=567..592 +x=566, y=992..999 +x=492, y=257..267 +x=491, y=1399..1406 +x=531, y=1794..1808 +x=528, y=1752..1762 +x=565, y=920..927 +y=1314, x=526..552 +x=486, y=1061..1069 +y=82, x=517..543 +x=500, y=1399..1406 +x=531, y=1326..1328 +x=527, y=586..588 +x=563, y=588..600 +x=490, y=706..712 +y=1494, x=560..565 +x=498, y=1794..1796 +y=384, x=532..542 +x=552, y=1637..1640 +x=495, y=745..756 +y=803, x=556..559 +x=577, y=1886..1892 +y=1162, x=500..533 +y=1334, x=510..526 +x=514, y=238..250 +x=548, y=263..269 +y=1054, x=522..529 +x=507, y=771..785 +x=579, y=183..187 +x=500, y=1508..1512 +y=1681, x=548..560 +y=1726, x=512..527 +y=968, x=538..541 +x=530, y=1244..1246 +x=530, y=1223..1233 +x=590, y=1649..1673 +x=570, y=1751..1763 +y=1571, x=483..496 +x=493, y=10..21 +x=562, y=1311..1322 +y=212, x=506..524 +x=582, y=1311..1322 +x=486, y=1832..1845 +x=505, y=1361..1368 +x=580, y=315..329 +x=512, y=427..433 +x=571, y=1841..1852 +x=587, y=1809..1820 +y=574, x=579..585 +x=543, y=1364..1374 +y=1322, x=562..582 +x=572, y=1886..1892 +y=859, x=556..573 +x=525, y=493..500 +x=564, y=862..872 +y=1082, x=535..555 +x=549, y=1068..1078 +y=158, x=549..555 +x=506, y=1077..1087 +x=554, y=754..765 +y=622, x=563..583 +x=579, y=1808..1820 +y=1611, x=566..585 +x=563, y=175..178 +x=496, y=1886..1896 +x=547, y=1688..1699 +x=500, y=1094..1102 +x=550, y=1411..1414 +x=488, y=1239..1260 +x=568, y=1265..1274 +x=572, y=1679..1705 +x=521, y=1406..1414 +x=536, y=1343..1356 +y=54, x=542..544 +x=559, y=1443..1460 +x=535, y=1430..1440 +x=547, y=1930..1932 +x=579, y=887..889 +x=586, y=1347..1374 +y=331, x=484..507 +x=512, y=633..639 +x=572, y=1070..1074 +x=515, y=1604..1617 +y=230, x=535..537 +x=522, y=1488..1501 +x=545, y=1442..1460 +x=488, y=1833..1845 +y=1627, x=548..552 +y=1216, x=519..524 +x=562, y=1151..1162 +x=557, y=45..65 +x=524, y=743..760 +y=1328, x=531..533 +x=524, y=256..264 +x=499, y=29..41 +y=846, x=526..540 +y=305, x=515..517 +y=374, x=489..513 +x=503, y=1835..1844 +y=146, x=509..551 +y=1821, x=490..505 +x=562, y=1264..1274 +x=545, y=18..23 +x=527, y=1409..1419 +x=517, y=70..82 +x=483, y=414..419 +x=484, y=1474..1477 +x=521, y=276..285 +x=531, y=1280..1288 +x=562, y=1345..1361 +y=993, x=505..508 +x=520, y=911..930 +y=685, x=512..529 +x=551, y=161..172 +x=540, y=820..846 +x=533, y=494..500 +x=563, y=1198..1211 +x=545, y=226..237 +y=713, x=515..521 +x=530, y=1096..1098 +y=1061, x=543..546 +x=520, y=717..721 +x=497, y=1703..1719 +x=505, y=1814..1821 +x=512, y=1580..1591 +x=575, y=438..448 +y=833, x=497..514 +y=1444, x=566..573 +y=1834, x=510..512 +x=515, y=1109..1123 +y=1374, x=543..548 +x=542, y=687..705 +y=1512, x=565..570 +x=534, y=15..25 +x=531, y=322..325 +x=488, y=12..32 +x=557, y=6..8 +x=535, y=5..8 +x=560, y=1674..1681 +y=893, x=513..534 +y=25, x=531..534 +x=536, y=1686..1696 +x=539, y=1259..1271 +y=647, x=502..521 +x=521, y=674..681 +x=549, y=1002..1015 +x=540, y=901..911 +y=1123, x=515..534 +x=539, y=1241..1252 +x=578, y=522..545 +x=581, y=198..207 +y=233, x=535..537 +x=510, y=1491..1498 +y=367, x=525..547 +x=570, y=480..489 +x=533, y=1280..1288 +x=580, y=1139..1156 +x=493, y=993..1009 +y=23, x=545..565 +y=1805, x=503..524 +x=590, y=1097..1116 +x=549, y=1709..1718 +x=501, y=938..944 +x=496, y=1570..1571 +x=521, y=1530..1534 +x=582, y=813..823 +x=496, y=1742..1760 +x=502, y=1027..1032 +x=570, y=795..806 +x=569, y=184..187 +y=955, x=530..588 +x=527, y=1388..1397 +y=1514, x=527..532 +x=528, y=1733..1742 +x=522, y=1023..1036 +y=1568, x=560..574 +y=1677, x=524..545 +y=820, x=573..576 +x=529, y=1435..1437 +x=504, y=257..267 +x=558, y=813..823 +x=589, y=898..912 +x=557, y=991..999 +x=502, y=630..647 +y=62, x=485..530 +x=495, y=1372..1389 +x=505, y=826..829 +x=502, y=1586..1594 +x=518, y=424..447 +y=1573, x=525..544 +x=555, y=1149..1159 +x=573, y=1352..1360 +x=511, y=1112..1125 +y=847, x=544..550 +y=122, x=494..516 +x=526, y=819..846 +x=524, y=1023..1036 +x=499, y=1487..1501 +x=530, y=49..62 +x=559, y=733..742 +x=559, y=792..803 +y=1764, x=579..581 +x=561, y=563..576 +x=493, y=1632..1642 +x=547, y=354..367 +y=531, x=541..558 +x=569, y=633..643 +x=505, y=772..785 +x=527, y=192..195 +y=289, x=512..530 +x=545, y=1257..1268 +x=486, y=1238..1260 +y=1074, x=566..572 +x=524, y=1791..1805 +x=580, y=845..858 +x=563, y=94..104 +y=652, x=577..582 +y=1862, x=493..500 +x=536, y=1646..1658 +x=502, y=789..813 +y=1886, x=572..577 +y=992, x=515..539 +y=610, x=498..514 +x=510, y=1793..1797 +y=486, x=562..564 +x=546, y=427..436 +x=554, y=694..706 +x=521, y=712..713 +x=504, y=340..349 +x=536, y=1626..1636 +x=572, y=695..706 +y=1464, x=510..530 +x=520, y=1157..1159 +y=1833, x=539..561 +x=534, y=1605..1617 +y=721, x=499..520 +y=1667, x=489..491 +x=570, y=566..579 +y=1482, x=524..544 +x=570, y=1149..1153 +y=325, x=564..570 +x=511, y=1509..1512 +x=523, y=219..230 +x=535, y=1071..1082 +x=515, y=711..713 +x=542, y=1092..1102 +x=489, y=1664..1667 +y=1797, x=510..517 +x=514, y=217..226 +x=554, y=1247..1253 +x=524, y=1624..1632 +y=1796, x=492..498 +y=1414, x=546..550 +x=532, y=380..384 +x=546, y=668..680 +y=1416, x=558..564 +x=573, y=845..859 +x=506, y=1834..1844 +y=1059, x=516..535 +x=575, y=1638..1640 +x=520, y=1283..1293 +y=840, x=575..593 +x=515, y=177..191 +x=485, y=994..1009 +x=556, y=1168..1170 +y=1343, x=577..589 +y=723, x=569..583 +x=543, y=1056..1061 +x=584, y=1214..1228 +x=545, y=1668..1677 +x=554, y=1930..1932 +x=581, y=965..975 +x=554, y=1645..1658 +x=529, y=1047..1054 +y=1293, x=520..539 +x=553, y=439..448 +y=1892, x=572..577 +y=309, x=557..569 +x=526, y=1777..1782 +x=508, y=1552..1567 +x=540, y=1199..1211 +x=537, y=1774..1785 +x=574, y=9..14 +x=534, y=1870..1888 +y=1419, x=510..527 +x=519, y=1580..1591 +y=1640, x=552..575 +x=569, y=307..309 +x=527, y=1714..1726 +y=1069, x=486..508 +x=521, y=1848..1865 +x=577, y=1332..1343 +x=516, y=462..478 +x=585, y=416..430 +y=1699, x=530..547 +x=566, y=1587..1611 +y=1034, x=562..569 +y=745, x=546..565 +y=1922, x=502..528 +y=1896, x=496..503 +x=565, y=692..703 +x=483, y=1657..1673 +y=389, x=517..555 +y=781, x=580..583 +x=530, y=1689..1699 +x=558, y=542..554 +x=518, y=1773..1785 +x=557, y=1522..1535 +y=405, x=486..498 +x=506, y=203..212 +x=505, y=1633..1642 +x=544, y=181..197 +x=541, y=114..127 +y=1406, x=491..500 +y=600, x=544..563 +x=556, y=1844..1848 +y=1102, x=525..542 +x=558, y=1260..1271 +y=292, x=500..507 +x=548, y=717..721 +y=1246, x=530..532 +y=139, x=527..534 +x=584, y=523..545 +x=517, y=1072..1094 +y=1244, x=530..532 +y=1534, x=521..525 +y=1594, x=507..525 +y=142, x=568..583 +x=515, y=981..992 +y=1512, x=500..511 +y=806, x=551..570 +x=558, y=563..576 +x=532, y=1244..1246 +y=872, x=564..566 +y=545, x=578..584 +x=510, y=1324..1334 +x=509, y=705..712 +x=533, y=1327..1328 +y=490, x=540..547 +y=875, x=557..575 +x=557, y=337..346 +y=1849, x=580..591 +y=927, x=565..567 +x=585, y=567..574 +x=494, y=1704..1719 +y=447, x=501..518 +x=485, y=1279..1288 +y=1253, x=545..554 +x=497, y=912..924 +y=554, x=526..552 +y=226, x=510..514 +y=950, x=565..575 +x=512, y=587..588 +y=1032, x=502..504 +y=1098, x=530..532 +x=569, y=1029..1034 +x=582, y=634..652 +y=1390, x=538..544 +x=549, y=1574..1595 +y=1540, x=578..585 +x=536, y=1670..1674 +x=535, y=1523..1535 +x=488, y=1077..1087 +x=581, y=361..373 +x=502, y=1867..1870 +x=503, y=1790..1805 +y=252, x=561..577 +x=524, y=52..55 +x=575, y=37..57 +x=565, y=1510..1512 +x=504, y=220..230 +y=1611, x=520..524 +x=546, y=1222..1233 +x=574, y=1617..1631 +x=500, y=1838..1862 +x=524, y=1611..1614 +x=526, y=542..554 +x=549, y=759..771 +y=321, x=499..501 +y=554, x=558..568 +y=250, x=483..514 +y=264, x=522..524 diff --git a/www/statics/aoc/2018/18-1.linq b/www/statics/aoc/2018/18-1.linq new file mode 100644 index 0000000..338520f --- /dev/null +++ b/www/statics/aoc/2018/18-1.linq @@ -0,0 +1,99 @@ + + +enum Field { Empty, Tree, Lumber } + +Dictionary mapping = new Dictionary +{ + {'.', Field.Empty}, + {'|', Field.Tree}, + {'#', Field.Lumber}, +}; + +int Width; +int Height; +Field[,] Map; + +void Main() +{ + Load(File.ReadAllLines(Path.Combine(Path.GetDirectoryName(Util.CurrentQueryPath), @"18_input.txt"))); + //$"Initial state:".Dump();Dump(); + + int i; + for (i = 0; i < 10; i++) + { + Tick(); + //$"After {i+1} minutes:".Dump();Dump(); + } + + $"After {i} ticks there are {FullCount(Field.Tree)} trees and {FullCount(Field.Lumber)} lumbers, the score is {FullCount(Field.Tree) * FullCount(Field.Lumber)}".Dump(); +} + +void Dump() +{ + StringBuilder b = new StringBuilder(); + for (int y = 0; y < Height; y++) + { + for (int x = 0; x < Width; x++) + { + if (Map[x, y] == Field.Empty) b.Append('.'); + else if (Map[x, y] == Field.Tree) b.Append('|'); + else if (Map[x, y] == Field.Lumber) b.Append('#'); + else throw new Exception("."); + } + b.AppendLine(); + } + b.ToString().Dump(); + "".Dump(); +} + +void Load(string[] input) +{ + Width = input[0].Length; + Height = input.Length; + Map = new Field[Width, Height]; + for (var x = 0; x < Width; x++) for (var y = 0; y < Height; y++) Map[x, y] = mapping[input[y][x]]; +} + +void Tick() +{ + var d = new Field[Width,Height]; + for (var y = 0; y < Height; y++) for (var x = 0; x < Width; x++) Tick(ref Map, ref d, x, y); + Map=d; +} + +void Tick(ref Field[,] src, ref Field[,] dst, int x, int y) +{ + if (src[x,y] == Field.Empty) + { + dst[x,y] = (Count(ref src, x, y, Field.Tree) >= 3) ? Field.Tree : Field.Empty; + } + else if (src[x, y] == Field.Tree) + { + dst[x, y] = (Count(ref src, x, y, Field.Lumber) >= 3) ? Field.Lumber : Field.Tree; + } + else if (src[x, y] == Field.Lumber) + { + dst[x, y] = (Count(ref src, x, y, Field.Lumber) >= 1 && Count(ref src, x, y, Field.Tree) >= 1) ? Field.Lumber : Field.Empty; + } +} + +int Count(ref Field[,] fld, int x, int y, Field s) +{ + int c = 0; + if (x > 0 && y > 0 && fld[x - 1, y - 1] == s) c++; + if (x > 0 && fld[x - 1, y ] == s) c++; + if (x > 0 && y < Height-1 && fld[x - 1, y + 1] == s) c++; + if ( y < Height-1 && fld[x , y + 1] == s) c++; + if (x < Width-1 && y < Height-1 && fld[x + 1, y + 1] == s) c++; + if (x < Width-1 && fld[x + 1, y ] == s) c++; + if (x < Width-1 && y > 0 && fld[x + 1, y - 1] == s) c++; + if ( y > 0 && fld[x , y - 1] == s) c++; + return c; +} + +int FullCount(Field f) +{ + int c = 0; + for (var x = 0; x < Width; x++) for (var y = 0; y < Height; y++) if (Map[x,y]==f)c++; + return c; +} \ No newline at end of file diff --git a/www/statics/aoc/2018/18-2.linq b/www/statics/aoc/2018/18-2.linq new file mode 100644 index 0000000..947eff5 --- /dev/null +++ b/www/statics/aoc/2018/18-2.linq @@ -0,0 +1,129 @@ + + +enum Field { Empty, Tree, Lumber } + +Dictionary mapping = new Dictionary +{ + {'.', Field.Empty}, + {'|', Field.Tree}, + {'#', Field.Lumber}, +}; + +int Width; +int Height; +Field[,] Map; + +void Main() +{ + Load(File.ReadAllLines(Path.Combine(Path.GetDirectoryName(Util.CurrentQueryPath), @"18_input.txt"))); + //$"Initial state:".Dump();Dump(); + + var history = new Dictionary(); + + int gen=0; + for (;;) + { + Tick(); + gen++; + + var hash = Hash(); + + if (history.ContainsKey(hash)) + { + int loop = gen-history[hash]; + + int remaining = 1000000000; + remaining -= gen; + + var off = remaining % loop; + + for (int i = 0; i < off; i++) { Tick(); gen++; } + + $"After {gen} ticks there are {FullCount(Field.Tree)} trees and {FullCount(Field.Lumber)} lumbers, the score is {FullCount(Field.Tree) * FullCount(Field.Lumber)} and the state loops every {loop} generations".Dump(); + + return; + } + else + { + history[hash] = gen; + } + } + +} + +string Hash() +{ + StringBuilder b = new StringBuilder(); + for (int y = 0; y < Height; y++) for (int x = 0; x < Width; x++) b.Append((char)('0'+(int)Map[x, y])); + return b.ToString(); +} + +void Dump() +{ + StringBuilder b = new StringBuilder(); + for (int y = 0; y < Height; y++) + { + for (int x = 0; x < Width; x++) + { + if (Map[x, y] == Field.Empty) b.Append('.'); + else if (Map[x, y] == Field.Tree) b.Append('|'); + else if (Map[x, y] == Field.Lumber) b.Append('#'); + else throw new Exception("."); + } + b.AppendLine(); + } + b.ToString().Dump(); + "".Dump(); +} + +void Load(string[] input) +{ + Width = input[0].Length; + Height = input.Length; + Map = new Field[Width, Height]; + for (var x = 0; x < Width; x++) for (var y = 0; y < Height; y++) Map[x, y] = mapping[input[y][x]]; +} + +void Tick() +{ + var d = new Field[Width,Height]; + for (var y = 0; y < Height; y++) for (var x = 0; x < Width; x++) Tick(ref Map, ref d, x, y); + Map=d; +} + +void Tick(ref Field[,] src, ref Field[,] dst, int x, int y) +{ + if (src[x,y] == Field.Empty) + { + dst[x,y] = (Count(ref src, x, y, Field.Tree) >= 3) ? Field.Tree : Field.Empty; + } + else if (src[x, y] == Field.Tree) + { + dst[x, y] = (Count(ref src, x, y, Field.Lumber) >= 3) ? Field.Lumber : Field.Tree; + } + else if (src[x, y] == Field.Lumber) + { + dst[x, y] = (Count(ref src, x, y, Field.Lumber) >= 1 && Count(ref src, x, y, Field.Tree) >= 1) ? Field.Lumber : Field.Empty; + } +} + +int Count(ref Field[,] fld, int x, int y, Field s) +{ + int c = 0; + if (x > 0 && y > 0 && fld[x - 1, y - 1] == s) c++; + if (x > 0 && fld[x - 1, y ] == s) c++; + if (x > 0 && y < Height-1 && fld[x - 1, y + 1] == s) c++; + if ( y < Height-1 && fld[x , y + 1] == s) c++; + if (x < Width-1 && y < Height-1 && fld[x + 1, y + 1] == s) c++; + if (x < Width-1 && fld[x + 1, y ] == s) c++; + if (x < Width-1 && y > 0 && fld[x + 1, y - 1] == s) c++; + if ( y > 0 && fld[x , y - 1] == s) c++; + return c; +} + +int FullCount(Field f) +{ + int c = 0; + for (var x = 0; x < Width; x++) for (var y = 0; y < Height; y++) if (Map[x,y]==f)c++; + return c; +} \ No newline at end of file diff --git a/www/statics/aoc/2018/18_challenge.txt b/www/statics/aoc/2018/18_challenge.txt new file mode 100644 index 0000000..5b2baad --- /dev/null +++ b/www/statics/aoc/2018/18_challenge.txt @@ -0,0 +1,161 @@ +--- 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). + +Strange magic is at work here: each minute, the landscape looks entirely different. In exactly one minute, an open acre can fill with trees, a wooded acre can be converted to a lumberyard, or a lumberyard can be cleared to open ground (the lumber having been sent to other projects). + +The change to each acre is based entirely on the contents of that acre as well as the number of open, wooded, or lumberyard acres adjacent to it at the start of each minute. Here, "adjacent" means any of the eight acres surrounding that acre. (Acres on the edges of the lumber collection area might have fewer than eight adjacent acres; the missing acres aren't counted.) + +In particular: + + An open acre will become filled with trees if three or more adjacent acres contained trees. Otherwise, nothing happens. + An acre filled with trees will become a lumberyard if three or more adjacent acres were lumberyards. Otherwise, nothing happens. + An acre containing a lumberyard will remain a lumberyard if it was adjacent to at least one other lumberyard and at least one acre containing trees. Otherwise, it becomes open. + +These changes happen across all acres simultaneously, each of them using the state of all acres at the beginning of the minute and changing to their new form by the end of that same minute. Changes that happen during the minute don't affect each other. + +For example, suppose the lumber collection area is instead only 10 by 10 acres with this initial configuration: + +Initial state: +.#.#...|#. +.....#|##| +.|..|...#. +..|#.....# +#.#|||#|#| +...#.||... +.|....|... +||...#|.#| +|.||||..|. +...#.|..|. + +After 1 minute: +.......##. +......|### +.|..|...#. +..|#||...# +..##||.|#| +...#||||.. +||...|||.. +|||||.||.| +|||||||||| +....||..|. + +After 2 minutes: +.......#.. +......|#.. +.|.|||.... +..##|||..# +..###|||#| +...#|||||. +|||||||||. +|||||||||| +|||||||||| +.||||||||| + +After 3 minutes: +.......#.. +....|||#.. +.|.||||... +..###|||.# +...##|||#| +.||##||||| +|||||||||| +|||||||||| +|||||||||| +|||||||||| + +After 4 minutes: +.....|.#.. +...||||#.. +.|.#||||.. +..###||||# +...###||#| +|||##||||| +|||||||||| +|||||||||| +|||||||||| +|||||||||| + +After 5 minutes: +....|||#.. +...||||#.. +.|.##||||. +..####|||# +.|.###||#| +|||###|||| +|||||||||| +|||||||||| +|||||||||| +|||||||||| + +After 6 minutes: +...||||#.. +...||||#.. +.|.###|||. +..#.##|||# +|||#.##|#| +|||###|||| +||||#||||| +|||||||||| +|||||||||| +|||||||||| + +After 7 minutes: +...||||#.. +..||#|##.. +.|.####||. +||#..##||# +||##.##|#| +|||####||| +|||###|||| +|||||||||| +|||||||||| +|||||||||| + +After 8 minutes: +..||||##.. +..|#####.. +|||#####|. +||#...##|# +||##..###| +||##.###|| +|||####||| +||||#||||| +|||||||||| +|||||||||| + +After 9 minutes: +..||###... +.||#####.. +||##...##. +||#....### +|##....##| +||##..###| +||######|| +|||###|||| +|||||||||| +|||||||||| + +After 10 minutes: +.||##..... +||###..... +||##...... +|##.....## +|##.....## +|##....##| +||##.####| +||#####||| +||||#||||| +|||||||||| + +After 10 minutes, there are 37 wooded acres and 31 lumberyards. Multiplying the number of wooded acres by the number of lumberyards gives the total resource value after ten minutes: 37 * 31 = 1147. + +What will the total resource value of the lumber collection area be after 10 minutes? + +--- Part Two --- + +This important natural resource will need to last for at least thousands of years. Are the Elves collecting this lumber sustainably? + +What will the total resource value of the lumber collection area be after 1000000000 minutes? diff --git a/www/statics/aoc/2018/18_input.txt b/www/statics/aoc/2018/18_input.txt new file mode 100644 index 0000000..b20da78 --- /dev/null +++ b/www/statics/aoc/2018/18_input.txt @@ -0,0 +1,50 @@ +.|||.#..|##.#||..#.|..|..||||..#|##.##..#...|..... +.|#.|#..##...|#.........#.#..#..|#.|#|##..#.#|..#. +#....#|.#|.###||..#.|...|.|.#........#.|.#.#|..#.. +|..|#....|#|...#.#..||.#..||......#.........|....| +.|.|..#|...#.|.###.|...||.|.|..|...|#|.#..|.|..|.| +#.....||.#..|..|..||#.||#..|.||..||##.......#..... +||.#..........|....##...|..#.|..#..#|#.#....#..#.# +.#.#|.|.|.##|..#......|...#||..#.||..|..|#....|##. +#.#..||.|...#|...|..#.#.||#.||.#.|.....|##.|....#. +.#......||.|#......#|#.|...||...||##...#...####.#. +.....#..|..#..#|..#...#.|#...||...#.##.||.|..|.||. +.#|.#.|.....|#..#||..|...|...##.#.###|..|.###.|#.. +..#.......#.|#.##....#..|##.#......#|......#..#... +.|..#|.#.....#..||..#.#.|##..|#.||#..|.#..|.|##|#| +##|.#........|#.#.#|..|....|.......#..#|.#.|....#. +....##...|....#..............||.|..#........|..... +##||.|.#...|.#|..#....#..|...|..#..#..|##||.....|. +.|.#...|#.......#...#.#..|#....#|#|#..#|...##..||. +.|..|.|..#...##...||#..##|#|..|...#.....#||...##.. +.|...|..||#..#|.|.#...|||.|#.||#|......|#|.#..|#.. +|##.....|.|#...#||.....#..#.|.#..|.....||....||..# +|.|#|||.....|||..#......#..||........||.#.#..||#|| +#.|.|.#.....#....#.#..#||.||..|.#.|....|...#.#...# +|.|....#.#||...#.....#|#|.|.#......##.|.||...#.||. +|...|...|##........|.|...#...|.........|..##..|.## +|.||..|.#.#|.#||...|.|.....#...#.####|.||||..|||.| +.....#..##..|..#|.||#...|..##...##|....##||.##.... +#|##..#|.#..|##...|..#.##.|##.....###.|..#.|..#.|. +|.##..|#...|.|.||.......#..#||.....#|..#||##..#|.. +..|.#.#.....##.|#|...#........##......#...#...||.. +|.#....###|..|##.#...#|....|..#.....#.##.|..|...|| +.....#..#.....|.##......#......|..|...##|.|.#..#|| +...##.#.......#|.#..||.#|..#|...#...|||.#.......|# +#|..#|....|||...|..#|....#......#..#...|#.......|| +...#|##|..........|..###||..#|...|.##.|.#.#...#... +#|##|.#|#...|..#......||..#.|#|..#..|..#|..#...... +#||#.#.....|...|..|##|..#|...##.||..#|.|#||.|..|.. +#..#..|.|.||...#|.|.|..|..|..|....#.#||.#.....|#.# +#.|.#..##...|..#.|..#..#..#.#||.#.............#... +..|##|.#|.|......|#...|#.#.....|#|#.#.|...|#...... +.|.|.|...#..##..#|###..|#....#..#.#..|||.###|##... +|#...|......|...##..|.|#...#..|.#.........#..##.#. +.|...##||#.....#..#..|..#..#.|#.|.||.##.|....|..#| +|#..|..|.#..||...#...#|..##|||##..|.##||#.#.|....| +.......#......|.....||.#..|#.#.#|#.##....|...|.#.. +.....#..|...|..##.....|...#...|.|||.##..|.#||.##|. +..#||...|#.#|#|....#..|||.|##..#|.|.........|....# +..#...|.#...|#..#........#...###..##..##||...|..#. +..|.||.#.....|#..|.##...#.|...|#...#||..####..#.|. +.|.....#....||.#...#.......#|........#...#|#|...|# diff --git a/www/statics/aoc/2018/19-1.linq b/www/statics/aoc/2018/19-1.linq new file mode 100644 index 0000000..9eef2aa --- /dev/null +++ b/www/statics/aoc/2018/19-1.linq @@ -0,0 +1,55 @@ + + +class Command { public String Name; public (string, Action) Op; public int[] Args; public int Dst => Args[2]; public int Arg1 => Args[0]; public int Arg2 => Args[1]; } + +(string, Action)[] Operations = new(string, Action)[] +{ + ("addr", (reg, cmd) => { reg[cmd.Dst] = reg[cmd.Arg1] + reg[cmd.Arg2]; } ), + ("addi", (reg, cmd) => { reg[cmd.Dst] = reg[cmd.Arg1] + cmd.Arg2; } ), + ("mulr", (reg, cmd) => { reg[cmd.Dst] = reg[cmd.Arg1] * reg[cmd.Arg2]; } ), + ("muli", (reg, cmd) => { reg[cmd.Dst] = reg[cmd.Arg1] * cmd.Arg2; } ), + ("banr", (reg, cmd) => { reg[cmd.Dst] = reg[cmd.Arg1] & reg[cmd.Arg2]; } ), + ("bani", (reg, cmd) => { reg[cmd.Dst] = reg[cmd.Arg1] & cmd.Arg2; } ), + ("borr", (reg, cmd) => { reg[cmd.Dst] = reg[cmd.Arg1] | reg[cmd.Arg2]; } ), + ("bori", (reg, cmd) => { reg[cmd.Dst] = reg[cmd.Arg1] | cmd.Arg2; } ), + ("setr", (reg, cmd) => { reg[cmd.Dst] = reg[cmd.Arg1]; } ), + ("seti", (reg, cmd) => { reg[cmd.Dst] = cmd.Arg1; } ), + ("gtir", (reg, cmd) => { reg[cmd.Dst] = cmd.Arg1 > reg[cmd.Arg2] ? 1:0; } ), + ("gtri", (reg, cmd) => { reg[cmd.Dst] = reg[cmd.Arg1] > cmd.Arg2 ? 1:0; } ), + ("gtrr", (reg, cmd) => { reg[cmd.Dst] = reg[cmd.Arg1] > reg[cmd.Arg2] ? 1:0; } ), + ("eqir", (reg, cmd) => { reg[cmd.Dst] = cmd.Arg1 == reg[cmd.Arg2] ? 1:0; } ), + ("eqri", (reg, cmd) => { reg[cmd.Dst] = reg[cmd.Arg1] == cmd.Arg2 ? 1:0; } ), + ("eqrr", (reg, cmd) => { reg[cmd.Dst] = reg[cmd.Arg1] == reg[cmd.Arg2] ? 1:0; } ), +}; + +void Main() +{ + (var commands, var ipidx) = Load(File.ReadAllLines(Path.Combine(Path.GetDirectoryName(Util.CurrentQueryPath), @"19_input.txt"))); + + int[] data = new int[255]; + for (int gen=0;;gen++) + { + if (data[ipidx]<0 || data[ipidx]>=commands.Count) break; + + var cmd = commands[data[ipidx]]; + + cmd.Op.Item2(data, cmd); + //string.Join(" ", data.Take(6)).Dump(); + data[ipidx]++; + } + + data[0].Dump(); +} + +(List, int) Load(string[] input) +{ + return + ( + input + .Skip(1) + .Where(i => !string.IsNullOrWhiteSpace(i)) + .Select(i => new Command { Name = i.Split(' ')[0], Op=Operations.Single(o => o.Item1.ToLower() == i.Split(' ')[0].ToLower()), Args = i.Split(' ').Skip(1).Select(int.Parse).ToArray() }) + .ToList(), + int.Parse(input[0].Split(' ')[1]) + ); +} diff --git a/www/statics/aoc/2018/19-2.linq b/www/statics/aoc/2018/19-2.linq new file mode 100644 index 0000000..6eaf3dc --- /dev/null +++ b/www/statics/aoc/2018/19-2.linq @@ -0,0 +1,149 @@ + + +void Main() +{ + var b = 10551358; + var a = 0; + for (int i = 1; i <= b; i++) if (b % i == 0)a+=i; + a.Dump(); +} + +/* + [1-ORIGINAL] [2-SYNTAX] [3-RESOLVE] [4-SIMPLIFY] + +#ip 1 +00: addi 1 16 1 [1]=[1]+16 JMP 17 JMP 17 +01: seti 1 5 5 [5]=1 1: E := 1 +02: seti 1 2 3 [3]=1 2: C := 1 +03: mulr 5 3 2 [2]=[3]*[5] 3: B := C*E +04: eqrr 2 4 2 [2]=([2]==[4]) if (B = D) A += E +05: addr 2 1 1 [1]=[2]+[1] JMP 6+[2] +06: addi 1 1 1 [1]++ JMP 8 +07: addr 5 0 0 [0]=[5]+[0] +08: addi 3 1 3 [3]++ C++ +09: gtrr 3 4 2 [2]=([3]>[4]) if (C<=D) JUMP 3 +10: addr 1 2 1 [1]=[1]+[2] JMP 11+[2] +11: seti 2 6 1 [1]=2 JMP 3 +12: addi 5 1 5 [5]++ E++ +13: gtrr 5 4 2 [2]=([5]>[4]) if (E<=D) JUMP 2 else EXIT +14: addr 2 1 1 [1]=[1]+[2] JMP 15+[2] +15: seti 1 8 1 [1]=1 JMP 2 +16: mulr 1 1 1 [1]=[1]*[1] EXIT +17: addi 4 2 4 [4]+=2 17: D+=2 | +18: mulr 4 4 4 [4]=[4]*[4] D=D*D | +19: mulr 1 4 4 [4]=[4]*[1] [4]=[4]*19 D*=19 | +20: muli 4 11 4 [4]=[4]*[1] [4]=[4]*11 D*=11 | +21: addi 2 5 2 [2]=[2]+5 B+=5 | +22: mulr 2 1 2 [2]=[2]*[1] [2]=[2]*22 B*=22 | +23: addi 2 12 2 [2]=[2]+12 B+=12 |B := 122 +24: addr 4 2 4 [4]=[4]+[2] D+=B |D := 958 +25: addr 1 0 1 [1]=[1]+[0] JMP 26+[0] if (A = 0) JUMP 1 +26: seti 0 4 1 [1]=0 JMP 1 +27: setr 1 4 2 [2]=[1] [2]=[4]+27 B=27 | +28: mulr 2 1 2 [2]=[2]*[1] [2]=[2]*28 B=B*28 | +29: addr 1 2 2 [2]=[2]+[1] [2]=[2]+29 B=B+29 | +30: mulr 1 2 2 [2]=[2]*[1] [2]=[2]*30 B=B*30 | +31: muli 2 14 2 [2]=[2]*14 B=B*14 | +32: mulr 2 1 2 [2]=[2]*[1] [2]=[2]*32 B=B*32 |B := 10550400 +33: addr 4 2 4 [4]=[2]+[4] D=B+D |D := 10551358 +34: seti 0 3 0 [0]=0 A=0 +35: seti 0 7 1 [1]=0 JMP 1 JUMP 1 + + + + +[5-SHRINK] + + JMP 17 + 1: E := 1 + 2: C := 1 + 3: B := C*E + if (B = D) A += E + C++ + if (C<=D) JUMP 3 + E++ + if (E<=D) JUMP 2 else EXIT +17: B = 122 + D = 958 + if (A = 0) JUMP 1 + B = 10550400 + D = 10551358 + A=0 + JUMP 1 + + + + +[6-REORDER] + +if (A=0) + B = 122; D = 958 +else + B = 10550400; D = 10551358; + +A = 0 + + E=1 +S1: C=1 +S2: B=C*E + if (B = D) A += E + C++ + if (C<=D) JUMP S2 + E++ + if (E<=D) + JUMP S1 + else + EXIT + + + + +[7-LANGUAGE] + +if (A=0) B = 122; D = 958; +else B = 10550400; D = 10551358; + +A = 0 +E = 1 + +do +{ + C=1 + do + { + B=C*E + if (B == D) A += E + C++ + } + while (C <= D) + E++ +} +while (E <= D) + + + + +[8-SUGAR] + +if (A=0) B = 122; D = 958; +else B = 10550400; D = 10551358; + +A = 0 +E = 1 + +for(E=1; E<=D; E++) +{ + for(C=1; C<=D; C++) + { + if (C*E == D) A += E + } +} + + + + +[9-EXPLANATION] + +THE SUM OF ALL FACTORS OF 10551358 + +*/ diff --git a/www/statics/aoc/2018/19_challenge.txt b/www/statics/aoc/2018/19_challenge.txt new file mode 100644 index 0000000..d365fc3 --- /dev/null +++ b/www/statics/aoc/2018/19_challenge.txt @@ -0,0 +1,51 @@ +--- 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 don't contain any flow control like jump instructions. The device's manual goes on to explain: + +"In programs where flow control is required, the instruction pointer can be bound to a register so that it can be manipulated directly. This way, setr/seti can function as absolute jumps, addr/addi can function as relative jumps, and other opcodes can cause truly fascinating effects." + +This mechanism is achieved through a declaration like #ip 1, which would modify register 1 so that accesses to it let the program indirectly access the instruction pointer itself. To compensate for this kind of binding, there are now six registers (numbered 0 through 5); the five not bound to the instruction pointer behave as normal. Otherwise, the same rules apply as the last time you worked with this device. + +When the instruction pointer is bound to a register, its value is written to that register just before each instruction is executed, and the value of that register is written back to the instruction pointer immediately after each instruction finishes execution. Afterward, move to the next instruction by adding one to the instruction pointer, even if the value in the instruction pointer was just updated by an instruction. (Because of this, instructions must effectively set the instruction pointer to the instruction before the one they want executed next.) + +The instruction pointer is 0 during the first instruction, 1 during the second, and so on. If the instruction pointer ever causes the device to attempt to load an instruction outside the instructions defined in the program, the program instead immediately halts. The instruction pointer starts at 0. + +It turns out that this new information is already proving useful: the CPU in the device is not very powerful, and a background process is occupying most of its time. You dump the background process' declarations and instructions to a file (your puzzle input), making sure to use the names of the opcodes rather than the numbers. + +For example, suppose you have the following program: + +#ip 0 +seti 5 0 1 +seti 6 0 2 +addi 0 1 0 +addr 1 2 3 +setr 1 0 0 +seti 8 0 4 +seti 9 0 5 + +When executed, the following instructions are executed. Each line contains the value of the instruction pointer at the time the instruction started, the values of the six registers before executing the instructions (in square brackets), the instruction itself, and the values of the six registers after executing the instruction (also in square brackets). + +ip=0 [0, 0, 0, 0, 0, 0] seti 5 0 1 [0, 5, 0, 0, 0, 0] +ip=1 [1, 5, 0, 0, 0, 0] seti 6 0 2 [1, 5, 6, 0, 0, 0] +ip=2 [2, 5, 6, 0, 0, 0] addi 0 1 0 [3, 5, 6, 0, 0, 0] +ip=4 [4, 5, 6, 0, 0, 0] setr 1 0 0 [5, 5, 6, 0, 0, 0] +ip=6 [6, 5, 6, 0, 0, 0] seti 9 0 5 [6, 5, 6, 0, 0, 9] + +In detail, when running this program, the following events occur: + + The first line (#ip 0) indicates that the instruction pointer should be bound to register 0 in this program. This is not an instruction, and so the value of the instruction pointer does not change during the processing of this line. + The instruction pointer contains 0, and so the first instruction is executed (seti 5 0 1). It updates register 0 to the current instruction pointer value (0), sets register 1 to 5, sets the instruction pointer to the value of register 0 (which has no effect, as the instruction did not modify register 0), and then adds one to the instruction pointer. + The instruction pointer contains 1, and so the second instruction, seti 6 0 2, is executed. This is very similar to the instruction before it: 6 is stored in register 2, and the instruction pointer is left with the value 2. + The instruction pointer is 2, which points at the instruction addi 0 1 0. This is like a relative jump: the value of the instruction pointer, 2, is loaded into register 0. Then, addi finds the result of adding the value in register 0 and the value 1, storing the result, 3, back in register 0. Register 0 is then copied back to the instruction pointer, which will cause it to end up 1 larger than it would have otherwise and skip the next instruction (addr 1 2 3) entirely. Finally, 1 is added to the instruction pointer. + The instruction pointer is 4, so the instruction setr 1 0 0 is run. This is like an absolute jump: it copies the value contained in register 1, 5, into register 0, which causes it to end up in the instruction pointer. The instruction pointer is then incremented, leaving it at 6. + The instruction pointer is 6, so the instruction seti 9 0 5 stores 9 into register 5. The instruction pointer is incremented, causing it to point outside the program, and so the program ends. + +What value is left in register 0 when the background process halts? + +--- Part Two --- + +A new background process immediately spins up in its place. It appears identical, but on closer inspection, you notice that this time, register 0 started with the value 1. + +What value is left in register 0 when this new background process halts? diff --git a/www/statics/aoc/2018/19_input.txt b/www/statics/aoc/2018/19_input.txt new file mode 100644 index 0000000..70d6e00 --- /dev/null +++ b/www/statics/aoc/2018/19_input.txt @@ -0,0 +1,37 @@ +#ip 1 +addi 1 16 1 +seti 1 5 5 +seti 1 2 3 +mulr 5 3 2 +eqrr 2 4 2 +addr 2 1 1 +addi 1 1 1 +addr 5 0 0 +addi 3 1 3 +gtrr 3 4 2 +addr 1 2 1 +seti 2 6 1 +addi 5 1 5 +gtrr 5 4 2 +addr 2 1 1 +seti 1 8 1 +mulr 1 1 1 +addi 4 2 4 +mulr 4 4 4 +mulr 1 4 4 +muli 4 11 4 +addi 2 5 2 +mulr 2 1 2 +addi 2 12 2 +addr 4 2 4 +addr 1 0 1 +seti 0 4 1 +setr 1 4 2 +mulr 2 1 2 +addr 1 2 2 +mulr 1 2 2 +muli 2 14 2 +mulr 2 1 2 +addr 4 2 4 +seti 0 3 0 +seti 0 7 1 diff --git a/www/statics/aoc/2018/20-1.linq b/www/statics/aoc/2018/20-1.linq new file mode 100644 index 0000000..129e03a --- /dev/null +++ b/www/statics/aoc/2018/20-1.linq @@ -0,0 +1,268 @@ + + System.Drawing + + +class Step { public int X,Y; public char Dir; public int P; public List NextSteps = new List(); } + +int StartX; +int StartY; +int Width; +int Height; +bool[,] Doors; +bool[,] Reachable; +int?[,] Distance; +Step RootStep; + +void Main() +{ + Load(File.ReadAllText(Path.Combine(Path.GetDirectoryName(Util.CurrentQueryPath), @"20_input.txt")).Trim()); + //DumpSteps(); + //int c=0; VerifySteps(RootStep, ref c);c.Dump(); + Walk(); + Flood().Dump(); + DumpMap(); +} + +void VerifySteps(Step s, ref int c) +{ + for(;;) + { + c++; + if (s.NextSteps.Any(ns => ns.P>=s.P)) throw new Exception(); + if (s.NextSteps.Count == 1) { s = s.NextSteps.Single(); continue; } + + foreach (var ns in s.NextSteps) VerifySteps(ns, ref c); + return; + } +} + +void DumpSteps() +{ + StringBuilder b = new StringBuilder(); + DumpSteps(RootStep, ref b, 0); +} + +void DumpSteps(Step s, ref StringBuilder b, int w) +{ + int sscc = 0; + for (; ; ) + { + if (s.NextSteps.Count == 0) { b.Append(sscc.ToString()); w += sscc.ToString().Length; break; } + if (s.NextSteps.Count == 1) { sscc++; s = s.NextSteps.Single(); continue; } + + {b.Append(sscc.ToString()); w += sscc.ToString().Length;} + int l = w; + foreach (var ns in s.NextSteps) + { + b.ToString().Dump();b.Clear(); + b.Append(new string(' ', l)); + DumpSteps(ns, ref b, w); + } + return; + } +} + +void Load(string d) +{ + d = d.Substring(1, d.Length - 2); + + StartX = d.Count(c => c == 'W') + 16; + StartY = d.Count(c => c == 'N') + 16; + Width = d.Count(c => c == 'E') + 16 + StartX; + Height = d.Count(c => c == 'S') + 16 + StartY; + Doors = new bool[Width * 2 + 16, Height + 16]; + Distance = new int?[Width, Height]; + Reachable = new bool[Width, Height]; + + RootStep = Parse(d); +} + +Step Parse(string d) +{ + Step r = null; + Parse(new List(), ref d, ref r); + if (d!="")throw new Exception(); + return r; +} + +List Parse(List source, ref string d, ref Step root) +{ + List lasts = source; + for (; ; ) + { + if (d == "") return lasts; + if (d[0] == '|') return lasts; + if (d[0] == ')') return lasts; + if (d[0] == '(') + { + d = d.Substring(1); + List newlasts = new List(); + for (;;) + { + if (d[0] == ')') { d = d.Substring(1); newlasts.AddRange(lasts); break; } + + var n = Parse(lasts, ref d, ref root); + newlasts.AddRange(n); + + if (d[0] == '|') { d = d.Substring(1); continue; } + if (d[0] == ')') { d = d.Substring(1); break; } + + throw new Exception(); + } + lasts = newlasts; + continue; + } + + if (d[0] == 'N') { var s = new Step { X = 00, Y = -1, Dir=d[0], P=d.Length, }; lasts.ForEach(l => l.NextSteps.Add(s)); lasts = new List {s}; d = d.Substring(1); root = root ?? s; continue; } + if (d[0] == 'E') { var s = new Step { X = +1, Y = 00, Dir=d[0], P=d.Length, }; lasts.ForEach(l => l.NextSteps.Add(s)); lasts = new List {s}; d = d.Substring(1); root = root ?? s; continue; } + if (d[0] == 'S') { var s = new Step { X = 00, Y = +1, Dir=d[0], P=d.Length, }; lasts.ForEach(l => l.NextSteps.Add(s)); lasts = new List {s}; d = d.Substring(1); root = root ?? s; continue; } + if (d[0] == 'W') { var s = new Step { X = -1, Y = 00, Dir=d[0], P=d.Length, }; lasts.ForEach(l => l.NextSteps.Add(s)); lasts = new List {s}; d = d.Substring(1); root = root ?? s; continue; } + + throw new Exception(); + } +} + +void Walk() +{ + Stack<(int x,int y, Step s)> work = new Stack<(int x, int y, Step s)>(); + work.Push((StartX, StartY, RootStep)); + + while(work.Any()) + { + (var x, var y, var step) = work.Pop(); + Reachable[x,y]=true; + + if (step.Dir == 'N') Doors[x*2, y] = true; + if (step.Dir == 'E') Doors[x*2+1,y] = true; + if (step.Dir == 'S') Doors[x*2,y+1] = true; + if (step.Dir == 'W') Doors[x*2-1,y] = true; + + x += step.X; + y += step.Y; + foreach (var ns in step.NextSteps) work.Push((x,y,ns)); + //DumpMap(); + } + +} + +int Flood() +{ + Stack<(int x, int y)> work = new Stack<(int x, int y)>(); + work.Push((StartX, StartY)); + Distance[StartX, StartY]=0; + + while (work.Any()) + { + (var x, var y) = work.Pop(); + + if (Doors[x * 2, y ] && (Distance[x+0,y-1] == null || Distance[x+0,y-1].Value > Distance[x,y]+1)) { Distance[x+0,y-1] = Distance[x,y]+1; work.Push((x+0,y-1)); } + if (Doors[x * 2 + 1, y ] && (Distance[x+1,y+0] == null || Distance[x+1,y+0].Value > Distance[x,y]+1)) { Distance[x+1,y+0] = Distance[x,y]+1; work.Push((x+1,y+0)); } + if (Doors[x * 2, y + 1] && (Distance[x+0,y+1] == null || Distance[x+0,y+1].Value > Distance[x,y]+1)) { Distance[x+0,y+1] = Distance[x,y]+1; work.Push((x+0,y+1)); } + if (Doors[x * 2 - 1, y ] && (Distance[x-1,y+0] == null || Distance[x-1,y+0].Value > Distance[x,y]+1)) { Distance[x-1,y+0] = Distance[x,y]+1; work.Push((x-1,y+0)); } + } + + int max = int.MinValue; + for (int xx = 0; xx < Width; xx++) for (int yy = 0; yy < Height; yy++) max = Math.Max(Distance[xx,yy] ?? max, max); + return max; +} + +void DumpMap() +{ + var ww = Width * 2 + 1; + var hh = Height * 2 + 1; + char[,] m = new char[Width * 2 + 1, Height * 2 + 1]; + + int _sx = 0; + int _ex = 0; + int _sy = 0; + int _ey = 0; + for (int xx = 0; ; xx++) + { + var ff = false; + for (int yy = 0; yy < Height; yy++) if (Reachable[xx, yy]) ff = true; + if (ff) { _sx = xx; break; } + } + for (int xx = Width - 1; ; xx--) + { + var ff = false; + for (int yy = 0; yy < Height; yy++) if (Reachable[xx, yy]) ff = true; + if (ff) { _ex = xx; break; } + } + for (int yy = 0; ; yy++) + { + var ff = false; + for (int xx = 0; xx < Width; xx++) if (Reachable[xx, yy]) ff = true; + if (ff) { _sy = yy; break; } + } + for (int yy = Height - 1; ; yy--) + { + var ff = false; + for (int xx = 0; xx < Width; xx++) if (Reachable[xx, yy]) ff = true; + if (ff) { _ey = yy; break; } + } + + var sy = _sy * 2 + 1 - 1; + var sx = _sx * 2 + 1 - 1; + var ey = _ey * 2 + 1 + 2; + var ex = _ex * 2 + 1 + 2; + + + for (int xx = sx; xx <= ex; xx++) for (int yy = sy; yy <= ey; yy++) m[xx, yy] = '?'; + + for (int xx = sx; xx <= ex; xx += 2) for (int yy = sy; yy <= ey; yy++) m[xx, yy] = '#'; + for (int yy = sy; yy <= ey; yy += 2) for (int xx = sx; xx <= ex; xx++) m[xx, yy] = '#'; + + for (int ix = _sx; ix <= _ex; ix++) + { + for (int iy = _sy; iy <= _ey; iy++) + { + if (Doors[ix * 2, iy ]) { m[ix*2+1, iy*2+1-1]='-'; } + if (Doors[ix * 2 + 1, iy ]) { m[ix*2+1+1, iy*2+1]='|'; } + if (Doors[ix * 2, iy + 1]) { m[ix*2+1, iy*2+1+1]='-'; } + if (Doors[ix * 2 - 1, iy ]) { m[ix*2+1-1, iy*2+1]='|'; } + + if (Distance[ix,iy]!= null) { m[ix*2+1, iy*2+1]='.'; } + } + } + + + m[StartX * 2 + 1, StartY * 2 + 1] = 'X'; + + int f = 6; + Bitmap bmp = new Bitmap(((ex-sx)+(ex-sx)/2) * f, ((ey-sy)+(ey-sy)/2) * f, System.Drawing.Imaging.PixelFormat.Format24bppRgb); + using (Graphics g = Graphics.FromImage(bmp)) + { + g.Clear(Color.Magenta); + for (int yy = sy; yy < ey; yy++) + { + for (int xx = sx; xx < ex; xx++) + { + int rx = (xx - sx) + (xx - sx) / 2; + int ry = (yy - sy) + (yy - sy) / 2; + int rw = ((xx - sx) % 2) + 1; + int rh = ((yy - sy) % 2) + 1; + + var c = Brushes.Magenta; + if (m[xx, yy] == '#') c = Brushes.Black; + if (m[xx, yy] == 'X') c = Brushes.Green; + if (m[xx, yy] == '.') c = Brushes.White; + if (m[xx, yy] == '?') c = Brushes.DarkGray; + if (m[xx, yy] == '|') c = Brushes.LightGray; + if (m[xx, yy] == '-') c = Brushes.LightGray; + g.FillRectangle(c, rx*f, ry*f, rw*f, rh*f); + } + } + } + bmp.Dump(); + + //StringBuilder b = new StringBuilder(); + //for (int yy = 0; yy < hh; yy++) + //{ + // for (int xx = 0; xx < ww; xx++) + // { + // b.Append(m[xx,yy]); + // } + // b.AppendLine(); + //} + //b.ToString().Dump(); +} \ No newline at end of file diff --git a/www/statics/aoc/2018/20-2.linq b/www/statics/aoc/2018/20-2.linq new file mode 100644 index 0000000..54914fd --- /dev/null +++ b/www/statics/aoc/2018/20-2.linq @@ -0,0 +1,268 @@ + + System.Drawing + + +class Step { public int X,Y; public char Dir; public int P; public List NextSteps = new List(); } + +int StartX; +int StartY; +int Width; +int Height; +bool[,] Doors; +bool[,] Reachable; +int?[,] Distance; +Step RootStep; + +void Main() +{ + Load(File.ReadAllText(Path.Combine(Path.GetDirectoryName(Util.CurrentQueryPath), @"20_input.txt")).Trim()); + //DumpSteps(); + //int c=0; VerifySteps(RootStep, ref c);c.Dump(); + Walk(); + Flood().Dump(); + DumpMap(); +} + +void VerifySteps(Step s, ref int c) +{ + for(;;) + { + c++; + if (s.NextSteps.Any(ns => ns.P>=s.P)) throw new Exception(); + if (s.NextSteps.Count == 1) { s = s.NextSteps.Single(); continue; } + + foreach (var ns in s.NextSteps) VerifySteps(ns, ref c); + return; + } +} + +void DumpSteps() +{ + StringBuilder b = new StringBuilder(); + DumpSteps(RootStep, ref b, 0); +} + +void DumpSteps(Step s, ref StringBuilder b, int w) +{ + int sscc = 0; + for (; ; ) + { + if (s.NextSteps.Count == 0) { b.Append(sscc.ToString()); w += sscc.ToString().Length; break; } + if (s.NextSteps.Count == 1) { sscc++; s = s.NextSteps.Single(); continue; } + + {b.Append(sscc.ToString()); w += sscc.ToString().Length;} + int l = w; + foreach (var ns in s.NextSteps) + { + b.ToString().Dump();b.Clear(); + b.Append(new string(' ', l)); + DumpSteps(ns, ref b, w); + } + return; + } +} + +void Load(string d) +{ + d = d.Substring(1, d.Length - 2); + + StartX = d.Count(c => c == 'W') + 16; + StartY = d.Count(c => c == 'N') + 16; + Width = d.Count(c => c == 'E') + 16 + StartX; + Height = d.Count(c => c == 'S') + 16 + StartY; + Doors = new bool[Width * 2 + 16, Height + 16]; + Distance = new int?[Width, Height]; + Reachable = new bool[Width, Height]; + + RootStep = Parse(d); +} + +Step Parse(string d) +{ + Step r = null; + Parse(new List(), ref d, ref r); + if (d!="")throw new Exception(); + return r; +} + +List Parse(List source, ref string d, ref Step root) +{ + List lasts = source; + for (; ; ) + { + if (d == "") return lasts; + if (d[0] == '|') return lasts; + if (d[0] == ')') return lasts; + if (d[0] == '(') + { + d = d.Substring(1); + List newlasts = new List(); + for (;;) + { + if (d[0] == ')') { d = d.Substring(1); newlasts.AddRange(lasts); break; } + + var n = Parse(lasts, ref d, ref root); + newlasts.AddRange(n); + + if (d[0] == '|') { d = d.Substring(1); continue; } + if (d[0] == ')') { d = d.Substring(1); break; } + + throw new Exception(); + } + lasts = newlasts; + continue; + } + + if (d[0] == 'N') { var s = new Step { X = 00, Y = -1, Dir=d[0], P=d.Length, }; lasts.ForEach(l => l.NextSteps.Add(s)); lasts = new List {s}; d = d.Substring(1); root = root ?? s; continue; } + if (d[0] == 'E') { var s = new Step { X = +1, Y = 00, Dir=d[0], P=d.Length, }; lasts.ForEach(l => l.NextSteps.Add(s)); lasts = new List {s}; d = d.Substring(1); root = root ?? s; continue; } + if (d[0] == 'S') { var s = new Step { X = 00, Y = +1, Dir=d[0], P=d.Length, }; lasts.ForEach(l => l.NextSteps.Add(s)); lasts = new List {s}; d = d.Substring(1); root = root ?? s; continue; } + if (d[0] == 'W') { var s = new Step { X = -1, Y = 00, Dir=d[0], P=d.Length, }; lasts.ForEach(l => l.NextSteps.Add(s)); lasts = new List {s}; d = d.Substring(1); root = root ?? s; continue; } + + throw new Exception(); + } +} + +void Walk() +{ + Stack<(int x,int y, Step s)> work = new Stack<(int x, int y, Step s)>(); + work.Push((StartX, StartY, RootStep)); + + while(work.Any()) + { + (var x, var y, var step) = work.Pop(); + Reachable[x,y]=true; + + if (step.Dir == 'N') Doors[x*2, y] = true; + if (step.Dir == 'E') Doors[x*2+1,y] = true; + if (step.Dir == 'S') Doors[x*2,y+1] = true; + if (step.Dir == 'W') Doors[x*2-1,y] = true; + + x += step.X; + y += step.Y; + foreach (var ns in step.NextSteps) work.Push((x,y,ns)); + //DumpMap(); + } + +} + +int Flood() +{ + Stack<(int x, int y)> work = new Stack<(int x, int y)>(); + work.Push((StartX, StartY)); + Distance[StartX, StartY]=0; + + while (work.Any()) + { + (var x, var y) = work.Pop(); + + if (Doors[x * 2, y ] && (Distance[x+0,y-1] == null || Distance[x+0,y-1].Value > Distance[x,y]+1)) { Distance[x+0,y-1] = Distance[x,y]+1; work.Push((x+0,y-1)); } + if (Doors[x * 2 + 1, y ] && (Distance[x+1,y+0] == null || Distance[x+1,y+0].Value > Distance[x,y]+1)) { Distance[x+1,y+0] = Distance[x,y]+1; work.Push((x+1,y+0)); } + if (Doors[x * 2, y + 1] && (Distance[x+0,y+1] == null || Distance[x+0,y+1].Value > Distance[x,y]+1)) { Distance[x+0,y+1] = Distance[x,y]+1; work.Push((x+0,y+1)); } + if (Doors[x * 2 - 1, y ] && (Distance[x-1,y+0] == null || Distance[x-1,y+0].Value > Distance[x,y]+1)) { Distance[x-1,y+0] = Distance[x,y]+1; work.Push((x-1,y+0)); } + } + + int c = 0; + for (int xx = 0; xx < Width; xx++) for (int yy = 0; yy < Height; yy++) if ((Distance[xx,yy] ?? 0) >= 1000)c++; + return c; +} + +void DumpMap() +{ + var ww = Width * 2 + 1; + var hh = Height * 2 + 1; + char[,] m = new char[Width * 2 + 1, Height * 2 + 1]; + + int _sx = 0; + int _ex = 0; + int _sy = 0; + int _ey = 0; + for (int xx = 0; ; xx++) + { + var ff = false; + for (int yy = 0; yy < Height; yy++) if (Reachable[xx, yy]) ff = true; + if (ff) { _sx = xx; break; } + } + for (int xx = Width - 1; ; xx--) + { + var ff = false; + for (int yy = 0; yy < Height; yy++) if (Reachable[xx, yy]) ff = true; + if (ff) { _ex = xx; break; } + } + for (int yy = 0; ; yy++) + { + var ff = false; + for (int xx = 0; xx < Width; xx++) if (Reachable[xx, yy]) ff = true; + if (ff) { _sy = yy; break; } + } + for (int yy = Height - 1; ; yy--) + { + var ff = false; + for (int xx = 0; xx < Width; xx++) if (Reachable[xx, yy]) ff = true; + if (ff) { _ey = yy; break; } + } + + var sy = _sy * 2 + 1 - 1; + var sx = _sx * 2 + 1 - 1; + var ey = _ey * 2 + 1 + 2; + var ex = _ex * 2 + 1 + 2; + + + for (int xx = sx; xx <= ex; xx++) for (int yy = sy; yy <= ey; yy++) m[xx, yy] = '?'; + + for (int xx = sx; xx <= ex; xx += 2) for (int yy = sy; yy <= ey; yy++) m[xx, yy] = '#'; + for (int yy = sy; yy <= ey; yy += 2) for (int xx = sx; xx <= ex; xx++) m[xx, yy] = '#'; + + for (int ix = _sx; ix <= _ex; ix++) + { + for (int iy = _sy; iy <= _ey; iy++) + { + if (Doors[ix * 2, iy ]) { m[ix*2+1, iy*2+1-1]='-'; } + if (Doors[ix * 2 + 1, iy ]) { m[ix*2+1+1, iy*2+1]='|'; } + if (Doors[ix * 2, iy + 1]) { m[ix*2+1, iy*2+1+1]='-'; } + if (Doors[ix * 2 - 1, iy ]) { m[ix*2+1-1, iy*2+1]='|'; } + + if (Distance[ix,iy]!= null) { m[ix*2+1, iy*2+1]='.'; } + } + } + + + m[StartX * 2 + 1, StartY * 2 + 1] = 'X'; + + int f = 6; + Bitmap bmp = new Bitmap(((ex-sx)+(ex-sx)/2) * f, ((ey-sy)+(ey-sy)/2) * f, System.Drawing.Imaging.PixelFormat.Format24bppRgb); + using (Graphics g = Graphics.FromImage(bmp)) + { + g.Clear(Color.Magenta); + for (int yy = sy; yy < ey; yy++) + { + for (int xx = sx; xx < ex; xx++) + { + int rx = (xx - sx) + (xx - sx) / 2; + int ry = (yy - sy) + (yy - sy) / 2; + int rw = ((xx - sx) % 2) + 1; + int rh = ((yy - sy) % 2) + 1; + + var c = Brushes.Magenta; + if (m[xx, yy] == '#') c = Brushes.Black; + if (m[xx, yy] == 'X') c = Brushes.Green; + if (m[xx, yy] == '.') c = Brushes.White; + if (m[xx, yy] == '?') c = Brushes.DarkGray; + if (m[xx, yy] == '|') c = Brushes.LightGray; + if (m[xx, yy] == '-') c = Brushes.LightGray; + g.FillRectangle(c, rx*f, ry*f, rw*f, rh*f); + } + } + } + bmp.Dump(); + + //StringBuilder b = new StringBuilder(); + //for (int yy = 0; yy < hh; yy++) + //{ + // for (int xx = 0; xx < ww; xx++) + // { + // b.Append(m[xx,yy]); + // } + // b.AppendLine(); + //} + //b.ToString().Dump(); +} \ No newline at end of file diff --git a/www/statics/aoc/2018/20_challenge.txt b/www/statics/aoc/2018/20_challenge.txt new file mode 100644 index 0000000..68bec81 --- /dev/null +++ b/www/statics/aoc/2018/20_challenge.txt @@ -0,0 +1,144 @@ +--- 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. + +For example, drawing rooms as ., walls as #, doors as | or -, your current position as X, and where north is up, the area you're in might look like this: + +##### +#.|.# +#-### +#.|X# +##### + +You get the attention of a passing construction Elf and ask for a map. "I don't have time to draw out a map of this place - it's huge. Instead, I can give you directions to every room in the facility!" He writes down some directions on a piece of parchment and runs off. In the example above, the instructions might have been ^WNE$, a regular expression or "regex" (your puzzle input). + +The regex matches routes (like WNE for "west, north, east") that will take you from your current room through various doors in the facility. In aggregate, the routes will take you through every door in the facility at least once; mapping out all of these routes will let you build a proper map and find your way around. + +^ and $ are at the beginning and end of your regex; these just mean that the regex doesn't match anything outside the routes it describes. (Specifically, ^ matches the start of the route, and $ matches the end of it.) These characters will not appear elsewhere in the regex. + +The rest of the regex matches various sequences of the characters N (north), S (south), E (east), and W (west). In the example above, ^WNE$ matches only one route, WNE, which means you can move west, then north, then east from your current position. Sequences of letters like this always match that exact route in the same order. + +Sometimes, the route can branch. A branch is given by a list of options separated by pipes (|) and wrapped in parentheses. So, ^N(E|W)N$ contains a branch: after going north, you must choose to go either east or west before finishing your route by going north again. By tracing out the possible routes after branching, you can determine where the doors are and, therefore, where the rooms are in the facility. + +For example, consider this regex: ^ENWWW(NEEE|SSE(EE|N))$ + +This regex begins with ENWWW, which means that from your current position, all routes must begin by moving east, north, and then west three times, in that order. After this, there is a branch. Before you consider the branch, this is what you know about the map so far, with doors you aren't sure about marked with a ?: + +#?#?#?#?# +?.|.|.|.? +#?#?#?#-# + ?X|.? + #?#?# + +After this point, there is (NEEE|SSE(EE|N)). This gives you exactly two options: NEEE and SSE(EE|N). By following NEEE, the map now looks like this: + +#?#?#?#?# +?.|.|.|.? +#-#?#?#?# +?.|.|.|.? +#?#?#?#-# + ?X|.? + #?#?# + +Now, only SSE(EE|N) remains. Because it is in the same parenthesized group as NEEE, it starts from the same room NEEE started in. It states that starting from that point, there exist doors which will allow you to move south twice, then east; this ends up at another branch. After that, you can either move east twice or north once. This information fills in the rest of the doors: + +#?#?#?#?# +?.|.|.|.? +#-#?#?#?# +?.|.|.|.? +#-#?#?#-# +?.?.?X|.? +#-#-#?#?# +?.|.|.|.? +#?#?#?#?# + +Once you've followed all possible routes, you know the remaining unknown parts are all walls, producing a finished map of the facility: + +######### +#.|.|.|.# +#-####### +#.|.|.|.# +#-#####-# +#.#.#X|.# +#-#-##### +#.|.|.|.# +######### + +Sometimes, a list of options can have an empty option, like (NEWS|WNSE|). This means that routes at this point could effectively skip the options in parentheses and move on immediately. For example, consider this regex and the corresponding map: + +^ENNWSWW(NEWS|)SSSEEN(WNSE|)EE(SWEN|)NNN$ + +########### +#.|.#.|.#.# +#-###-#-#-# +#.|.|.#.#.# +#-#####-#-# +#.#.#X|.#.# +#-#-#####-# +#.#.|.|.|.# +#-###-###-# +#.|.|.#.|.# +########### + +This regex has one main route which, at three locations, can optionally include additional detours and be valid: (NEWS|), (WNSE|), and (SWEN|). Regardless of which option is taken, the route continues from the position it is left at after taking those steps. So, for example, this regex matches all of the following routes (and more that aren't listed here): + + ENNWSWWSSSEENEENNN + ENNWSWWNEWSSSSEENEENNN + ENNWSWWNEWSSSSEENEESWENNNN + ENNWSWWSSSEENWNSEEENNN + +By following the various routes the regex matches, a full map of all of the doors and rooms in the facility can be assembled. + +To get a sense for the size of this facility, you'd like to determine which room is furthest from you: specifically, you would like to find the room for which the shortest path to that room would require passing through the most doors. + + In the first example (^WNE$), this would be the north-east corner 3 doors away. + In the second example (^ENWWW(NEEE|SSE(EE|N))$), this would be the south-east corner 10 doors away. + In the third example (^ENNWSWW(NEWS|)SSSEEN(WNSE|)EE(SWEN|)NNN$), this would be the north-east corner 18 doors away. + +Here are a few more examples: + +Regex: ^ESSWWN(E|NNENN(EESS(WNSE|)SSS|WWWSSSSE(SW|NNNE)))$ +Furthest room requires passing 23 doors + +############# +#.|.|.|.|.|.# +#-#####-###-# +#.#.|.#.#.#.# +#-#-###-#-#-# +#.#.#.|.#.|.# +#-#-#-#####-# +#.#.#.#X|.#.# +#-#-#-###-#-# +#.|.#.|.#.#.# +###-#-###-#-# +#.|.#.|.|.#.# +############# + +Regex: ^WSSEESWWWNW(S|NENNEEEENN(ESSSSW(NWSW|SSEN)|WSWWN(E|WWS(E|SS))))$ +Furthest room requires passing 31 doors + +############### +#.|.|.|.#.|.|.# +#-###-###-#-#-# +#.|.#.|.|.#.#.# +#-#########-#-# +#.#.|.|.|.|.#.# +#-#-#########-# +#.#.#.|X#.|.#.# +###-#-###-#-#-# +#.|.#.#.|.#.|.# +#-###-#####-### +#.|.#.|.|.#.#.# +#-#-#####-#-#-# +#.#.|.|.|.#.|.# +############### + +What is the largest number of doors you would be required to pass through to reach a room? That is, find the room for which the shortest path from your starting location to that room would require passing through the most doors; what is the fewest doors you can pass through to reach it? + +--- Part Two --- + +Okay, so the facility is big. + +How many rooms have a shortest path from your current location that pass through at least 1000 doors? diff --git a/www/statics/aoc/2018/20_input.txt b/www/statics/aoc/2018/20_input.txt new file mode 100644 index 0000000..ebb2442 --- /dev/null +++ b/www/statics/aoc/2018/20_input.txt @@ -0,0 +1 @@ +^ESWSWSESEENENESENEESEESEENNESSESSSSSEEEESENENESESWSESSESSENNEENWNWNENNWSW(SSSEWNNN|)NWNNNENNNNESEEEESSSENNNNWNNWSWS(E|WNNWNEE(S|ENWNWWWS(SWNNNNWSSSSSWNNWWSWWNNWWNNEENEEENWNNWNWWWNEEENWWNENWNNENNWSWWWNWSSSWNNWNENNESEESENNESEENWNNESENNWWNENEEENNWSWNNNENEESS(W(N|W)|EENWNEENWNNENWNENENNENEEESESWSEEEENWNW(NEENWWW(WNNESEENNENENWWWNEEEEESENESESSSWSESWWWNNNW(N(EEESWSS(NNENWWEESWSS|)|N)|SW(N|WSESE(N|SEESWWSSESSSEENWNENEESSEESWWSESWWSWSESEEESEESSESWWSSEEN(W|ESSSWSSSWNNNWWSSE(SWWWWWSEESENESSSWNWWSSE(EEENNENEEESWSW(N|SSW(NN|WWSEESEEESWSEENNNWW(W|NEN(EN(NESEE(SWSESSWSSE(SSSWNWSWNWSWWNN(NWN(E|WSWNN(E|WWSESSESESWSEE(NNNWESSS|)EESEESESSSWSSENEE(NWNNNNE(NWW(S|WW)|SSS)|SSSSWNN(N|WSWNWWNENNWNEENWNWWS(WNWWWWSWNNNNNE(NWWWNNENE(SS(W|E)|NEN(ESNW|)WWWNWSWWNENNESEE(NWN(EE|NNWSWWWNWWNNEENWWWWWSSWSESSSSWNWNENWWSWNNNNENNWSWNWNENENEENNWSWNWSWNW(SSWW(SEE(ENEWSW|)SSWW(NEWS|)SWSEESSSWSWSS(WNN(NENWNEES(NWWSESNWNEES|)|W)|ENENEENNW(S|NNN(ESES(W|SSSSEESWSEE(EEENNEEESSWW(NEWS|)SWSSWSSWNNWWWSEESWSSS(WNNW(SS|N(E|NNWNWSWW(SESS(SSSWWW(S|N(EENWWEESWW|)WW)|ENE(NWES|)S)|NNW(S|NEENENESSE(N|S(SENEES(ENESNWSW|)W|WW(WSNE|)N))))))|EENWNEEENEN(NNESSSSSESSSSSWSSW(NNNNWNW(SSESSNNWNN|)(W|NNEE(N|S(W|SE(SS|N))))|SSSEEEESEEESSSENNNESEESSSEESEENNW(S|NNEN(ESE(N|EESWSWSSEEN(W|NESSSSWSEE(SWWWSESWWWNWNENWWNN(WSSSWNNWNWSWNWNN(ESE(NNNWS|EES)|WSSSESSENEESWSESEEE(N(N|WW)|ESEEESWSEENNENNESSSWSSWSSWNWWSSE(N|ESWSESEEE(SWWWSSEESE(NNWWEESS|)SSWWSESE(SSWSESSSSSSWSWNNWNENNN(ESSSSNNNNW|)WSSWSSSWNNWWSSE(SESENE(SSSESWSSEEN(W|E(NNNN(WS(WNSE|)SS|N)|SSSWWN(E|WWWWWS(WWNENWNEENNNN(WN(E|NNNWSWSWSWNNENWWWNWWNWSWSWNNWSWSSSSWSEESEENWNWNEEN(WWNSEE|)ESS(SSESSESWSSS(WWNENNWSWNWSWNWWSWNNWSWWSSWNWNNE(S|EENWNNWWWWSEES(ENSW|)WSSWSSS(WNNWWSS(ENSW|)WNWWNEENWWNNWNWNWWNWNWNNNNWWWSSWSWNNENWNEEENNNEESWSSEESESENNNESENESENNESESSW(SEENESSESWWNWSSESWSWWW(SEESWSEESENNN(WSNE|)NE(NNESEENESENEESSS(WNNSSE|)SENNNNNWNEESE(SWSSSSES(EEN(WNWESE|)ESEENW|W)|NNWWWWWNNWSSSS(ENESNWSW|)WW(S|NENNNNWWWW(SEEESWSE(WNENWWEESWSE|)|NNNWS(S|WNWWNNNWSSWSWNNWWSWWWS(EEESSE(S(WW|S)|N(EES(W|EN(E(E|S)|N))|NN))|WNWNNEENENNESENEEESWWSEE(ENEES(W|SSENEEENNWNWW(SSE(N|E)|NEENWNEENWNNNNEENEEEENNN(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W)|S(W|E))|ESSE(N(E|N)|S))|W))))|W)|WWWNN(ESNW|)NNWSWNWWN(EEENSWWW|)NWSSSESWSSESSWNWWNENWNWNENE(NWWWS(WNWNWSSSWSWSWNWNNWSWSSWWSWWSWSWWWWSEESENEEEENN(WSWENE|)EEN(W|EE(NWNSES|)SSW(N|WWSSWWWSSSESESSWSSENESEENWNENESSE(SSW(N|SWWWSESSSSE(SE(SWWWWNNE(SEWN|)NNNWSWS(E|WSSE(N|SWWWWSWNNNENWWWWWNNWNWNWSWWSSENESE(ESWWSWNWWWNWSWWNWNWSWNWNEEENENENNWSWSWWS(WWSWNNWNWNEENWNWSWWNENEEESESEESS(ENNNEENNNENWNNEES(ESSSSSESWW(SEEENNENWWNNESEESSEEESWSEEENNENESESWSESSSENEE(ESE(NEEEWWWS|)SWSWWS(E|SW(NWWWWNW(NWNWNEN(WWWW(WWSWSW(NNEWSS|)WSEEE(S(WWW(WNSE|)S|S)|NENE(S|EE))|NEENWW)|ESENE(NN|SE(N|SWS(WNWESE|)EES(ENENES|WW))))|S)|SS(ENSW|)W))|NWNW(S|NNESE(N(NWWWNENWN(WWWSEESWWSW(WNNWNNWSWW(SEESSEN(SWNNWWEESSEN|)|WWNNESEENWNENESENNNEENWWNNEENWNNEEESSEESSSEES(ENE(S|NNEE(SWSEWNEN|)ENWNNNWWNWNEEES(ENN(ESENN(ESEESWSEENEESENN(ESSSSWW(SEEEEWWWWN|)WN(N|EE|WWWSSE(NEWS|)SSWSWNN(E|NNNWSWS(ESWENW|)WNNENEEN(SWWSWSNENEEN|)))|WWWNWWN(SEESEEWWNWWN|))|W)|WWWWN(E|WSWWSESE(SWWW(WNE(NNNNEE(SWEN|)NESENNWNEE(S|NENWNEESES(W|SS(SWSNEN|)ENEES(W|ENEES(W|SEE(NENWW(NENEEESE(SSESENNEE(N(WWWSNEEE|)N|EEE(NESEWNWS|)SSWSWSWSSENE(NENSWS|)SSWWWNNNN(WWW(NW(S|NNW(NWES|)S)|SSSEE(NNWSNESS|)SS(WWNEWSEE|)EE)|ENWNEE(S|E)))|NNWWNNWWWNNNNWSSSWNNWWWWWNEEEEENEEENWNEESE(SESSE(SWWWW(SEEWWN|)NEENW(N|W)|NE(ESW|NW))|NNNWSWNN(WSSWNNWSWNNNNNWWWSSSSSSSSES(EENEENWWW(S|WNE(EE|NNW(S|NENNWS)))|WWWNENWWWNENESENNWWWSWWNENNWWS(SWNNWWNNESENNEENEENWWWWWS(SWWWNWNENNWNENESENNEEEESESWWWN(WSSWWSSE(SWEN|)NEENESEEN(W|ESENEESENENESENNWNNEEEESEESWWSWSSENESS(WWSSW(NNWWN(WSSWWN(W(SSSE(NEEEENW(ESWWWWEEEENW|)|SSSWNNWSW(SEWN|)NNW(WWSEEWWNEE|)NEE(NN|S))|N)|E)|EENNNN(ESNW|)W)|SSSSEN)|ESENNESENNWWN(W(W|SS)|NEE(SWEN|)ENENNWWWWWNNEES(W|EENWNNNEEESS(W(WNEWSE|)S(S|E)|EENENWNW(WWWWWNNNNNNWSWSESWWSSWWNENNWSWSWSESSEESWWWNWN(E|WSWWSWWWWSSSWNNNWWSWWSWNWWWSEESWWWSWWNENWNENWNNWNNNNNWNNWWWSEESSESWWNNWSWWSSENESEEESSWNWSSESSEE(NWNEWSES|)SSWWN(WNWSWWNNWSWNWNENEN(WNNE(S|NNWSWWNNNWWWWWWNENWWNNWWN(WSWNWWSESSESWSSEESWSSWSSENEESWSSWSWSSWNNNN(NWSWSESWSESSESSESESWSSWSEESENNWNEENEESENNWNENNENNWNWWSWSWW(SS(WNSE|)ES(S(EENNW(S|N(W|ENE(N|E|SS)))|S)|W)|NENENEN(W|ENNNENWWS(SS|WN(WSNE|)NEEN(NNWSW(SEWN|)W(W|NNN(EESWSNENWW|)W)|EEESW(SEEEE(NNWWSE|SSSENE(NWES|)SSWSWSESWSWWW(SEEEENE(N|SEE(NWES|)ESSEESENN(WWNEEWWSEE|)ESSESWSWWN(E|WWSESEEESWSWNWSSWSSESENEEENWN(WWS(W|E)|NESENENWNW(S|NENNN(WNEWSE|)EESSSW(NN|SEEE(S(E|WSW(SESWW(N|SSSWN(NN|WSWW(NEWS|)SSWSSESESESWSWWSSWSSEEESWSSSSSWSWNWSWWWSSWNWSWSSEESSWWN(E|WSWWNNNNWNNWSWSSE(ESSSWNNWWNWSSSSWNNWSSWNWSWSSSWNWSSWWSSWSWNWWSW(NNNNESSENNEE(SWSEWNEN|)NWNWNEENNWSWNNNWW(NEENNWW(SEWN|)NNNESSEENEEESESEENWNWNWWWNENNWSWSSW(S|NNNENENWNWWW(NENENNWNNW(SSS(S|E)|NEESEEESESSWWW(SES(WW|SEESWSEENNNN(WWSEWNEE|)EENNESEESSENNEESENNEEENEEESWSESSWWWNE(E|N(WWWSESWWSWSWSSSSWNNNWWWWSW(WSES(WWNNSSEE|)ES(ES(W|SSSWSWWSESWSES(WWNW(SSS(E(NEESW|SWSE)|W)|NNNE(N(EE|WWN(E(NWES|)E|WSSSSENN(SSWNNNSSSENN|)))|SS))|ENNEN(W|NENNNENWNE(NNNWWS(SENSWN|)W|ESSENESE(SWSWWW(NEEWWS|)SE(EE|SSWNWSSW(ENNESEWNWSSW|))|ENESEENNW(S|NNNWSSWNNNW(NENEEEEESSSESENENENWWW(SEWN|)NENNNW(SS|NEENNWSWNWWWWWWS(E|WWNWSWNNWWWWSS(ENEESWSEEEE(WWWWNEWSEEEE|)|WNW(SSSENSWNNN|)WNENNNESES(WSNE|)EEENNWSWNWNEENNESENN(ESSSW(W|SESS(WNSE|)ENNENEENNESENEENNNNWWNNNESENEENN(ESEE(NWES|)S(SSSESSWWWSWNNEE(E|NWNN(WWS(WW|ESWSSSSESWWWSSSENESSWS(EENESENNNWW(SEWN|)N(WW|EEE(NWWNENES(NWSWSEWNENES|)|SE(N|ES(ENSW|)SWNWSSEESSSS(SSWSSW(NWNENWW(SS|NEEE(S|NWNENWWSS(NNEESWENWWSS|)))|SESWSW(SEESES(WWWS(E|WNN(EE|WN(ENSW|)WSWW(NN(ESNW|)W(S|NNN(ESS|WWSE))|SSES(SWW(WNEEWWSE|)SSS(ENNSSW|)S|ENE(NWWEES|)S))))|ENNWN(NESNWS|)W)|N))|EN(ESNW|)N))))|WNWNWN(ENWESW|)WSW(WSS(WW|S|EEN(ESEWNW|)W)|N)))|E(NWES|)S))|EE)|WSWNWWWS(SSSSSEESWS(E|WNWNNWSSWW(NEN(N|W)|SSS(S|ENNE(SS|E))))|EE)))|WNWWNNNENNWSWSWNNENN(ESNW|)WNENWNWSWNNWWNWWWW(SEEESEESSSSWSESSWWSEEENE(NWNEN(E|NW(NEWS|)S)|SEESSSE(E|SWS(WSWNWSSSWWWS(WWNENWW(NNNESSEENESS(ENNNNESENE(S|NWWWWWSESWW(S|NNN(NWSSSWNNNNNNNEENE(SSS(WSWNNE|E)|NWN(EESSNNWW|)NWWSESWSE(WNENWNSESWSE|))|EEEEEE)))|W)|SS)|SENE(S|E))|E)))|NNNNESSES(W|ENNNNESSESS(WNSE|)EENNNW(WNNEENWNWNNNWSWSWWSSW(NNNNNESE(SWEN|)NE(EEN(WWWWW|ESSEESWWSESEEESE(SWSWNNWSS(SSS(ENEEN(NENSWS|)WW|SSW(SEWN|)WW)|WW)|NNNNWNNWWS(WNSE|)ESSESWW(EENWNNSSESWW|)))|S)|SSEE(SS|N(W|NNEE(S(SWNSEN|)E|N))))|SS)))))))|WSSSS(W|E(EE|S|NNN)))))))))|W)|NNNEN(W|ENESSWS(W|EENE(S|EN(E|N)))))|N)))|NN(ESEWNW|)W))|SSE(NESNWS|)SSW(SEWN|)N))|SESSW(SESWSEE(WWNENWESWSEE|)|N))|SSSSESSW(SSSSSSESSEENESEENEESWSWWSSWNWN(WWW(SESE(N|ESWSWNW(N|SSESSESSEESWSSSSSWNNWSSSW(SEESESESWWS(WNN(NWSSSNNNES|)E|EEENNNENNNWSW(S(WNWESE|)(S|E)|NNNENWNEESSS(EEESWSESWSW(NNN|SSS(WNNSSE|)EENEENNW(NEENESSENESEESESS(ENNEESEENNESESWS(WWWWNSEEEE|)EENNNWNWWWS(S|WNNWSSWNNWNWSS(ESNW|)WNNWW(SEWN|)NNEES(ENNNESEENESSSENNNNWNEENWWWNWSWNNNNWNEEEEEESWSSENEESWS(SSSWSEEENESEENWNNNNWSW(WSS(EENWESWW|)S|NNENN(ESES(W|ESEEEEN(NWWW(SEEWWN|)W|ESSWWWWSESWSW(NNNW(SS|N)|SSSSWWNN(ESNW|)WWWWSSW(NN|SW(SEEEESEESWSSENEEENENWNWN(ENENESESSW(NWSNES|)SEENEESSSWSS(WNWNN(WSSS(WN(WSWW(NEWS|)WW|N)|E)|E(ENSW|)S)|EEN(NENWNENWNENENNENESEENESSESEEEESEENWNWN(NNNWWWSEESWWW(SEEESWW(EENWWWEEESWW|)|NNWWN(WWNNWWSWWWNW(NENESSENNESENES(NWSWNWESENES|)|SSSESENN(W|ESENE(SS(WSW(WWWSEEESWWS(E|SWWNENWWNWWW(NENENESS(W|E(S|N(NNWWEESS|)E))|S))|N)|EE(NWES|)(EE|S))|N)))|EEN(ESEEENWW(EESWWWEEENWW|)|W)))|EEENEE(NWNEWSES|)SSSWSSW(SESESENENNEE(SSW(SWSWS(EENENEE(SWS(EEE|W)|NNW(N|S))|WWN(E|NWWN(WWSESS(ENESNWSW|)WNWSWNWWNEENE(S|NN(NWWSWNWWN(E|WWSESWWSESWSSS(WWNENNNNNENNEEE(WWWSSWENNEEE|)|EENN(WSNE|)ENN(WSNE|)E(NWES|)ES(ENENSWSW|)WSSS(WNSE|)EE))|EEESWW))|E)))|N)|NWWNW(SWSESW|N))|NNN(ENSW|)W))|W))|WWS(ESESWENWNW|)WNWW(W|NEENWW))|WWWNN(ES|WS))))))|WSWWNENWNWSWWWWWWWNWNWWWWWSSWWSWW(WSW(WSWSEEEN(W|ESESWSEESESWW(SSES(W|EENWN(ENNESSEENEEE(SWS(E|W(WSSSWNW(NNESNWSS|)SW(SEWN|)N|N))|EN(WWNWSWW(S|NENNEEES(WW|E(SWEN|)NNWWWNWSWSWS(SWNNNWW(SES(S|W)|WN(EENESE(ENWNNESESEE(ESW|NWNW)|S)|W))|E)))|ESE(NESNWS|)S))|W))|NWSWNNNWWSE(WNEESSNNWWSE|)))|N)|NNE(S|EEN(NNNNNWSSWNNWNWNNENENNWNNWSSS(E|SWWW(NENNNE(SSS|N(EEEENWW(NNESEEESSSSENNNNNWN(WWSEWNEE|)ENWNEN(W|EESSW(N|SEEEENNWN(WSSEWNNE|)EESSEENNW(S|N(EESENEEEENNENWN(WW|ENESESSSW(SW(N|SSSSSSWNNNNNWWSSSWWW(NEEN(N|WW)|SWWW(NEEWWS|)WSWWN(E|WSSSW(NNN|SSSWWWNW(SSESWSEESWS(EENESESSESESWWWS(EEEESENEENNE(SSSEE(NWNSES|)SWWWW(NEWS|)W|NWWWNNNE(ENEEEEEES(SENENE(S|NNNWWWWSES(E(NESNWS|)S|WWNNWNENNWNEE(ESSEENENENNNWW(SESWSWS(NENENWESWSWS|)|NNEEES(WW|EESSWNWSSESESS(S|WWW(NE(N|E)|WSWWWWNN(SSEEEEWWWWNN|))|ENNN(ENWNNEES(W|SENE(NNENWWWS(ESNW|)WWWNEENNNNWSSSWWWW(S(EESNWW|)W(N|W)|NNEEE(SWWEEN|)NWNEENNENENNWWS(SW(WSWS(EENSWW|)W(SSENSWNN|)NW(S|WW)|NNNNEES(W|ENEESSSW(NN|SEESEENESE(NNNNNESSENNNEESS(W(SSWWSE|N)|ENNNEENESENNWWWSWNWSWWNENNENESS(W|ENEN(NW(S|N(E|WSWWWWNWSSSENE(SSWWWSSSS(EEN(NNWSSNNESS|)EEE|SWWNENNNNWNENNWWNWNENENEESWSWSEE(NEENN(EESSW(SEENENW(ESWSWWEENENW|)|N)|W(S|NENWWNWNN(ESNW|)WSWWSW(NNEEN(NN|E)|SSWSES(ENNNES(S|EN(NW|ESE))|SWNWNWNEN(WWSS(W|SESESESSESSESWWSWSEEEN(W|ES(ENNWNNN(W(NWNSES|)S|E)|S(SSEESE(SWW(WNEWSE|)S|N)|WWWWW(NNNNN(WWSESWW(EENWNEWSESWW|)|NE(SESWSNENWN|)N)|W)))))|E)))))|SSS))|E)))|ESS(W|EESSSS(W|ENNESSSS(WNWSNESE|)ENNNEN(ESEEESWWWS(W(SEWN|)N|E)|WNNWSWN(SENESSNNWSWN|)))))))|SSWS(WSESWWWSWWNW(S|NEE(S|NNN(ESE(SSWNSENN|)EN(E|W)|WN(WSWSEESW(ENWWNEWSEESW|)|E))))|E)))))|E))|SSSWW(NEWS|)SW(N|S)))|W))))|NN(WSWW(NEWS|)WWWSSENEESS(SSSWNWSS(EEENSWWW|)WWS(E|WNNWWSWN(WWWSEES(ESEE(SE(N|SW(WNSE|)SESSEENW(ESWWNNSSEENW|))|N(N|W))|W)|NEENNNW(SWSEWNEN|)NEESE(SEES(ENNSSW|)WSSWNWN(N|E)|NN)))|E)|NNN))))|W)|SS))|WNW(NNNESSE(NN|E)|S))|WWN(E|W|N))|N(WS|ENN))))))|NN))|WWNNWSS(NNESSEWNNWSS|)))))|W)|WW(N|WSSE(N|S))))|SSW(SSES(W|EEE(S(S|WWWS|EN)|NWWN(NE(NWES|)S|W)))|N)))|W)))))|WWWNNWW(SE|NEE))|W))|WNWSWWWNN(W(SSWWEENN|)N|EE(SWEN|)E))|SW(WSNE|)N))|W)))|NNNNNESENNWNW(N(E|NN)|S))))|NN)|E)|N))|N))))|N))|NNNW(SS|NENESS(ENE(S|ENN(WSWENE|)ENESE(SS(WWNEWSEE|)ENEESWSEEEEES(ENNNNWWNN(ESENE(NWWEES|)SENEEEE(SWWSES(WWN(WWSEWNEE|)N|E(N|SEESEEN(E|W)))|NESENN(ESSNNW|)NW(NNES|SWNWW))|WWWSSENESSEESWWWN(SEEENWESWWWN|))|SWNWWWSEE(WWNEEEWWWSEE|))|NN))|S))))))))|NNNEE(SSWNSENN|)N(E|WNWWS(W(NNENEEES(WW|S)|S(ESNW|)W)|E))))|W)))))|E(S|E))|EEEESEEN(EEESWSW(WW(WWNSEE|)SSENESENESENESENEE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SSESEENWNNNEENWWNWS(WWN(ENNN(WSSNNE|)NEE(NNWSWENESS|)SEESSES(WWNWN(E|W(S|N))|SSSWS(WNSE|)SSESESSWWN(E|NWSWW(NEWS|)SEESWS(WSSW(SWSEWNEN|)NNN(NWSWENES|)E|EENEEENNNNESSESWSEENNNNENN(ESSEESEN(NWWEES|)ES(ENSW|)SSWNWWSSE(SWWW(NNNE(N(W|E)|SS)|WSWW(SS(SENNEEES(WW|EENN(E(SS|NNESEEE(WWWNWSNESEEE|))|W(S|WW)))|WW)|N(E|WWW)))|N)|NWWNWWW(SESWWSE(EEE(N(WN|ES)|SS)|S)|NEEEN(WWWNNWNEEE(NNN(W|N)|SE(SWWNSEEN|)N)|EEE(SWSWN|ENNN)))))))|W)|SSS)))|S))|SE(SS(WNSE|)EEEE|N))|E)))))|E(S|EEE(E|NNNN(E|N(N|W)))))|N)|NWNWWNENNENE(NWNWWNNW(NEENEE(SSW(WSEESNWWNE|)N|NWWNWNEENE(SSWENN|)NWNNNWNWWSESSWSWSSSE(SESWW(NWNNNWW(SEWN|)WWN(WSNE|)ENESEENNE(E|S|NWNNE(EENNWWWWNWNNESENNNESSSEES(WWW|EENWNENNE(NNWNN(ESNW|)WSWSES(E|WW(WNWNWWSES(E|SSWWWSW(SSES(SEN(ESS(E(NEEEWWWS|)SSW(N|S(ESNW|)W)|WW)|NN(N|W))|WWW(NENWESWS|)W(W|S))|NNNENWNEE(SSESWW|N(WWW|EEEEE(S(S|W)|E)))))|SSSENNES(NWSSWNSENNES|)))|SSSSSWSW(N|SEE(S(SSS|W)|N))))|S))|S)|NNEEN(W|NN)))|SSSES(ENSW|)WWSEESWWS(WWWSNEEE|)E)|SSS(WNSE|)S))|W)|W))))|N)|N)))))|S)|S))|EE)))$ \ No newline at end of file diff --git a/www/statics/aoc/2018/21-1.linq b/www/statics/aoc/2018/21-1.linq new file mode 100644 index 0000000..52b9bd6 --- /dev/null +++ b/www/statics/aoc/2018/21-1.linq @@ -0,0 +1,97 @@ + + +class Command { public String Name; public (string, Action) Op; public int[] Args; public int Dst => Args[2]; public int Arg1 => Args[0]; public int Arg2 => Args[1]; } + +(string, Action)[] Operations = new(string, Action)[] +{ + ("addr", (reg, cmd) => { reg[cmd.Dst] = reg[cmd.Arg1] + reg[cmd.Arg2]; } ), + ("addi", (reg, cmd) => { reg[cmd.Dst] = reg[cmd.Arg1] + cmd.Arg2; } ), + ("mulr", (reg, cmd) => { reg[cmd.Dst] = reg[cmd.Arg1] * reg[cmd.Arg2]; } ), + ("muli", (reg, cmd) => { reg[cmd.Dst] = reg[cmd.Arg1] * cmd.Arg2; } ), + ("banr", (reg, cmd) => { reg[cmd.Dst] = reg[cmd.Arg1] & reg[cmd.Arg2]; } ), + ("bani", (reg, cmd) => { reg[cmd.Dst] = reg[cmd.Arg1] & cmd.Arg2; } ), + ("borr", (reg, cmd) => { reg[cmd.Dst] = reg[cmd.Arg1] | reg[cmd.Arg2]; } ), + ("bori", (reg, cmd) => { reg[cmd.Dst] = reg[cmd.Arg1] | cmd.Arg2; } ), + ("setr", (reg, cmd) => { reg[cmd.Dst] = reg[cmd.Arg1]; } ), + ("seti", (reg, cmd) => { reg[cmd.Dst] = cmd.Arg1; } ), + ("gtir", (reg, cmd) => { reg[cmd.Dst] = cmd.Arg1 > reg[cmd.Arg2] ? 1:0; } ), + ("gtri", (reg, cmd) => { reg[cmd.Dst] = reg[cmd.Arg1] > cmd.Arg2 ? 1:0; } ), + ("gtrr", (reg, cmd) => { reg[cmd.Dst] = reg[cmd.Arg1] > reg[cmd.Arg2] ? 1:0; } ), + ("eqir", (reg, cmd) => { reg[cmd.Dst] = cmd.Arg1 == reg[cmd.Arg2] ? 1:0; } ), + ("eqri", (reg, cmd) => { reg[cmd.Dst] = reg[cmd.Arg1] == cmd.Arg2 ? 1:0; } ), + ("eqrr", (reg, cmd) => { reg[cmd.Dst] = reg[cmd.Arg1] == reg[cmd.Arg2] ? 1:0; } ), +}; + +void Main() +{ + (var commands, var ipidx) = Load(File.ReadAllLines(Path.Combine(Path.GetDirectoryName(Util.CurrentQueryPath), @"21_input.txt"))); + + long[] data = new long[6]; + data[0]=2; + for (int gen=0;;gen++) + { + if (data[ipidx] < 0 || data[ipidx] >= commands.Count) { break; } + + var ip=data[ipidx]; + var cmd = commands[(int)ip]; + + if (ip == 28) { data[4].Dump(); return; } // this is if ([4] == [0]) EXIT + + cmd.Op.Item2(data, cmd); + data[ipidx]++; + + //$"{ip:00}:{cmd.Op.Item1} [{string.Join(" ", data.Take(6).Select(i => $"{i,-10}"))}]".Dump(); + } + + data[0].Dump(); +} + +(List, int) Load(string[] input) +{ + return + ( + input + .Skip(1) + .Where(i => !string.IsNullOrWhiteSpace(i)) + .Select(i => new Command { Name = i.Split(' ')[0], Op=Operations.Single(o => o.Item1.ToLower() == i.Split(' ')[0].ToLower()), Args = i.Split(' ').Skip(1).Select(int.Parse).ToArray() }) + .ToList(), + int.Parse(input[0].Split(' ')[1]) + ); +} + +/* + +#ip 1 +00: seti 123 0 4 [4] = 123 [4] = 123 [4] = 123 +01: bani 4 456 4 [4] = [4] & 456 1: [4] &= 456 [4] &= 456 +02: eqri 4 72 4 [4] = [4] == 72 if ([4]<>72) JMP 1 if ([4]<>72) ERROR +03: addr 4 1 1 IP = IP + [4] +04: seti 0 0 1 IP = 0 +05: seti 0 2 4 [4] = 0 [4] = 0 [4] = 0 for([4] = 0;;) +06: bori 4 65536 3 [3] = [4] | 65536 6: [3] = [4] | 65536 6: [3] = [4] | 65536 [3] = [4] | 65536 +07: seti 10552971 1 4 [4] = 10552971 [4] = 10552971 [4] = 10552971 [4] = 10552971 +08: bani 3 255 5 [5] = [3] & 255 8: [5] = [3] & 255 8: [5] = [3] & 255 for(;;) +09: addr 4 5 4 [4] = [4] + [5] [4] += [5] [4] += [5] [5] = [3] & 255 +10: bani 4 16777215 4 [4] = [4] & 16777215 [4] &= 16777215 [4] &= 16777215 [4] += [5] +11: muli 4 65899 4 [4] = [4] * 65899 [4] *= 65899 [4] *= 65899 [4] &= 16777215 +12: bani 4 16777215 4 [4] = [4] & 16777215 [4] &= 16777215 [4] &= 16777215 [4] *= 65899 +13: gtir 256 3 5 [5] = 256 > [3] if (256 > [3]) JMP 28 if (256 > [3] && [4] == [0]) EXIT [4] &= 16777215 +14: addr 5 1 1 IP = IP + [5] if (256 > [3]) JMP 6 if (256 > [3] && [4] == [0]) EXIT +15: addi 1 1 1 IP = IP + 1 if (256 > [3]) BREAK +16: seti 27 7 1 IP = 27 +17: seti 0 1 5 [5] = 0 [5] = 0 [5] = 0 +18: addi 5 1 2 [2] = [5] + 1 18: [2] = [5] + 1 18: [2] = [5] + 1 for([5]=0;;) +19: muli 2 256 2 [2] = [2] * 256 [2] *= 256 [2] *= 256 [2] = ([5] + 1) * 256 +20: gtrr 2 3 2 [2] = [2] > [3] if ([2] > [3]) JMP 26 if ([2] > [3]) [3] = [5]; JMP 8 +21: addr 2 1 1 IP = IP + [2] else [5]++ JMP 18 if ([2] > [3]) [3] = [5]; BREAK +22: addi 1 1 1 IP = IP + 1 else [5]++ CONTINUE +23: seti 25 0 1 IP = 25 +24: addi 5 1 5 [5] = [5] + 1 [5]++ +25: seti 17 2 1 IP = 17 JMP 18 +26: setr 5 7 3 [3] = [5] 26: [3] = [5] +27: seti 7 8 1 IP = 7 JMP 8 +28: eqrr 4 0 5 [5] = [4] == [0] 28: if ([4] == [0]) EXIT +29: addr 5 1 1 IP = IP + [5] else JMP 6 +30: seti 5 0 1 IP = 5 + +*/ diff --git a/www/statics/aoc/2018/21-2.linq b/www/statics/aoc/2018/21-2.linq new file mode 100644 index 0000000..2101a36 --- /dev/null +++ b/www/statics/aoc/2018/21-2.linq @@ -0,0 +1,112 @@ + + +class Command { public String Name; public (string, Action) Op; public int[] Args; public int Dst => Args[2]; public int Arg1 => Args[0]; public int Arg2 => Args[1]; } + +(string, Action)[] Operations = new(string, Action)[] +{ + ("addr", (reg, cmd) => { reg[cmd.Dst] = reg[cmd.Arg1] + reg[cmd.Arg2]; } ), + ("addi", (reg, cmd) => { reg[cmd.Dst] = reg[cmd.Arg1] + cmd.Arg2; } ), + ("mulr", (reg, cmd) => { reg[cmd.Dst] = reg[cmd.Arg1] * reg[cmd.Arg2]; } ), + ("muli", (reg, cmd) => { reg[cmd.Dst] = reg[cmd.Arg1] * cmd.Arg2; } ), + ("banr", (reg, cmd) => { reg[cmd.Dst] = reg[cmd.Arg1] & reg[cmd.Arg2]; } ), + ("bani", (reg, cmd) => { reg[cmd.Dst] = reg[cmd.Arg1] & cmd.Arg2; } ), + ("borr", (reg, cmd) => { reg[cmd.Dst] = reg[cmd.Arg1] | reg[cmd.Arg2]; } ), + ("bori", (reg, cmd) => { reg[cmd.Dst] = reg[cmd.Arg1] | cmd.Arg2; } ), + ("setr", (reg, cmd) => { reg[cmd.Dst] = reg[cmd.Arg1]; } ), + ("seti", (reg, cmd) => { reg[cmd.Dst] = cmd.Arg1; } ), + ("gtir", (reg, cmd) => { reg[cmd.Dst] = cmd.Arg1 > reg[cmd.Arg2] ? 1:0; } ), + ("gtri", (reg, cmd) => { reg[cmd.Dst] = reg[cmd.Arg1] > cmd.Arg2 ? 1:0; } ), + ("gtrr", (reg, cmd) => { reg[cmd.Dst] = reg[cmd.Arg1] > reg[cmd.Arg2] ? 1:0; } ), + ("eqir", (reg, cmd) => { reg[cmd.Dst] = cmd.Arg1 == reg[cmd.Arg2] ? 1:0; } ), + ("eqri", (reg, cmd) => { reg[cmd.Dst] = reg[cmd.Arg1] == cmd.Arg2 ? 1:0; } ), + ("eqrr", (reg, cmd) => { reg[cmd.Dst] = reg[cmd.Arg1] == reg[cmd.Arg2] ? 1:0; } ), +}; + +void Main() +{ + (var commands, var ipidx) = Load(File.ReadAllLines(Path.Combine(Path.GetDirectoryName(Util.CurrentQueryPath), @"21_input.txt"))); + + long best = -1; + HashSet possibilities = new HashSet(); + HashSet history = new HashSet(); + + long[] data = new long[6]; + data[0]=2; + for (long gen=0;;gen++) + { + if (data[ipidx] < 0 || data[ipidx] >= commands.Count) { break; } + + var ip=data[ipidx]; + var cmd = commands[(int)ip]; + + if (ip == 28) + { + if (!possibilities.Contains(data[4])) + { + possibilities.Add(data[4]); + //data[4].Dump(); + best = data[4]; + } + var statehash = string.Join(";", data); + if (history.Contains(statehash)) { $"Loop after {gen} generations. Best is {best} with {possibilities.Count} candidates and a history size of {history.Count}".Dump(); return; } + history.Add(statehash); + } // this is if ([4] == [0]) EXIT + + cmd.Op.Item2(data, cmd); + data[ipidx]++; + + //$"{ip:00}:{cmd.Op.Item1} [{string.Join(" ", data.Take(6).Select(i => $"{i,-10}"))}]".Dump(); + } + + data[0].Dump(); +} + +(List, int) Load(string[] input) +{ + return + ( + input + .Skip(1) + .Where(i => !string.IsNullOrWhiteSpace(i)) + .Select(i => new Command { Name = i.Split(' ')[0], Op=Operations.Single(o => o.Item1.ToLower() == i.Split(' ')[0].ToLower()), Args = i.Split(' ').Skip(1).Select(int.Parse).ToArray() }) + .ToList(), + int.Parse(input[0].Split(' ')[1]) + ); +} + +/* + +#ip 1 +00: seti 123 0 4 [4] = 123 [4] = 123 [4] = 123 +01: bani 4 456 4 [4] = [4] & 456 1: [4] &= 456 [4] &= 456 +02: eqri 4 72 4 [4] = [4] == 72 if ([4]<>72) JMP 1 if ([4]<>72) ERROR +03: addr 4 1 1 IP = IP + [4] +04: seti 0 0 1 IP = 0 +05: seti 0 2 4 [4] = 0 [4] = 0 [4] = 0 for([4] = 0;;) +06: bori 4 65536 3 [3] = [4] | 65536 6: [3] = [4] | 65536 6: [3] = [4] | 65536 [3] = [4] | 65536 +07: seti 10552971 1 4 [4] = 10552971 [4] = 10552971 [4] = 10552971 [4] = 10552971 +08: bani 3 255 5 [5] = [3] & 255 8: [5] = [3] & 255 8: [5] = [3] & 255 for(;;) +09: addr 4 5 4 [4] = [4] + [5] [4] += [5] [4] += [5] [5] = [3] & 255 +10: bani 4 16777215 4 [4] = [4] & 16777215 [4] &= 16777215 [4] &= 16777215 [4] += [5] +11: muli 4 65899 4 [4] = [4] * 65899 [4] *= 65899 [4] *= 65899 [4] &= 16777215 +12: bani 4 16777215 4 [4] = [4] & 16777215 [4] &= 16777215 [4] &= 16777215 [4] *= 65899 +13: gtir 256 3 5 [5] = 256 > [3] if (256 > [3]) JMP 28 if (256 > [3] && [4] == [0]) EXIT [4] &= 16777215 +14: addr 5 1 1 IP = IP + [5] if (256 > [3]) JMP 6 if (256 > [3] && [4] == [0]) EXIT +15: addi 1 1 1 IP = IP + 1 if (256 > [3]) BREAK +16: seti 27 7 1 IP = 27 +17: seti 0 1 5 [5] = 0 [5] = 0 [5] = 0 +18: addi 5 1 2 [2] = [5] + 1 18: [2] = [5] + 1 18: [2] = [5] + 1 for([5]=0;;) +19: muli 2 256 2 [2] = [2] * 256 [2] *= 256 [2] *= 256 [2] = ([5] + 1) * 256 +20: gtrr 2 3 2 [2] = [2] > [3] if ([2] > [3]) JMP 26 if ([2] > [3]) [3] = [5]; JMP 8 +21: addr 2 1 1 IP = IP + [2] else [5]++ JMP 18 if ([2] > [3]) [3] = [5]; BREAK +22: addi 1 1 1 IP = IP + 1 else [5]++ CONTINUE +23: seti 25 0 1 IP = 25 +24: addi 5 1 5 [5] = [5] + 1 [5]++ +25: seti 17 2 1 IP = 17 JMP 18 +26: setr 5 7 3 [3] = [5] 26: [3] = [5] +27: seti 7 8 1 IP = 7 JMP 8 +28: eqrr 4 0 5 [5] = [4] == [0] 28: if ([4] == [0]) EXIT +29: addr 5 1 1 IP = IP + [5] else JMP 6 +30: seti 5 0 1 IP = 5 + +*/ \ No newline at end of file diff --git a/www/statics/aoc/2018/21_challenge.txt b/www/statics/aoc/2018/21_challenge.txt new file mode 100644 index 0000000..e22df63 --- /dev/null +++ b/www/statics/aoc/2018/21_challenge.txt @@ -0,0 +1,29 @@ +--- 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. + +If you keep up your current pace, you should have resolved all of the temporal anomalies by the next time the device activates. Since you have very little interest in browsing history in 500-year increments for the rest of your life, you need to find a way to get back to your present time. + +After a little research, you discover two important facts about the behavior of the device: + +First, you discover that the device is hard-wired to always send you back in time in 500-year increments. Changing this is probably not feasible. + +Second, you discover the activation system (your puzzle input) for the time travel module. Currently, it appears to run forever without halting. + +If you can cause the activation system to halt at a specific moment, maybe you can make the device send you so far back in time that you cause an integer underflow in time itself and wrap around back to your current time! + +The device executes the program as specified in manual section one and manual section two. + +Your goal is to figure out how the program works and cause it to halt. You can only control register 0; every other register begins at 0 as usual. + +Because time travel is a dangerous activity, the activation system begins with a few instructions which verify that bitwise AND (via bani) does a numeric operation and not an operation as if the inputs were interpreted as strings. If the test fails, it enters an infinite loop re-running the test instead of allowing the program to execute normally. If the test passes, the program continues, and assumes that all other bitwise operations (banr, bori, and borr) also interpret their inputs as numbers. (Clearly, the Elves who wrote this system were worried that someone might introduce a bug while trying to emulate this system with a scripting language.) + +What is the lowest non-negative integer value for register 0 that causes the program to halt after executing the fewest instructions? (Executing the same instruction multiple times counts as multiple instructions executed.) + +--- Part Two --- + +In order to determine the timing window for your underflow exploit, you also need an upper bound: + +What is the lowest non-negative integer value for register 0 that causes the program to halt after executing the most instructions? (The program must actually halt; running forever does not count as halting.) diff --git a/www/statics/aoc/2018/21_input.txt b/www/statics/aoc/2018/21_input.txt new file mode 100644 index 0000000..c6e6f2f --- /dev/null +++ b/www/statics/aoc/2018/21_input.txt @@ -0,0 +1,32 @@ +#ip 1 +seti 123 0 4 +bani 4 456 4 +eqri 4 72 4 +addr 4 1 1 +seti 0 0 1 +seti 0 2 4 +bori 4 65536 3 +seti 10552971 1 4 +bani 3 255 5 +addr 4 5 4 +bani 4 16777215 4 +muli 4 65899 4 +bani 4 16777215 4 +gtir 256 3 5 +addr 5 1 1 +addi 1 1 1 +seti 27 7 1 +seti 0 1 5 +addi 5 1 2 +muli 2 256 2 +gtrr 2 3 2 +addr 2 1 1 +addi 1 1 1 +seti 25 0 1 +addi 5 1 5 +seti 17 2 1 +setr 5 7 3 +seti 7 8 1 +eqrr 4 0 5 +addr 5 1 1 +seti 5 0 1 diff --git a/www/statics/aoc/2018/22-1.linq b/www/statics/aoc/2018/22-1.linq new file mode 100644 index 0000000..8573fd9 --- /dev/null +++ b/www/statics/aoc/2018/22-1.linq @@ -0,0 +1,50 @@ + + +void Main() +{ + var input = File.ReadAllLines(Path.Combine(Path.GetDirectoryName(Util.CurrentQueryPath), @"22_input.txt")); + + var depth = long.Parse(input[0].Split(' ')[1]); + (long x, long y) target = ( long.Parse(input[1].Split(' ')[1].Split(',')[0]), long.Parse(input[1].Split(' ')[1].Split(',')[1]) ); + + long[,] map = new long[target.x + 1, target.y + 1]; // erosion_level + + for (long xx = 0; xx <= target.x; xx++) map[xx, 0] = ((xx * 16807) + depth) % 20183; + for (long yy = 0; yy <= target.y; yy++) map[0, yy] = ((yy * 48271) + depth) % 20183; + + for (long x = 1; x <= target.x; x++) + { + for (long y = 1; y <= target.y; y++) + { + map[x, y] = ((map[x-1, y] * map[x, y-1]) + depth) % 20183; + } + } + + long risk = 0; + for (long x = 0; x <= target.x; x++) + { + for (long y = 0; y <= target.y; y++) + { + if (x == 0 && y == 0) continue; + if (x == target.x && y == target.y) continue; + risk += map[x,y] % 3; + } + } + + risk.Dump(); + + //StringBuilder b = new StringBuilder(); + //for (long y = 0; y <= target.y; y++) + //{ + // for (long x = 0; x <= target.x; x++) + // { + // if (map[x, y] % 3 == 0) b.Append('.'); + // if (map[x, y] % 3 == 1) b.Append('='); + // if (map[x, y] % 3 == 2) b.Append('|'); + // } + // b.AppendLine(); + //} + //b.ToString().Dump(); +} + +// Define other methods and classes here diff --git a/www/statics/aoc/2018/22-2.linq b/www/statics/aoc/2018/22-2.linq new file mode 100644 index 0000000..b3baa44 --- /dev/null +++ b/www/statics/aoc/2018/22-2.linq @@ -0,0 +1,88 @@ + + +void Main() +{ + const int expand = 2; + + const int T_ROCKY = 0; + const int T_WET = 1; + const int T_NARROW = 2; + const int G_NEITHER = 0; + const int G_TORCH = 1; + const int G_GEAR = 2; + + var input = File.ReadAllLines(Path.Combine(Path.GetDirectoryName(Util.CurrentQueryPath), @"22_input.txt")); + + var depth = long.Parse(input[0].Split(' ')[1]); + (long x, long y) target = (long.Parse(input[1].Split(' ')[1].Split(',')[0]), long.Parse(input[1].Split(' ')[1].Split(',')[1])); + + var width = target.x * expand + 1; + var height = target.y * expand + 1; + + long[,] map = new long[width, height]; // erosion_level + + for (long xx = 0; xx < width; xx++) map[xx, 0] = ((xx * 16807) + depth) % 20183; + for (long yy = 0; yy < height; yy++) map[0, yy] = ((yy * 48271) + depth) % 20183; + + for (long x = 1; x < width; x++) + { + for (long y = 1; y < height; y++) + { + map[x, y] = ((map[x-1, y] * map[x, y-1]) + depth) % 20183; + } + } + + int[,] typemap = new int[width, height]; + + for (long x = 0; x < width; x++) for (long y = 0; y < height; y++) typemap[x,y] = (int)(map[x,y] % 3); + typemap[target.x, target.y] = 0; + + bool[,] validity = new bool[3, 3]; + validity[T_ROCKY, G_NEITHER] = false; + validity[T_ROCKY, G_TORCH] = true; + validity[T_ROCKY, G_GEAR] = true; + validity[T_WET, G_NEITHER] = true; + validity[T_WET, G_TORCH] = false; + validity[T_WET, G_GEAR] = true; + validity[T_NARROW, G_NEITHER] = true; + validity[T_NARROW, G_TORCH] = true; + validity[T_NARROW, G_GEAR] = false; + + + int?[,,] distance = new int?[width, height, 3]; + distance[0,0,1] = 0; + + var work = new Queue<(int, int, int)>(); + work.Enqueue((0,0,1)); + while (work.Any()) + { + (var px, var py, var pt) = work.Dequeue(); + var dist = distance[px,py,pt]; + + //LEFT + if (px>0 && validity[typemap[px-1,py], pt] && (distance[px-1,py,pt]==null || distance[px-1,py,pt]>dist+1)) { distance[px-1,py,pt]=dist+1; if (!work.Contains((px-1,py,pt))) work.Enqueue((px-1,py,pt)); } + + //UP + if (py>0 && validity[typemap[px,py-1], pt] && (distance[px,py-1,pt]==null || distance[px,py-1,pt]>dist+1)) { distance[px,py-1,pt]=dist+1; if (!work.Contains((px,py-1,pt))) work.Enqueue((px,py-1,pt)); } + + //RIGHT + if (px+1dist+1)) { distance[px+1,py,pt]=dist+1; if (!work.Contains((px+1,py,pt))) work.Enqueue((px+1,py,pt)); } + + //DOWN + if (py+1dist+1)) { distance[px,py+1,pt]=dist+1; if (!work.Contains((px,py+1,pt))) work.Enqueue((px,py+1,pt)); } + + //NEITHER + if (pt != G_NEITHER && validity[typemap[px,py], G_NEITHER] && (distance[px,py,G_NEITHER]==null || distance[px,py,G_NEITHER]>dist+7)) { distance[px,py,G_NEITHER]=dist+7; if (!work.Contains((px,py,G_NEITHER))) work.Enqueue((px,py,G_NEITHER)); } + + //TORCH + if (pt != G_TORCH && validity[typemap[px,py], G_TORCH] && (distance[px,py,G_TORCH]==null || distance[px,py,G_TORCH]>dist+7)) { distance[px,py,G_TORCH]=dist+7; if (!work.Contains((px,py,G_TORCH))) work.Enqueue((px,py,G_TORCH)); } + + //GEAR + if (pt != G_GEAR && validity[typemap[px,py], G_GEAR] && (distance[px,py,G_GEAR]==null || distance[px,py,G_GEAR]>dist+7)) { distance[px,py,G_GEAR]=dist+7; if (!work.Contains((px,py,G_GEAR))) work.Enqueue((px,py,G_GEAR)); } + } + + distance[target.x, target.y, G_TORCH].Dump(); + +} + +// Define other methods and classes here \ No newline at end of file diff --git a/www/statics/aoc/2018/22_challenge.txt b/www/statics/aoc/2018/22_challenge.txt new file mode 100644 index 0000000..d0f3f4b --- /dev/null +++ b/www/statics/aoc/2018/22_challenge.txt @@ -0,0 +1,336 @@ +--- 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. + +After talking for a while, he asks a favor of you. His friend hasn't come back in a few hours, and he's not sure where he is. Scanning the region briefly, you discover one life signal in a cave system nearby; his friend must have taken shelter there. The man asks if you can go there to retrieve his friend. + +The cave is divided into square regions which are either dominantly rocky, narrow, or wet (called its type). Each region occupies exactly one coordinate in X,Y format where X and Y are integers and zero or greater. (Adjacent regions can be the same type.) + +The scan (your puzzle input) is not very detailed: it only reveals the depth of the cave system and the coordinates of the target. However, it does not reveal the type of each region. The mouth of the cave is at 0,0. + +The man explains that due to the unusual geology in the area, there is a method to determine any region's type based on its erosion level. The erosion level of a region can be determined from its geologic index. The geologic index can be determined using the first rule that applies from the list below: + + The region at 0,0 (the mouth of the cave) has a geologic index of 0. + The region at the coordinates of the target has a geologic index of 0. + If the region's Y coordinate is 0, the geologic index is its X coordinate times 16807. + If the region's X coordinate is 0, the geologic index is its Y coordinate times 48271. + Otherwise, the region's geologic index is the result of multiplying the erosion levels of the regions at X-1,Y and X,Y-1. + +A region's erosion level is its geologic index plus the cave system's depth, all modulo 20183. Then: + + If the erosion level modulo 3 is 0, the region's type is rocky. + If the erosion level modulo 3 is 1, the region's type is wet. + If the erosion level modulo 3 is 2, the region's type is narrow. + +For example, suppose the cave system's depth is 510 and the target's coordinates are 10,10. Using % to represent the modulo operator, the cavern would look as follows: + + At 0,0, the geologic index is 0. The erosion level is (0 + 510) % 20183 = 510. The type is 510 % 3 = 0, rocky. + At 1,0, because the Y coordinate is 0, the geologic index is 1 * 16807 = 16807. The erosion level is (16807 + 510) % 20183 = 17317. The type is 17317 % 3 = 1, wet. + At 0,1, because the X coordinate is 0, the geologic index is 1 * 48271 = 48271. The erosion level is (48271 + 510) % 20183 = 8415. The type is 8415 % 3 = 0, rocky. + At 1,1, neither coordinate is 0 and it is not the coordinate of the target, so the geologic index is the erosion level of 0,1 (8415) times the erosion level of 1,0 (17317), 8415 * 17317 = 145722555. The erosion level is (145722555 + 510) % 20183 = 1805. The type is 1805 % 3 = 2, narrow. + At 10,10, because they are the target's coordinates, the geologic index is 0. The erosion level is (0 + 510) % 20183 = 510. The type is 510 % 3 = 0, rocky. + +Drawing this same cave system with rocky as ., wet as =, narrow as |, the mouth as M, the target as T, with 0,0 in the top-left corner, X increasing to the right, and Y increasing downward, the top-left corner of the map looks like this: + +M=.|=.|.|=.|=|=. +.|=|=|||..|.=... +.==|....||=..|== +=.|....|.==.|==. +=|..==...=.|==.. +=||.=.=||=|=..|= +|.=.===|||..=..| +|..==||=.|==|=== +.=..===..=|.|||. +.======|||=|=.|= +.===|=|===T===|| +=|||...|==..|=.| +=.=|=.=..=.||==| +||=|=...|==.=|== +|=.=||===.|||=== +||.|==.|.|.||=|| + +Before you go in, you should determine the risk level of the area. For the the rectangle that has a top-left corner of region 0,0 and a bottom-right corner of the region containing the target, add up the risk level of each individual region: 0 for rocky regions, 1 for wet regions, and 2 for narrow regions. + +In the cave system above, because the mouth is at 0,0 and the target is at 10,10, adding up the risk level of all regions with an X coordinate from 0 to 10 and a Y coordinate from 0 to 10, this total is 114. + +What is the total risk level for the smallest rectangle that includes 0,0 and the target's coordinates? + +--- Part Two --- + +Okay, it's time to go rescue the man's friend. + +As you leave, he hands you some tools: a torch and some climbing gear. You can't equip both tools at once, but you can choose to use neither. + +Tools can only be used in certain regions: + + In rocky regions, you can use the climbing gear or the torch. You cannot use neither (you'll likely slip and fall). + In wet regions, you can use the climbing gear or neither tool. You cannot use the torch (if it gets wet, you won't have a light source). + In narrow regions, you can use the torch or neither tool. You cannot use the climbing gear (it's too bulky to fit). + +You start at 0,0 (the mouth of the cave) with the torch equipped and must reach the target coordinates as quickly as possible. The regions with negative X or Y are solid rock and cannot be traversed. The fastest route might involve entering regions beyond the X or Y coordinate of the target. + +You can move to an adjacent region (up, down, left, or right; never diagonally) if your currently equipped tool allows you to enter that region. Moving to an adjacent region takes one minute. (For example, if you have the torch equipped, you can move between rocky and narrow regions, but cannot enter wet regions.) + +You can change your currently equipped tool or put both away if your new equipment would be valid for your current region. Switching to using the climbing gear, torch, or neither always takes seven minutes, regardless of which tools you start with. (For example, if you are in a rocky region, you can switch from the torch to the climbing gear, but you cannot switch to neither.) + +Finally, once you reach the target, you need the torch equipped before you can find him in the dark. The target is always in a rocky region, so if you arrive there with climbing gear equipped, you will need to spend seven minutes switching to your torch. + +For example, using the same cave system as above, starting in the top left corner (0,0) and moving to the bottom right corner (the target, 10,10) as quickly as possible, one possible route is as follows, with your current position marked X: + +Initially: +X=.|=.|.|=.|=|=. +.|=|=|||..|.=... +.==|....||=..|== +=.|....|.==.|==. +=|..==...=.|==.. +=||.=.=||=|=..|= +|.=.===|||..=..| +|..==||=.|==|=== +.=..===..=|.|||. +.======|||=|=.|= +.===|=|===T===|| +=|||...|==..|=.| +=.=|=.=..=.||==| +||=|=...|==.=|== +|=.=||===.|||=== +||.|==.|.|.||=|| + +Down: +M=.|=.|.|=.|=|=. +X|=|=|||..|.=... +.==|....||=..|== +=.|....|.==.|==. +=|..==...=.|==.. +=||.=.=||=|=..|= +|.=.===|||..=..| +|..==||=.|==|=== +.=..===..=|.|||. +.======|||=|=.|= +.===|=|===T===|| +=|||...|==..|=.| +=.=|=.=..=.||==| +||=|=...|==.=|== +|=.=||===.|||=== +||.|==.|.|.||=|| + +Right: +M=.|=.|.|=.|=|=. +.X=|=|||..|.=... +.==|....||=..|== +=.|....|.==.|==. +=|..==...=.|==.. +=||.=.=||=|=..|= +|.=.===|||..=..| +|..==||=.|==|=== +.=..===..=|.|||. +.======|||=|=.|= +.===|=|===T===|| +=|||...|==..|=.| +=.=|=.=..=.||==| +||=|=...|==.=|== +|=.=||===.|||=== +||.|==.|.|.||=|| + +Switch from using the torch to neither tool: +M=.|=.|.|=.|=|=. +.X=|=|||..|.=... +.==|....||=..|== +=.|....|.==.|==. +=|..==...=.|==.. +=||.=.=||=|=..|= +|.=.===|||..=..| +|..==||=.|==|=== +.=..===..=|.|||. +.======|||=|=.|= +.===|=|===T===|| +=|||...|==..|=.| +=.=|=.=..=.||==| +||=|=...|==.=|== +|=.=||===.|||=== +||.|==.|.|.||=|| + +Right 3: +M=.|=.|.|=.|=|=. +.|=|X|||..|.=... +.==|....||=..|== +=.|....|.==.|==. +=|..==...=.|==.. +=||.=.=||=|=..|= +|.=.===|||..=..| +|..==||=.|==|=== +.=..===..=|.|||. +.======|||=|=.|= +.===|=|===T===|| +=|||...|==..|=.| +=.=|=.=..=.||==| +||=|=...|==.=|== +|=.=||===.|||=== +||.|==.|.|.||=|| + +Switch from using neither tool to the climbing gear: +M=.|=.|.|=.|=|=. +.|=|X|||..|.=... +.==|....||=..|== +=.|....|.==.|==. +=|..==...=.|==.. +=||.=.=||=|=..|= +|.=.===|||..=..| +|..==||=.|==|=== +.=..===..=|.|||. +.======|||=|=.|= +.===|=|===T===|| +=|||...|==..|=.| +=.=|=.=..=.||==| +||=|=...|==.=|== +|=.=||===.|||=== +||.|==.|.|.||=|| + +Down 7: +M=.|=.|.|=.|=|=. +.|=|=|||..|.=... +.==|....||=..|== +=.|....|.==.|==. +=|..==...=.|==.. +=||.=.=||=|=..|= +|.=.===|||..=..| +|..==||=.|==|=== +.=..X==..=|.|||. +.======|||=|=.|= +.===|=|===T===|| +=|||...|==..|=.| +=.=|=.=..=.||==| +||=|=...|==.=|== +|=.=||===.|||=== +||.|==.|.|.||=|| + +Right: +M=.|=.|.|=.|=|=. +.|=|=|||..|.=... +.==|....||=..|== +=.|....|.==.|==. +=|..==...=.|==.. +=||.=.=||=|=..|= +|.=.===|||..=..| +|..==||=.|==|=== +.=..=X=..=|.|||. +.======|||=|=.|= +.===|=|===T===|| +=|||...|==..|=.| +=.=|=.=..=.||==| +||=|=...|==.=|== +|=.=||===.|||=== +||.|==.|.|.||=|| + +Down 3: +M=.|=.|.|=.|=|=. +.|=|=|||..|.=... +.==|....||=..|== +=.|....|.==.|==. +=|..==...=.|==.. +=||.=.=||=|=..|= +|.=.===|||..=..| +|..==||=.|==|=== +.=..===..=|.|||. +.======|||=|=.|= +.===|=|===T===|| +=|||.X.|==..|=.| +=.=|=.=..=.||==| +||=|=...|==.=|== +|=.=||===.|||=== +||.|==.|.|.||=|| + +Right: +M=.|=.|.|=.|=|=. +.|=|=|||..|.=... +.==|....||=..|== +=.|....|.==.|==. +=|..==...=.|==.. +=||.=.=||=|=..|= +|.=.===|||..=..| +|..==||=.|==|=== +.=..===..=|.|||. +.======|||=|=.|= +.===|=|===T===|| +=|||..X|==..|=.| +=.=|=.=..=.||==| +||=|=...|==.=|== +|=.=||===.|||=== +||.|==.|.|.||=|| + +Down: +M=.|=.|.|=.|=|=. +.|=|=|||..|.=... +.==|....||=..|== +=.|....|.==.|==. +=|..==...=.|==.. +=||.=.=||=|=..|= +|.=.===|||..=..| +|..==||=.|==|=== +.=..===..=|.|||. +.======|||=|=.|= +.===|=|===T===|| +=|||...|==..|=.| +=.=|=.X..=.||==| +||=|=...|==.=|== +|=.=||===.|||=== +||.|==.|.|.||=|| + +Right 4: +M=.|=.|.|=.|=|=. +.|=|=|||..|.=... +.==|....||=..|== +=.|....|.==.|==. +=|..==...=.|==.. +=||.=.=||=|=..|= +|.=.===|||..=..| +|..==||=.|==|=== +.=..===..=|.|||. +.======|||=|=.|= +.===|=|===T===|| +=|||...|==..|=.| +=.=|=.=..=X||==| +||=|=...|==.=|== +|=.=||===.|||=== +||.|==.|.|.||=|| + +Up 2: +M=.|=.|.|=.|=|=. +.|=|=|||..|.=... +.==|....||=..|== +=.|....|.==.|==. +=|..==...=.|==.. +=||.=.=||=|=..|= +|.=.===|||..=..| +|..==||=.|==|=== +.=..===..=|.|||. +.======|||=|=.|= +.===|=|===X===|| +=|||...|==..|=.| +=.=|=.=..=.||==| +||=|=...|==.=|== +|=.=||===.|||=== +||.|==.|.|.||=|| + +Switch from using the climbing gear to the torch: +M=.|=.|.|=.|=|=. +.|=|=|||..|.=... +.==|....||=..|== +=.|....|.==.|==. +=|..==...=.|==.. +=||.=.=||=|=..|= +|.=.===|||..=..| +|..==||=.|==|=== +.=..===..=|.|||. +.======|||=|=.|= +.===|=|===X===|| +=|||...|==..|=.| +=.=|=.=..=.||==| +||=|=...|==.=|== +|=.=||===.|||=== +||.|==.|.|.||=|| + +This is tied with other routes as the fastest way to reach the target: 45 minutes. In it, 21 minutes are spent switching tools (three times, seven minutes each) and the remaining 24 minutes are spent moving. + +What is the fewest number of minutes you can take to reach the target? diff --git a/www/statics/aoc/2018/22_input.txt b/www/statics/aoc/2018/22_input.txt new file mode 100644 index 0000000..f8920db --- /dev/null +++ b/www/statics/aoc/2018/22_input.txt @@ -0,0 +1,2 @@ +depth: 5355 +target: 14,796 \ No newline at end of file diff --git a/www/statics/aoc/2018/23-1.linq b/www/statics/aoc/2018/23-1.linq new file mode 100644 index 0000000..8e75003 --- /dev/null +++ b/www/statics/aoc/2018/23-1.linq @@ -0,0 +1,16 @@ + + +var input = File.ReadAllLines(Path.Combine(Path.GetDirectoryName(Util.CurrentQueryPath), @"23_input.txt")) + .Where(p => !string.IsNullOrWhiteSpace(p)) + .Select(p => new + { + X = int.Parse(p.Split(' ')[0].Substring(5).Split(',')[0].Trim(new[] { ' ', '<', '>', ',' })), + Y = int.Parse(p.Split(' ')[0].Substring(5).Split(',')[1].Trim(new[] { ' ', '<', '>', ',' })), + Z = int.Parse(p.Split(' ')[0].Substring(5).Split(',')[2].Trim(new[] { ' ', '<', '>', ',' })), + R = int.Parse(p.Split(' ')[1].Substring(2).Trim(new[] { ' ', '<', '>', ',' })), + }) + .ToList(); + + var max = input.OrderByDescending(p => p.R).First(); + + input.Count(i => Math.Abs(i.X-max.X) + Math.Abs(i.Y-max.Y) + Math.Abs(i.Z-max.Z) <= max.R).Dump(); \ No newline at end of file diff --git a/www/statics/aoc/2018/23-2.linq b/www/statics/aoc/2018/23-2.linq new file mode 100644 index 0000000..e7e9197 --- /dev/null +++ b/www/statics/aoc/2018/23-2.linq @@ -0,0 +1,77 @@ + + +class C3 { public long X, Y, Z; } + +void Main() +{ + var input = File.ReadAllLines(Path.Combine(Path.GetDirectoryName(Util.CurrentQueryPath), @"23_input.txt")) + .Where(p => !string.IsNullOrWhiteSpace(p)) + .Select(p => new + { + X = long.Parse(p.Split(' ')[0].Substring(5).Split(',')[0].Trim(new[] { ' ', '<', '>', ',' })), + Y = long.Parse(p.Split(' ')[0].Substring(5).Split(',')[1].Trim(new[] { ' ', '<', '>', ',' })), + Z = long.Parse(p.Split(' ')[0].Substring(5).Split(',')[2].Trim(new[] { ' ', '<', '>', ',' })), + R = long.Parse(p.Split(' ')[1].Substring(2).Trim(new[] { ' ', '<', '>', ',' })), + }) + .ToList(); + + var x_min = input.Min(i => i.X); + var x_max = input.Max(i => i.X); + var y_min = input.Min(i => i.Y); + var y_max = input.Max(i => i.Y); + var z_min = input.Min(i => i.Z); + var z_max = input.Max(i => i.Z); + + long dist = 1; + for (; dist < x_max - x_min; dist *= 2) ; + + long target_count = 0; + C3 best = null; + long? best_val = null; + + for (; dist > 0;) + { + target_count = 0; + best = null; + best_val = null; + + for (long x = x_min; x <= x_max; x += dist) + { + for (long y = y_min; y <= y_max; y += dist) + { + for (long z = z_min; z <= z_max; z += dist) + { + var count = 0; + foreach (var b in input) + { + var calc = Math.Abs(x - b.X) + Math.Abs(y - b.Y) + Math.Abs(z - b.Z); + if ((calc - b.R) / dist <= 0) count++; + } + if (count > target_count) + { + target_count = count; + best_val = Math.Abs(x) + Math.Abs(y) + Math.Abs(z); + best = new C3 { X = x, Y = y, Z = z }; + } + else if (count == target_count) + { + if (Math.Abs(x) + Math.Abs(y) + Math.Abs(z) < best_val) + { + best_val = Math.Abs(x) + Math.Abs(y) + Math.Abs(z); + best = new C3 { X = x, Y = y, Z = z }; + } + } + } + } + } + + x_min = best.X - dist; + x_max = best.X + dist; + y_min = best.Y - dist; + y_max = best.Y + dist; + z_min = best.Z - dist; + z_max = best.Z + dist; + dist /= 2; + } + best_val.Dump(); +} diff --git a/www/statics/aoc/2018/23_challenge.txt b/www/statics/aoc/2018/23_challenge.txt new file mode 100644 index 0000000..e131a6e --- /dev/null +++ b/www/statics/aoc/2018/23_challenge.txt @@ -0,0 +1,60 @@ +--- 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. + +The only option is experimental emergency teleportation. + +You hit the "experimental emergency teleportation" button on the device and push I accept the risk on no fewer than 18 different warning messages. Immediately, the device deploys hundreds of tiny nanobots which fly around the cavern, apparently assembling themselves into a very specific formation. The device lists the X,Y,Z position (pos) for each nanobot as well as its signal radius (r) on its tiny screen (your puzzle input). + +Each nanobot can transmit signals to any integer coordinate which is a distance away from it less than or equal to its signal radius (as measured by Manhattan distance). Coordinates a distance away of less than or equal to a nanobot's signal radius are said to be in range of that nanobot. + +Before you start the teleportation process, you should determine which nanobot is the strongest (that is, which has the largest signal radius) and then, for that nanobot, the total number of nanobots that are in range of it, including itself. + +For example, given the following nanobots: + +pos=<0,0,0>, r=4 +pos=<1,0,0>, r=1 +pos=<4,0,0>, r=3 +pos=<0,2,0>, r=1 +pos=<0,5,0>, r=3 +pos=<0,0,3>, r=1 +pos=<1,1,1>, r=1 +pos=<1,1,2>, r=1 +pos=<1,3,1>, r=1 + +The strongest nanobot is the first one (position 0,0,0) because its signal radius, 4 is the largest. Using that nanobot's location and signal radius, the following nanobots are in or out of range: + + The nanobot at 0,0,0 is distance 0 away, and so it is in range. + The nanobot at 1,0,0 is distance 1 away, and so it is in range. + The nanobot at 4,0,0 is distance 4 away, and so it is in range. + The nanobot at 0,2,0 is distance 2 away, and so it is in range. + The nanobot at 0,5,0 is distance 5 away, and so it is not in range. + The nanobot at 0,0,3 is distance 3 away, and so it is in range. + The nanobot at 1,1,1 is distance 3 away, and so it is in range. + The nanobot at 1,1,2 is distance 4 away, and so it is in range. + The nanobot at 1,3,1 is distance 5 away, and so it is not in range. + +In this example, in total, 7 nanobots are in range of the nanobot with the largest signal radius. + +Find the nanobot with the largest signal radius. How many nanobots are in range of its signals? + +--- Part Two --- + +Now, you just need to figure out where to position yourself so that you're actually teleported when the nanobots activate. + +To increase the probability of success, you need to find the coordinate which puts you in range of the largest number of nanobots. If there are multiple, choose one closest to your position (0,0,0, measured by manhattan distance). + +For example, given the following nanobot formation: + +pos=<10,12,12>, r=2 +pos=<12,14,12>, r=2 +pos=<16,12,12>, r=4 +pos=<14,14,14>, r=6 +pos=<50,50,50>, r=200 +pos=<10,10,10>, r=5 + +Many coordinates are in range of some of the nanobots in this formation. However, only the coordinate 12,12,12 is in range of the most nanobots: it is in range of the first five, but is not in range of the nanobot at 10,10,10. (All other coordinates are in range of fewer than five nanobots.) This coordinate's distance from 0,0,0 is 36. + +Find the coordinates that are in range of the largest number of nanobots. What is the shortest manhattan distance between any of those points and 0,0,0? diff --git a/www/statics/aoc/2018/23_input.txt b/www/statics/aoc/2018/23_input.txt new file mode 100644 index 0000000..2c0b84f --- /dev/null +++ b/www/statics/aoc/2018/23_input.txt @@ -0,0 +1,1000 @@ +pos=<35736475,5268315,44141623>, r=68945144 +pos=<98249648,35180107,46324866>, r=99363158 +pos=<-33547541,25677708,29822965>, r=91044586 +pos=<18997357,27435558,22203548>, r=51976657 +pos=<9999306,44070497,46228534>, r=60389933 +pos=<-11232017,15711495,38725419>, r=69792763 +pos=<69735987,47669658,46708342>, r=57976671 +pos=<108348247,48092549,46991236>, r=95882854 +pos=<29616366,30343943,25580230>, r=56310558 +pos=<55771892,34986939,14417116>, r=88986230 +pos=<-4076452,46003840,-27660246>, r=98730882 +pos=<37806127,35544433,26100531>, r=58779554 +pos=<28537325,-29968211,43996784>, r=97127437 +pos=<175944061,22745049,18215615>, r=83019610 +pos=<-7518172,50302588,20566683>, r=51741591 +pos=<32973385,102732735,26399661>, r=93414748 +pos=<27566699,32225307,2735607>, r=75224145 +pos=<90765957,45380919,68169326>, r=99066859 +pos=<17439378,-23734545,29591571>, r=94200997 +pos=<37348398,35907697,1171310>, r=82887984 +pos=<16668596,17585024,30949266>, r=50752838 +pos=<43294910,55011497,6547354>, r=75867319 +pos=<-39687235,73312930,41074953>, r=86412726 +pos=<77600061,52837446,45466783>, r=69078996 +pos=<79847020,47470311,46895275>, r=68099888 +pos=<41161959,-11459287,37418030>, r=97821876 +pos=<55243809,26266628,37349576>, r=74246269 +pos=<28554372,56539455,11790628>, r=57411682 +pos=<35376754,77309282,68931747>, r=68620223 +pos=<80333063,47281103,44270109>, r=71400211 +pos=<26282613,18846337,19865708>, r=70189108 +pos=<81162185,36811904,29601881>, r=97366760 +pos=<76518508,39246657,43222325>, r=76667967 +pos=<49483399,13072223,23782144>, r=95247770 +pos=<75407008,32771443,67266045>, r=95414250 +pos=<20396216,32874538,18115050>, r=52025144 +pos=<47518497,34143968,14694996>, r=81297906 +pos=<58121018,46842064,20052637>, r=73844744 +pos=<-25482904,58405932,58752491>, r=60023043 +pos=<2414899,74909973,18437390>, r=68545229 +pos=<93399797,56430242,41827270>, r=92111574 +pos=<22057772,29819687,42910507>, r=84744225 +pos=<58887283,37744860,27213147>, r=76547677 +pos=<20511261,12176609,40616709>, r=50336418 +pos=<27531206,5567327,11585926>, r=92996314 +pos=<-11888301,36803758,23995873>, r=64086479 +pos=<55138614,6254749,54369165>, r=88765526 +pos=<27689879,48020738,33552377>, r=70404742 +pos=<17399375,22091331,11617566>, r=66308859 +pos=<-30063622,12388637,40670912>, r=90001755 +pos=<35362839,37222182,9170045>, r=71588990 +pos=<203530720,40857437,31304618>, r=97936573 +pos=<71684320,41513849,32460452>, r=80328463 +pos=<6832912,17923279,-10870456>, r=99111947 +pos=<70541337,40514901,23109870>, r=89534942 +pos=<-22356418,22728990,45454279>, r=67170798 +pos=<21116887,35329043,40481972>, r=74431257 +pos=<31626078,42426499,2331845>, r=69486096 +pos=<64317834,61658521,38180749>, r=71903858 +pos=<-52795703,46719036,38718342>, r=80355995 +pos=<52774899,78131860,28428556>, r=86586505 +pos=<32215639,16811727,25393141>, r=72629218 +pos=<21974048,46228429,-17810448>, r=76175002 +pos=<59234315,42744200,40747201>, r=58361302 +pos=<50620475,95139824,34221129>, r=95647436 +pos=<31524663,83545637,36393296>, r=62785299 +pos=<-43702001,60251514,32749670>, r=85692014 +pos=<47014566,71579815,66754620>, r=72351399 +pos=<71588604,22705912,35843016>, r=95658127 +pos=<88518450,40216724,54752646>, r=88566919 +pos=<-60378893,29488684,44404684>, r=99483294 +pos=<-11101653,79245668,34873217>, r=69961698 +pos=<44936915,20055145,71895444>, r=82289701 +pos=<-44992958,47946287,40495699>, r=69548743 +pos=<46823746,44888999,1056656>, r=83496494 +pos=<-36025436,54507898,22026426>, r=82994433 +pos=<20587527,-24964792,34210791>, r=93959974 +pos=<-147275777,18337543,40032704>, r=74216227 +pos=<41111909,-13140154,40504911>, r=96365562 +pos=<28252618,41639354,43825267>, r=79119691 +pos=<64777674,43642375,38465261>, r=65289045 +pos=<50314871,48086008,33304117>, r=51543138 +pos=<52803279,52187826,33480017>, r=55619426 +pos=<42764327,22650241,12311998>, r=90420773 +pos=<36024431,23059804,20110184>, r=75472847 +pos=<65070465,24199205,24785446>, r=98704248 +pos=<21614823,44943481,40873083>, r=78906127 +pos=<42135803,45316305,7170286>, r=72267592 +pos=<60338695,24596400,68535461>, r=89790637 +pos=<91847494,36602917,44174167>, r=93688975 +pos=<42617883,45456599,2364062>, r=77415614 +pos=<-17900452,26264040,46075639>, r=58558593 +pos=<23065024,54683026,44912280>, r=79925134 +pos=<7393618,13065147,24339203>, r=68199956 +pos=<66409579,61821152,55522004>, r=70755419 +pos=<-16465303,31827246,46650925>, r=50984786 +pos=<63652634,35204424,42567838>, r=68499244 +pos=<-33503704,33700462,30229837>, r=82571056 +pos=<28323023,71484327,26373493>, r=57542097 +pos=<28638640,42039332,41138992>, r=52702802 +pos=<71640578,37211073,21580686>, r=95467266 +pos=<-41000570,46965324,40040080>, r=66992886 +pos=<76894429,46086205,25958626>, r=87468098 +pos=<-2104680,19136731,39740387>, r=56225317 +pos=<-24197801,50664690,29123122>, r=60226968 +pos=<78990123,45644865,29732704>, r=86230964 +pos=<-75727029,44926164,44902145>, r=98896354 +pos=<31308722,45558616,9895068>, r=58473693 +pos=<4366402,38123986,47281720>, r=95230204 +pos=<95625327,59551444,-77297749>, r=57341892 +pos=<62785679,81502394,31308615>, r=97087863 +pos=<-15796059,72916646,38179244>, r=65020985 +pos=<18491161,-132636,19831409>, r=81410854 +pos=<23872265,29672987,5867691>, r=70950377 +pos=<70800264,78761297,46375689>, r=87294333 +pos=<29356716,5693454,18985832>, r=87296130 +pos=<24908148,26208701,2213603>, r=79104220 +pos=<66837058,30632466,35443185>, r=83379848 +pos=<34758918,14455953,51851302>, r=57666779 +pos=<54033957,17306737,38736710>, r=80609003 +pos=<48708931,41607919,37147697>, r=52571767 +pos=<-589665,74402116,82826728>, r=75200417 +pos=<104827312,44510775,45564490>, r=97370611 +pos=<16914008,-5653659,34384768>, r=70801459 +pos=<20021121,-10501160,45627107>, r=67513655 +pos=<26852275,85491857,44735094>, r=51717310 +pos=<17505657,7026134,65101229>, r=61093244 +pos=<-55850355,27721263,54572745>, r=98593809 +pos=<90722224,39374348,46408572>, r=87557755 +pos=<75712788,47079590,41284423>, r=69967135 +pos=<-20098667,80444558,16622292>, r=98408534 +pos=<-6183342,53541207,-17315146>, r=91527240 +pos=<74050808,67317078,33746975>, r=91729179 +pos=<54343750,38615989,93193128>, r=94433797 +pos=<-5682328,86361229,20285787>, r=86245296 +pos=<62616200,14021719,39538183>, r=91674704 +pos=<18076520,56782799,72306919>, r=99500690 +pos=<25035042,46689028,-14950654>, r=75915233 +pos=<44009109,28898114,41196461>, r=56532945 +pos=<-37907339,58047707,13717933>, r=96724811 +pos=<-187456522,36438102,43373346>, r=67272291 +pos=<42609408,29331524,12947311>, r=82949011 +pos=<-34091899,66998918,59222950>, r=77695659 +pos=<21320292,30995210,18116462>, r=54827457 +pos=<-35162362,37777932,13653808>, r=96728256 +pos=<-28240962,57549303,36590434>, r=63687396 +pos=<53576376,36200124,36144896>, r=63849798 +pos=<45336817,45251822,18873424>, r=63830112 +pos=<-22707479,37411073,35715277>, r=62578849 +pos=<40230216,57454752,95174584>, r=79862068 +pos=<59394402,27523746,18638104>, r=95851003 +pos=<88516125,41197150,40930949>, r=89006386 +pos=<67918123,48121345,6145417>, r=96269722 +pos=<52126865,27095082,86460873>, r=97005363 +pos=<27227299,-18178187,62306972>, r=93225082 +pos=<-52776428,19141315,50163425>, r=99690435 +pos=<7041041,73555120,46658718>, r=70803069 +pos=<57128675,96955462,56836215>, r=97922737 +pos=<54449598,39543556,42204757>, r=55319856 +pos=<64335579,45020796,21767560>, r=80165742 +pos=<-10953426,35883853,72893055>, r=63854399 +pos=<-4190893,64549410,77887691>, r=64009634 +pos=<63151021,45773096,45935136>, r=54061174 +pos=<34548926,20300660,27453916>, r=69412731 +pos=<51843539,38693218,34049205>, r=61719484 +pos=<44387978,51031179,8721243>, r=70806158 +pos=<59223378,44844401,59074782>, r=58966408 +pos=<61304375,46368851,54526663>, r=54974690 +pos=<68152456,22248517,46227589>, r=82294719 +pos=<18339974,-5788972,63757444>, r=73398926 +pos=<57538247,45718816,28488332>, r=65949533 +pos=<8913814,-12458905,33265853>, r=83277038 +pos=<16791601,13698532,12465629>, r=73245867 +pos=<73788319,54065233,38631376>, r=73330460 +pos=<107019791,47183191,46696404>, r=95758626 +pos=<27086216,46495998,2060349>, r=61148476 +pos=<84492299,48203216,39343804>, r=79563639 +pos=<49703995,33106963,44981015>, r=54234420 +pos=<41387363,71321738,39509986>, r=57307429 +pos=<-3676647,73532276,29728496>, r=61968152 +pos=<32178381,21984325,84180197>, r=79886828 +pos=<-7069263,47417372,21236800>, r=51412727 +pos=<30301905,45665804,85726216>, r=55875295 +pos=<49297738,17850032,57142847>, r=74103135 +pos=<41561820,8727671,33335040>, r=82117473 +pos=<-43781510,33486286,38940865>, r=84352561 +pos=<64076551,42015352,-101902867>, r=50498200 +pos=<-19931867,48178934,33747288>, r=51003449 +pos=<48825639,37857409,83237873>, r=79718665 +pos=<52754055,54074845,30871190>, r=60065992 +pos=<23710745,38605907,-4774784>, r=72497986 +pos=<20100858,45307027,-19905476>, r=77317736 +pos=<51989289,39999030,27113427>, r=67495320 +pos=<13124305,40302301,-2002745>, r=61573777 +pos=<67333830,64297659,37758704>, r=77981081 +pos=<-6206707,30586474,26208321>, r=62409597 +pos=<43829193,6417845,33763264>, r=86266460 +pos=<17441312,-3276117,46331101>, r=57004923 +pos=<-5811539,67444586,34653790>, r=53090097 +pos=<68574352,40336927,40977103>, r=69878682 +pos=<41825475,46893199,42551899>, r=65263400 +pos=<42543839,30413383,21732752>, r=73016846 +pos=<54017489,43310312,43147046>, r=50178577 +pos=<21356984,45064785,45699790>, r=95382140 +pos=<56047348,39293098,44816599>, r=54556172 +pos=<31012313,-810216,35010177>, r=79430729 +pos=<20548415,23427947,50386534>, r=55974101 +pos=<83730679,35320880,35929550>, r=95098682 +pos=<-31137295,40318031,44440067>, r=59376839 +pos=<28766416,51774559,1709817>, r=62939486 +pos=<-14625904,24101034,41655322>, r=61867183 +pos=<38852614,90776048,36288511>, r=77448703 +pos=<32782342,38841848,-3575742>, r=80134716 +pos=<93144002,43891300,33538220>, r=98333022 +pos=<31170005,42947708,37646677>, r=64444426 +pos=<21097695,37432740,45253045>, r=67959464 +pos=<34685485,25162272,41906424>, r=50235239 +pos=<57801108,28735238,65912151>, r=80490652 +pos=<66008687,22000710,46643748>, r=79982873 +pos=<75031283,42124842,65292374>, r=83711450 +pos=<4314807,21493748,37255215>, r=49933897 +pos=<30191609,11668271,6324880>, r=94816823 +pos=<17367539,65981694,57542607>, r=95842811 +pos=<-28473549,42977346,35446488>, r=63048072 +pos=<37223961,67290016,81894566>, r=73410945 +pos=<79638394,38789373,36923054>, r=86544333 +pos=<55426104,14105266,42298311>, r=81640923 +pos=<-21879323,106239503,44120331>, r=98486095 +pos=<-125107,39446044,11813301>, r=61863422 +pos=<25471056,28888510,14288615>, r=64912401 +pos=<26040713,-937694,33260097>, r=76336814 +pos=<26146255,5138662,13390128>, r=90236012 +pos=<-31600050,46188373,24574225>, r=73835185 +pos=<38701928,50721403,-15619730>, r=89151831 +pos=<-62241067,45831496,32278384>, r=97129012 +pos=<20062556,37906685,-793875>, r=65568196 +pos=<82392638,51991373,45837286>, r=72655021 +pos=<96740744,55028844,43580747>, r=92297164 +pos=<36356721,29153145,13541303>, r=76280665 +pos=<3079865,36558003,4307974>, r=69051802 +pos=<80867329,62476685,53187768>, r=83534175 +pos=<42484950,25640433,47378396>, r=52084513 +pos=<75958750,40394046,37982939>, r=80200200 +pos=<29644031,40847960,56546097>, r=51384581 +pos=<38435552,3322493,34653481>, r=83077941 +pos=<-31221495,46982605,44374419>, r=52862427 +pos=<-28423714,36081949,52968024>, r=61201574 +pos=<28016904,22899945,20572393>, r=67162992 +pos=<86298312,43104046,38408210>, r=87405045 +pos=<60693649,74876518,46712644>, r=72965794 +pos=<22566696,48065309,56798978>, r=58303861 +pos=<22859392,32036957,-13067634>, r=86508478 +pos=<28179535,8102799,45263720>, r=57431406 +pos=<59144734,38297774,44640215>, r=58825116 +pos=<25398427,83962413,12916227>, r=80552853 +pos=<55592927,37186002,42591816>, r=58433808 +pos=<-10125545,53516203,-17317432>, r=95447056 +pos=<75808705,37788820,58643982>, r=82176381 +pos=<41582059,39353159,27704214>, r=57143154 +pos=<36803982,39355205,-3606646>, r=83673791 +pos=<-47369219,53669223,52952969>, r=71373292 +pos=<173669415,26884632,8820116>, r=71245061 +pos=<64230471,11859745,45688728>, r=89300367 +pos=<-27995389,46478149,44011250>, r=50504006 +pos=<64473597,40967985,29294451>, r=76829606 +pos=<25626639,2500140,63776164>, r=72415149 +pos=<40692851,779372,32287262>, r=90244577 +pos=<42543510,50835442,77328557>, r=57710094 +pos=<53123916,88806838,38591588>, r=87447575 +pos=<16755624,94346153,37553592>, r=57656465 +pos=<73517767,51897005,44233258>, r=65289793 +pos=<42254027,44801184,43191862>, r=91192046 +pos=<-15181467,39110959,-1260032>, r=90328480 +pos=<35670950,45587984,-8157326>, r=80858652 +pos=<34184905,72353269,33496591>, r=57149825 +pos=<32484778,19554133,947384>, r=94601902 +pos=<30709295,45482776,34168006>, r=83608882 +pos=<-35663744,67855128,71173420>, r=92073973 +pos=<73290429,44934629,24008003>, r=86966267 +pos=<22676200,70440578,5275779>, r=71949242 +pos=<41520507,14891289,20432424>, r=88815486 +pos=<59842801,43646981,44363468>, r=54450816 +pos=<-4916364,38616567,42725884>, r=64463717 +pos=<48351155,1597262,37357878>, r=92014388 +pos=<63495534,34021892,28309017>, r=83783006 +pos=<25250062,47123617,62396321>, r=53909007 +pos=<62790330,20464052,37883023>, r=87061827 +pos=<71971005,23513326,33376228>, r=97700266 +pos=<10528816,46412160,-23305683>, r=79362401 +pos=<33637997,29425119,23496000>, r=63335252 +pos=<57419524,68187124,36263879>, r=73451039 +pos=<53254197,44600779,61357054>, r=55523521 +pos=<40827842,3720677,21472120>, r=98253647 +pos=<-17748085,18576383,64823922>, r=79887411 +pos=<78665184,45003396,44757601>, r=71522560 +pos=<53767106,32431138,20299469>, r=83654870 +pos=<74847810,39924597,57276043>, r=77711777 +pos=<24365495,45522857,7644670>, r=53816385 +pos=<82075921,45443304,24670161>, r=94580825 +pos=<34621400,22710712,18874959>, r=75654092 +pos=<31050958,45147312,18369963>, r=50152149 +pos=<81213376,47919375,51802051>, r=70608617 +pos=<-844042,32262691,6661995>, r=74917166 +pos=<62729359,33461460,37968140>, r=73918677 +pos=<32706140,25474380,15799007>, r=74051123 +pos=<23945607,35435689,38243998>, r=71152799 +pos=<59161663,37698712,52570350>, r=59545887 +pos=<34275822,3441498,78499343>, r=94846153 +pos=<-30310796,27218265,39575900>, r=76514271 +pos=<-15494634,51809425,46337900>, r=79213925 +pos=<16518890,55686763,23806597>, r=54241024 +pos=<-1642099,-717124,66675658>, r=84926883 +pos=<56231780,35059664,26102393>, r=77688295 +pos=<22593572,93919674,40144860>, r=60476626 +pos=<37657872,45773327,88127331>, r=65524416 +pos=<22476892,47520173,37175214>, r=83480001 +pos=<54331823,22505668,62205764>, r=79544548 +pos=<84522030,42886330,72027175>, r=99175491 +pos=<16807848,46971712,2160054>, r=50294671 +pos=<16672318,19597346,-15924534>, r=95617900 +pos=<-10249549,26993089,35420067>, r=60834030 +pos=<91683923,65817980,54924122>, r=99428407 +pos=<55708054,25035363,29428815>, r=83862253 +pos=<50876386,9826070,26003814>, r=97664862 +pos=<17717868,24368638,17890637>, r=58077044 +pos=<7384605,19458931,22149610>, r=64004542 +pos=<48963393,2650623,31039167>, r=97892173 +pos=<-9342873,88159731,33713163>, r=78277059 +pos=<21457555,8927462,58632525>, r=56675131 +pos=<49631578,177051896,93237>, r=85320742 +pos=<32067126,45874591,46029926>, r=86081890 +pos=<40952162,15824171,62562840>, r=73203345 +pos=<49592086,71418075,44204589>, r=60914005 +pos=<-48960646,35679830,63687694>, r=92860465 +pos=<32084271,46857917,45439765>, r=64883093 +pos=<27763836,48189586,42705793>, r=82463047 +pos=<66290035,65556349,57990805>, r=76839570 +pos=<5506247,22496264,33179413>, r=51815754 +pos=<28619993,32142440,16560324>, r=62535590 +pos=<27570667,20691494,37854488>, r=51643471 +pos=<24646690,8238895,41097315>, r=57928865 +pos=<35073091,4474311,77785928>, r=93897196 +pos=<91622122,41359222,40217598>, r=92663757 +pos=<65584506,51633167,51769992>, r=55990065 +pos=<16337126,44503623,58891413>, r=89880074 +pos=<19104009,54468378,42792930>, r=64313936 +pos=<64403510,34173986,46315663>, r=66532236 +pos=<61705500,-12772488,-64899370>, r=50271276 +pos=<-20500510,59812197,76877082>, r=74571523 +pos=<75571078,34155362,24546728>, r=99487358 +pos=<38767442,74195235,25557110>, r=71513807 +pos=<58821278,47883600,28542379>, r=65014403 +pos=<-19913614,56456116,33263824>, r=57593435 +pos=<45401158,27732491,30295381>, r=69991696 +pos=<28210688,42955252,115124377>, r=85892319 +pos=<77056212,44800972,63291576>, r=81059302 +pos=<-153634158,52961156,86487574>, r=53913782 +pos=<60764963,46813864,23522153>, r=73047310 +pos=<68807586,35368171,21387033>, r=94670872 +pos=<29800527,31242195,-12890602>, r=94067295 +pos=<91347260,47311913,41218422>, r=85435290 +pos=<108169748,50379245,46074213>, r=96583027 +pos=<48108045,11607002,56212017>, r=78225555 +pos=<30251881,32671784,106372573>, r=89465355 +pos=<16354520,6351587,10808909>, r=81812519 +pos=<31644977,21391372,38788873>, r=54083123 +pos=<-8245917,-6759882,60046804>, r=90944369 +pos=<-58332441,41088419,63812264>, r=96948633 +pos=<68309096,45734718,80725559>, r=88812903 +pos=<40805453,27546102,41847412>, r=54030302 +pos=<75204822,28086882,44928071>, r=84808545 +pos=<56959082,32590637,19125866>, r=87861239 +pos=<29574801,61040117,15645371>, r=59078474 +pos=<224274119,45373778,41437973>, r=50341391 +pos=<85698263,58203614,34158353>, r=93851774 +pos=<-13048571,56246231,-5836545>, r=89618907 +pos=<27145454,23425174,15979443>, r=70359263 +pos=<67655888,20005512,41924090>, r=88344775 +pos=<63088451,40234211,45273635>, r=60198999 +pos=<-47922846,38438365,74079442>, r=99455703 +pos=<33680716,48227700,36879243>, r=69461305 +pos=<82260905,35594899,47010135>, r=82274746 +pos=<29412924,42139726,5857869>, r=64034014 +pos=<24114275,47389874,51186019>, r=71748743 +pos=<33024444,90536169,42405664>, r=65263253 +pos=<11371167,6956819,57240372>, r=54804172 +pos=<58022749,31830489,39979179>, r=68831501 +pos=<37685382,28789274,27479191>, r=64035407 +pos=<84649321,53172971,47011207>, r=74919358 +pos=<18255531,27969820,1360932>, r=71543356 +pos=<59626484,43637963,41696780>, r=56910311 +pos=<71410691,17895082,57650353>, r=96678535 +pos=<64094465,61468823,32202004>, r=77469564 +pos=<27084040,5618226,32813065>, r=71271117 +pos=<44943713,19544243,14672450>, r=93345395 +pos=<55228619,45918033,41939845>, r=49989105 +pos=<4682107,41422383,55281104>, r=77700220 +pos=<71116902,56361031,45770157>, r=65816169 +pos=<33474817,-12607391,45534934>, r=83165712 +pos=<-61156206,47816996,38354336>, r=87982510 +pos=<46901895,18473439,61998455>, r=75939402 +pos=<33327733,20293626,35683315>, r=59969648 +pos=<36916922,44070174,43868185>, r=98983529 +pos=<22618513,23549677,94370103>, r=78951559 +pos=<60840437,38218076,28572019>, r=76668870 +pos=<28636875,38335671,10690587>, r=62228992 +pos=<45925485,52158531,17580800>, r=64611539 +pos=<45363877,102263754,46481159>, r=85254930 +pos=<44980460,33252493,57808801>, r=55049572 +pos=<55464357,48104843,65884359>, r=58756380 +pos=<30031572,19035294,55488684>, r=51997493 +pos=<88719356,46979545,26878761>, r=97479519 +pos=<30738763,41030934,44939968>, r=75856324 +pos=<-8819376,63657703,1197506>, r=85767119 +pos=<76269562,48216842,47460819>, r=63210291 +pos=<60903867,43657718,25860889>, r=74003627 +pos=<60561080,22071594,71416552>, r=95419110 +pos=<61247010,47911647,31374080>, r=64579948 +pos=<34219008,30136010,2165072>, r=84536360 +pos=<52887072,38944231,7612437>, r=88948773 +pos=<78516471,31712466,63394984>, r=95711567 +pos=<24025835,-21956417,61776376>, r=93271221 +pos=<70473827,11983573,45922044>, r=95186621 +pos=<52933327,19864906,20335993>, r=95350812 +pos=<28979030,-25200486,45734023>, r=91063966 +pos=<58202160,36258949,40339350>, r=64222793 +pos=<62231301,37019662,43340280>, r=64489777 +pos=<40681578,43296161,90431271>, r=73329322 +pos=<59238548,36872583,40613447>, r=64370920 +pos=<29751304,43789672,84375610>, r=55849735 +pos=<28753852,17300631,15482614>, r=78589200 +pos=<41435228,35381165,29035672>, r=59637157 +pos=<225273308,48168301,37718187>, r=85101612 +pos=<63068633,48242411,46944352>, r=50500541 +pos=<20147771,-3329594,11512041>, r=94583718 +pos=<80204707,64961318,46056242>, r=83218182 +pos=<30781277,-14254649,32255611>, r=95398936 +pos=<58830445,32420624,16271772>, r=92756522 +pos=<48642106,31858295,46992921>, r=52409482 +pos=<32959799,54680265,45320459>, r=78917762 +pos=<-32119490,55793295,46799514>, r=55601222 +pos=<-18664724,28991200,66963437>, r=72528726 +pos=<45749180,26084051,45903119>, r=56380398 +pos=<37586040,51050275,-1594445>, r=74339019 +pos=<54177809,19511396,45169479>, r=72115342 +pos=<55444678,38975806,45723305>, r=53364124 +pos=<86209040,44550743,50891738>, r=78062556 +pos=<18122590,55561509,40801560>, r=67063037 +pos=<8677904,-10047295,31876403>, r=82490622 +pos=<33820708,43590850,44703896>, r=57102558 +pos=<38805266,85798481,40257047>, r=68454959 +pos=<57180011,26881110,17309362>, r=95607920 +pos=<25686418,45989065,93727104>, r=58937032 +pos=<-43101760,38157115,47038899>, r=70903381 +pos=<21964995,45581890,44046119>, r=82193150 +pos=<-23323420,47271866,33826211>, r=55223414 +pos=<55736991,20663228,40183239>, r=77509280 +pos=<44735730,46370019,9108964>, r=71875257 +pos=<61640724,53857365,19525599>, r=80080944 +pos=<42276137,42930988,26611532>, r=55352065 +pos=<37988421,-70979449,-21032141>, r=72032984 +pos=<59457620,38100640,57967572>, r=64837102 +pos=<82855937,40836121,46776107>, r=77862222 +pos=<52688370,70642291,81795687>, r=92128763 +pos=<61593124,80986059,46781923>, r=79905585 +pos=<54601015,33411804,37799143>, r=66008433 +pos=<41834171,20012355,45540791>, r=58899403 +pos=<44228446,33467449,16672662>, r=76706724 +pos=<34494083,19349733,92666891>, r=93323768 +pos=<28982569,932776,47026263>, r=63642196 +pos=<-43156327,19929785,46953626>, r=89270553 +pos=<-27669180,43804653,45500756>, r=51361406 +pos=<16452043,45240180,141269699>, r=97994189 +pos=<27467325,40055075,122325881>, r=95250662 +pos=<42154019,74430009,44738590>, r=55953692 +pos=<-37274407,28447631,26885466>, r=94938945 +pos=<41745454,25520718,46886292>, r=51956823 +pos=<35677614,38593588,27947139>, r=51755258 +pos=<46753480,43016124,28504130>, r=57851968 +pos=<40969820,37166005,86455926>, r=75772264 +pos=<37894958,33644760,73846377>, r=63609109 +pos=<54539392,36538090,13615635>, r=87004092 +pos=<68261317,51268753,35910945>, r=67727736 +pos=<37474869,12272332,9945438>, r=97875732 +pos=<23402477,1632186,44959927>, r=59428774 +pos=<35149212,11740221,47466887>, r=58560542 +pos=<59214783,47716128,39446207>, r=54670894 +pos=<180680803,36261396,25489509>, r=87221280 +pos=<78966778,50473977,46422968>, r=67126044 +pos=<18244851,42413639,-2855944>, r=61305694 +pos=<64765362,45184681,22682541>, r=79516596 +pos=<19945090,-16772341,37578101>, r=81757805 +pos=<45742891,13227449,19092546>, r=96041283 +pos=<60679047,14321340,45056506>, r=83919941 +pos=<86806250,43597486,47505994>, r=78321345 +pos=<29636128,-3225886,-107112350>, r=72286952 +pos=<40676164,28346333,15843444>, r=79104879 +pos=<53593809,46196171,37925149>, r=52090869 +pos=<41897387,46709952,20321695>, r=57484238 +pos=<46543027,1506993,28594283>, r=99060343 +pos=<54526315,31828561,25209884>, r=80106662 +pos=<20670412,87478151,13238959>, r=79017849 +pos=<88136574,46155056,50403105>, r=77897279 +pos=<55187433,25508763,35906854>, r=76390400 +pos=<49924929,42941299,25371457>, r=64230584 +pos=<27061330,37705928,-6798795>, r=78772641 +pos=<32102342,56182796,116968275>, r=92255964 +pos=<30171939,36353418,-16142802>, r=92579705 +pos=<88245554,45731267,46959899>, r=78172808 +pos=<30087707,47158804,45966265>, r=96453715 +pos=<20430437,15934639,29682571>, r=57431658 +pos=<65294460,45703066,46535696>, r=55674064 +pos=<75041779,47526379,44532051>, r=65601854 +pos=<12472080,-14690223,68217992>, r=86327926 +pos=<69539628,12366733,44375217>, r=95416339 +pos=<84128321,40375010,70095524>, r=99361719 +pos=<71916517,42879802,47368719>, r=64286688 +pos=<43051438,45785658,22330232>, r=57553913 +pos=<21977380,43341955,45399884>, r=68656165 +pos=<38258083,16747657,9862913>, r=94265892 +pos=<62094897,27837317,44007682>, r=72868318 +pos=<18114823,43906418,43284601>, r=71491428 +pos=<29129133,-16073443,33322324>, r=94498614 +pos=<21130976,-13884317,30009538>, r=87624771 +pos=<13811508,77444097,25738243>, r=52381905 +pos=<56649016,63032526,57667611>, r=64352051 +pos=<41097999,51424181,51694996>, r=80969320 +pos=<97456798,40214853,54267090>, r=97021738 +pos=<32811934,53553741,-26774827>, r=97248747 +pos=<56311384,34239575,42225450>, r=62465400 +pos=<40069680,42993703,22589017>, r=57105336 +pos=<164079538,14215938,22583258>, r=61764366 +pos=<73865061,19558358,43557663>, r=93367405 +pos=<6631630,-2153820,45021772>, r=63498212 +pos=<97380713,45919126,49849154>, r=86823362 +pos=<13342578,-2285456,9437332>, r=92503529 +pos=<62205800,24219677,67278388>, r=90777106 +pos=<32621213,14212432,42589329>, r=58437928 +pos=<2052606,46423073,40330202>, r=89690286 +pos=<-9431871,52664863,85386236>, r=64864738 +pos=<-41342790,48192522,38045705>, r=68102226 +pos=<32864111,39380985,113379893>, r=92375511 +pos=<-41952445,32881023,24527405>, r=97541818 +pos=<-5167722,-1667756,66268539>, r=88995856 +pos=<68584838,60150446,18049792>, r=94793974 +pos=<25956717,47071394,4263321>, r=57240363 +pos=<19271859,41623071,98574124>, r=61735638 +pos=<-17368737,71412452,34384107>, r=68884678 +pos=<29438470,24496614,105882418>, r=96337180 +pos=<-2380208,75718231,33430244>, r=59155718 +pos=<-42986081,43465564,33626112>, r=78892251 +pos=<35958964,-1681004,32877752>, r=87380580 +pos=<27779271,30039386,26134431>, r=54223826 +pos=<72346093,21124897,38181732>, r=95657980 +pos=<108396506,47185748,45063935>, r=98765238 +pos=<-9891944,20097047,33217054>, r=69575540 +pos=<-23937140,60090898,46338056>, r=52177641 +pos=<17167908,20396447,77426370>, r=59710532 +pos=<26301290,47747762,47325903>, r=74909490 +pos=<72723730,62814757,31610220>, r=88036541 +pos=<-22390633,18462760,36784746>, r=80140808 +pos=<87591142,44318372,44565566>, r=81326275 +pos=<86769705,30813192,53319004>, r=94788009 +pos=<69787298,41315053,24710019>, r=86380719 +pos=<-20413681,8607797,58509978>, r=86207625 +pos=<23607608,42331063,37527347>, r=56916077 +pos=<96714083,56729464,47247865>, r=90303985 +pos=<70094315,40246780,45333245>, r=67132683 +pos=<11215276,112276144,23163657>, r=92384847 +pos=<47115647,30144169,33372392>, r=66217762 +pos=<27553265,44039121,-13133502>, r=79266031 +pos=<30034245,32578163,8932991>, r=71141511 +pos=<83984852,45412451,29395087>, r=91795725 +pos=<59139565,25501316,22164078>, r=94092540 +pos=<57924303,46622502,66024521>, r=62839050 +pos=<-7239474,-6259534,33115121>, r=93381581 +pos=<87071301,40328352,40304971>, r=89056365 +pos=<74569381,28995199,57235427>, r=88322134 +pos=<48160565,39607929,24672619>, r=66498571 +pos=<81475518,32784003,43510125>, r=87800053 +pos=<38626197,87904709,39721815>, r=70917368 +pos=<35747165,40702186,83515533>, r=64073014 +pos=<21598430,-6386159,38384943>, r=72218055 +pos=<92947520,47164515,46507417>, r=81894022 +pos=<44040894,1518046,32331829>, r=92809416 +pos=<-14388948,91104076,32948071>, r=87032613 +pos=<-52548023,31433344,36391051>, r=97721299 +pos=<-41181634,23239016,40318674>, r=90621786 +pos=<49451827,38245889,33111285>, r=60713122 +pos=<90222537,36132316,47061194>, r=89647551 +pos=<35660535,110309094,42153980>, r=87923928 +pos=<-18690820,43798331,24605330>, r=63284884 +pos=<167168,3562386,45110858>, r=64157641 +pos=<69856268,14888025,53212639>, r=93693523 +pos=<-23825787,39176653,24877237>, r=72769734 +pos=<32313064,42919066,106320518>, r=81227029 +pos=<56833507,41812057,40804549>, r=56835261 +pos=<-40534187,42817643,37975055>, r=72739175 +pos=<16767136,14232271,224922117>, r=72922652 +pos=<23079072,44933665,-9787616>, r=70551401 +pos=<-7284521,58057844,45729719>, r=84043110 +pos=<-10785778,42161255,28862157>, r=52760523 +pos=<72479241,44635741,44639587>, r=65822388 +pos=<44008071,19508414,54090620>, r=64102799 +pos=<65808131,47764024,46891436>, r=53771077 +pos=<83112262,-51380828,-5105145>, r=55811209 +pos=<74905126,47284019,44585526>, r=65654242 +pos=<71872446,21655380,42553995>, r=90281594 +pos=<32115446,8958801,38878129>, r=66896988 +pos=<72515585,46831447,42119681>, r=66182823 +pos=<-12874762,27888898,26816399>, r=71167166 +pos=<53831039,28814472,58681146>, r=69210467 +pos=<-49321678,67419769,35733050>, r=95495930 +pos=<68002822,20032291,45719887>, r=84869595 +pos=<189351360,45117927,23876177>, r=56872364 +pos=<84934816,47800485,35923907>, r=83828784 +pos=<65517889,44974004,43846950>, r=59315298 +pos=<-43831159,51010424,32021301>, r=77308190 +pos=<37450636,53330808,2737077>, r=72152655 +pos=<58231351,46927907,34441541>, r=59480649 +pos=<-12810934,32577306,41950548>, r=51280739 +pos=<73380795,47105479,66710469>, r=78498288 +pos=<25356901,47492037,41664530>, r=50715954 +pos=<64003068,59881008,54442232>, r=65328815 +pos=<-40075891,51604006,46486310>, r=59681165 +pos=<153334201,-33044471,46577857>, r=96012129 +pos=<78438641,47597227,50955120>, r=67309135 +pos=<22946384,27786511,15124441>, r=62653810 +pos=<62553787,33989941,46916212>, r=64266280 +pos=<51105402,65759012,9954507>, r=91018164 +pos=<-24900518,48219394,-476648>, r=90155445 +pos=<41989881,22264994,59360860>, r=64598270 +pos=<-29738326,57316865,47259007>, r=54283702 +pos=<21919022,-33935016,52412860>, r=93779388 +pos=<25245179,46124275,46091357>, r=64434635 +pos=<24955578,39475185,-24922564>, r=93021455 +pos=<-45892178,37367365,43095553>, r=78426905 +pos=<52501023,5481345,42096077>, r=87541972 +pos=<-13911167,-12745183,41713449>, r=97940568 +pos=<-28911568,31670297,34596140>, r=75642769 +pos=<19562219,17410475,31693488>, r=53076626 +pos=<86957311,47544195,34821735>, r=87209751 +pos=<70289768,40042854,44324306>, r=68541196 +pos=<57072271,28677711,18770322>, r=92242601 +pos=<-52151426,43237300,25882720>, r=96029065 +pos=<73952069,39286310,36810348>, r=80473784 +pos=<37237798,77909432,22773489>, r=76482140 +pos=<152168131,16009728,86757577>, r=93149955 +pos=<47613795,-5021925,47363717>, r=87890369 +pos=<78121275,47759377,36124823>, r=76855439 +pos=<30076814,34632128,44042038>, r=71651672 +pos=<74804987,43190961,19752430>, r=94479970 +pos=<90334712,-37289880,256048>, r=67642155 +pos=<43503434,85336249,26595917>, r=86352017 +pos=<2980293,15468999,43264386>, r=51284132 +pos=<65115975,47337473,22006556>, r=78390422 +pos=<37008449,-2643621,47200042>, r=75070479 +pos=<41137211,90372205,41797485>, r=73820225 +pos=<-64252827,47925820,32145558>, r=97179090 +pos=<67102166,22454880,45769044>, r=81496762 +pos=<64701500,19817455,36417484>, r=91084978 +pos=<52769485,-66218536,-5353280>, r=85328700 +pos=<62238360,29123695,38742777>, r=76990476 +pos=<18844687,12795099,-6782965>, r=95451044 +pos=<100981065,-26489520,93249155>, r=76150209 +pos=<-39422333,54509893,40439220>, r=67980613 +pos=<22878359,29709115,71273679>, r=49955571 +pos=<14085631,24270117,18489772>, r=56152591 +pos=<33518558,30722444,35002562>, r=50411928 +pos=<60936022,45972793,50912154>, r=51387896 +pos=<-7445579,102223535,35054212>, r=89102457 +pos=<4682901,30192896,45839381>, r=74949828 +pos=<19434568,36202489,-14796468>, r=80646928 +pos=<32206696,74733743,-5979619>, r=97028316 +pos=<55713770,39561620,78530986>, r=80195808 +pos=<43713031,36759737,20638611>, r=68933293 +pos=<8615237,-8773464,17158876>, r=95997063 +pos=<96558516,42787935,45347510>, r=91041518 +pos=<33101773,40637201,24825455>, r=50257548 +pos=<22407125,45023656,64347622>, r=82457916 +pos=<52030151,46048917,24777173>, r=63822530 +pos=<57036195,79223173,40756337>, r=79611365 +pos=<-2170132,45131081,107549674>, r=80480567 +pos=<51050410,47850632,34448776>, r=51369484 +pos=<25167513,19962765,90206769>, r=80924169 +pos=<29070471,36548953,14601603>, r=60538376 +pos=<-21146462,39909597,21289883>, r=72944621 +pos=<62216280,35735044,34466236>, r=74633420 +pos=<65977992,58329611,44754170>, r=63661805 +pos=<-21552625,67402861,41103046>, r=62339981 +pos=<60562092,20825754,37920662>, r=84434069 +pos=<4001078,-21286657,42676417>, r=87607044 +pos=<-22228038,8647809,37651197>, r=88926709 +pos=<48799002,51311725,10003434>, r=74215748 +pos=<43551887,44538275,84540503>, r=69066674 +pos=<48746740,72130796,44271965>, r=60713824 +pos=<48886509,36511015,100683816>, r=98571801 +pos=<66980685,28125857,67401549>, r=91769186 +pos=<48593353,66088821,66993447>, r=68678218 +pos=<20524135,48101742,106107975>, r=64042859 +pos=<-19124807,32027195,82836083>, r=85825715 +pos=<47569480,11226760,63140338>, r=84995565 +pos=<20202453,9280334,55703648>, r=52138270 +pos=<32688161,51066097,34763251>, r=83597889 +pos=<82710541,47751450,46904922>, r=70672633 +pos=<34179365,2981497,19674044>, r=94142249 +pos=<-33395354,47290925,14075833>, r=85026271 +pos=<-51808198,34414180,47196332>, r=83195943 +pos=<44857240,28087691,27568423>, r=71819486 +pos=<64976175,41347053,33082929>, r=73164561 +pos=<33148616,-6805198,37518371>, r=85053840 +pos=<7065942,52053193,45190101>, r=88227209 +pos=<64550694,30508493,65173396>, r=84728337 +pos=<86076794,55439556,32751312>, r=92873403 +pos=<-1406442,47053164,32685101>, r=63215552 +pos=<6658920,18650550,84946879>, r=75529173 +pos=<30806048,-24912752,41929047>, r=96408117 +pos=<-783986,16598228,69372816>, r=69450503 +pos=<30118104,83553520,20362506>, r=77417879 +pos=<95101840,60267613,47554238>, r=91923494 +pos=<66858459,21490799,41471806>, r=86514767 +pos=<8419134,78335855,14417958>, r=69986913 +pos=<23831972,46591539,-15241158>, r=75100094 +pos=<88278811,41226942,37240277>, r=92430001 +pos=<53043274,50988314,9416872>, r=78722960 +pos=<31586199,34179382,16054834>, r=63970411 +pos=<29695716,36098205,17168611>, r=59047270 +pos=<35080728,18632959,37612641>, r=61453679 +pos=<31208595,24102808,19618727>, r=70105420 +pos=<72071405,45343653,69974206>, r=82214638 +pos=<194052441,35125806,30436049>, r=69115965 +pos=<6353012,108782675,18604677>, r=98312817 +pos=<33648026,-3881639,34713396>, r=85434690 +pos=<98873732,40611985,55645707>, r=99420146 +pos=<4151901,29783599,5726276>, r=73336437 +pos=<-35663345,23003122,32418137>, r=93239720 +pos=<97741124,37018991,43861838>, r=99478978 +pos=<69212741,29380177,39725751>, r=82725174 +pos=<32123583,43419852,5695371>, r=65626767 +pos=<54532972,33923895,42207804>, r=61019634 +pos=<57301703,77197157,46329819>, r=72277459 +pos=<108424173,44278232,47117447>, r=99647199 +pos=<36395377,24230102,44532391>, r=50251244 +pos=<67601838,54357121,37297237>, r=68770203 +pos=<-37626862,47137945,44052441>, r=59434259 +pos=<59598951,33871782,33253293>, r=75092250 +pos=<44481617,7084589,74815085>, r=97724780 +pos=<68806630,39453007,59849138>, r=74715644 +pos=<58920042,44014223,24823101>, r=72701193 +pos=<67509762,51356770,41946491>, r=61028427 +pos=<60188493,70305515,14888943>, r=99713471 +pos=<71626305,51297132,47010644>, r=60021096 +pos=<22138608,34007898,-4341113>, r=75090281 +pos=<18001718,42993073,43251785>, r=85746118 +pos=<40912684,3709364,34461045>, r=85360680 +pos=<51839140,28949241,42381281>, r=63127053 +pos=<35992778,7891852,12093118>, r=98626181 +pos=<76945787,51163972,55226216>, r=70338464 +pos=<63935345,45558212,24702472>, r=76293038 +pos=<26437236,23029563,13866388>, r=72159881 +pos=<37400014,26641299,28931022>, r=64446196 +pos=<-54018552,38338679,54113978>, r=85685805 +pos=<34913073,41916041,51893205>, r=58007995 +pos=<28109593,70851984,66930558>, r=52894658 +pos=<61830895,45985919,20593129>, r=77870207 +pos=<45147970,35182809,35342598>, r=57240989 +pos=<48881175,37845503,38503310>, r=55150725 +pos=<-37047813,46613500,8875153>, r=94557007 +pos=<35492708,31672157,-12518902>, r=98957937 +pos=<116410423,-28840871,71482885>, r=59853369 +pos=<-50471140,39007198,29020020>, r=95441560 +pos=<30053748,-17546311,35216347>, r=95002186 +pos=<43411934,34559082,11807568>, r=79663733 +pos=<21025556,61949059,32046349>, r=86949892 +pos=<22468662,61662234,16466117>, r=51773058 +pos=<26155908,36269584,35660978>, r=56549699 +pos=<32738886,43839059,-497106>, r=72015334 +pos=<43778121,51542877,17400200>, r=62029041 +pos=<77183326,50503514,53599094>, r=68288332 +pos=<67548097,48099522,47096025>, r=54970918 +pos=<-22125824,40235271,-1313077>, r=96201276 +pos=<-14424515,32193172,6199337>, r=89029944 +pos=<44352816,70613735,46768128>, r=52306690 +pos=<81059472,38262735,62557471>, r=90866700 +pos=<42490906,104763369,59748971>, r=94005941 +pos=<-23524530,40541259,45745849>, r=50235298 +pos=<27416580,24429378,34670003>, r=50935859 +pos=<31036855,25236706,66243076>, r=57555714 +pos=<70642218,54942800,33197332>, r=76495927 +pos=<47419711,-2080193,40586443>, r=91532164 +pos=<64299026,42403072,31799492>, r=72714840 +pos=<60470181,34860031,23679516>, r=84549130 +pos=<-21382100,62427490,25202788>, r=73094331 +pos=<81706876,41024280,46322478>, r=76978484 +pos=<54821813,38061176,7746502>, r=91632517 +pos=<48200935,27967125,19764071>, r=83088108 +pos=<58537003,46781516,38652604>, r=55721245 +pos=<34985633,17404412,47452155>, r=52747782 +pos=<-3108712,31722815,30965587>, r=53418668 +pos=<-18436720,2127214,30927095>, r=98380066 +pos=<48714893,39981069,30315783>, r=61036417 +pos=<-26061006,43274258,37500740>, r=58283728 +pos=<51484364,26833235,12305170>, r=94964353 +pos=<19887872,8364082,38282858>, r=55859415 +pos=<73299215,38828379,53010142>, r=72993755 +pos=<-31205422,51822232,46560728>, r=50954484 +pos=<61691605,47577855,83213442>, r=82840247 +pos=<59702734,54033289,46476516>, r=51367798 +pos=<4981119,8274587,33488960>, r=66252970 +pos=<57922838,65684303,50789022>, r=61398530 +pos=<-45105420,47548013,29362263>, r=81193205 +pos=<78900713,30509094,50983176>, r=84887425 +pos=<-63120028,32266292,45461104>, r=98390504 +pos=<89495130,43658066,45806336>, r=82649123 +pos=<-34501706,57247731,36769239>, r=69467730 +pos=<74964282,24574993,49958465>, r=85860267 +pos=<85467495,47933610,46473891>, r=73678358 +pos=<-45673378,35582113,44881429>, r=78207529 +pos=<98184759,45135708,38317516>, r=97349914 +pos=<55182613,25170227,-90165307>, r=52821189 +pos=<45807217,38649208,33776599>, r=56000207 +pos=<-8216816,45029473,-2375189>, r=78560257 +pos=<24818078,-16141049,31106706>, r=92470930 +pos=<-12476743,36959833,-10223145>, r=98737722 +pos=<67165820,30831495,44776212>, r=74176573 +pos=<47886828,41148110,9419030>, r=79938097 +pos=<91363632,37250192,39284499>, r=97447772 +pos=<80609064,42079730,66734153>, r=90776008 +pos=<47419015,34047530,75441081>, r=74325080 +pos=<-5197243,16721489,47507670>, r=53965743 +pos=<33750694,28379544,37954910>, r=50034639 +pos=<72909890,46727204,43191496>, r=65609937 +pos=<64651654,33892005,69853793>, r=86126328 +pos=<79878375,46177923,46736599>, r=69582222 +pos=<8249645,40040757,44109023>, r=90259675 +pos=<38330826,65569564,59442519>, r=50345306 +pos=<35411815,4433522,35455622>, r=78141095 +pos=<63025772,36635016,42516316>, r=66492887 +pos=<37446580,40380247,1605938>, r=78079204 +pos=<1089996,43250991,-26556175>, r=95213337 +pos=<27828905,95007369,86800902>, r=96639565 +pos=<19110668,52578912,40284060>, r=55742297 +pos=<76372399,44241005,22956104>, r=91793784 +pos=<-1240607,34871772,5287819>, r=74078706 +pos=<46232463,25775471,27535094>, r=75540479 +pos=<18286640,131765767,45893005>, r=88267888 +pos=<40604110,22648623,22147792>, r=78426132 +pos=<42923353,30655608,3221863>, r=91664266 +pos=<55573367,46792267,40537660>, r=50861805 +pos=<84106865,32953082,38902369>, r=94869855 +pos=<-28685087,54539326,14636561>, r=83075445 +pos=<40226750,50631976,17430536>, r=57536431 +pos=<3687987,17483520,37538376>, r=54288328 +pos=<29932904,-1844569,35860416>, r=78535451 +pos=<67747213,43453189,42286043>, r=64626525 +pos=<60901308,32906306,25326794>, r=85286610 +pos=<45610895,35264932,14560497>, r=78403887 +pos=<82996698,38296441,37903613>, r=89415041 +pos=<37830799,58947131,69667244>, r=53447584 +pos=<94832479,43702506,50119088>, r=86761893 +pos=<44171871,59242434,14425185>, r=73097506 +pos=<52342042,35428607,89648893>, r=92075041 +pos=<25058801,41184797,94510161>, r=63896666 +pos=<86564738,36400305,40159000>, r=92623857 +pos=<73522949,46397735,55732627>, r=68370474 +pos=<24298221,43970980,39789590>, r=80894890 +pos=<70468144,37200470,67491727>, r=86271887 +pos=<1133788,104986973,32327408>, r=86013292 +pos=<35294725,28215947,30270754>, r=59426386 +pos=<-63072862,46893775,33424403>, r=95752355 +pos=<38086339,21092695,29552034>, r=70059984 +pos=<105837358,42834617,47321129>, r=98300035 +pos=<22022089,12831374,38789575>, r=53019508 +pos=<42189805,27065386,38307310>, r=59435695 +pos=<68307575,45775054,17992050>, r=87158841 +pos=<5570964,32668900,-14960049>, r=89717821 +pos=<-151787334,26417604,67133557>, r=67932553 +pos=<25214078,-10791264,26230718>, r=92393090 +pos=<60455925,37217848,44680949>, r=61175713 +pos=<73703211,46412915,25697772>, r=84210899 +pos=<-9389980,29187610,77541625>, r=73635871 +pos=<24317461,29888483,54881923>, r=99393546 +pos=<27427502,22449797,33762673>, r=53833699 +pos=<19484720,55851041,55343779>, r=99038550 +pos=<51079119,15261048,32550262>, r=85886434 +pos=<56458005,95286957,43097167>, r=92756096 +pos=<-4189869,32270548,92923464>, r=80734581 +pos=<36496626,11627368,17002182>, r=90485643 +pos=<-39877725,29187907,35969273>, r=87718201 +pos=<66758465,47231921,41704820>, r=60440089 +pos=<20076711,26698184,43390319>, r=95921058 +pos=<79369694,47163965,46829992>, r=67994116 +pos=<37849498,48060836,16918832>, r=55488442 +pos=<165679763,63705321,10687217>, r=60761014 +pos=<91159196,30723794,50556110>, r=96504054 +pos=<45973253,29295939,40318832>, r=58976848 +pos=<53645666,44924810,39352382>, r=51986835 +pos=<53662141,56799665,70828688>, r=68292867 +pos=<41360452,32337273,25302745>, r=66339545 +pos=<58339802,35964275,8223342>, r=96770725 +pos=<17613634,2648041,41437745>, r=56146357 +pos=<37974781,42580398,43976152>, r=90476863 +pos=<54524244,30867303,16811842>, r=89463508 +pos=<-33526422,40928905,34477452>, r=71117869 +pos=<91566118,42276616,40151830>, r=91756086 +pos=<46981419,96473551,65517966>, r=95975473 +pos=<60257793,56509405,11153317>, r=89722152 +pos=<23683330,51678452,-4543929>, r=64013964 +pos=<58108951,51535018,43754798>, r=49997729 +pos=<37773936,38380721,-4221101>, r=86232723 +pos=<19416703,104260381,17816314>, r=89969034 +pos=<12970739,19178311,10655221>, r=70193485 +pos=<82665993,27655569,51973393>, r=92496326 +pos=<-29837746,69094651,44081851>, r=69338067 +pos=<28898553,-4488516,30052626>, r=85953160 +pos=<81619209,59813841,39331918>, r=86209422 +pos=<171457669,-12552454,46932029>, r=91259805 +pos=<17112356,39136305,-24578365>, r=85172877 +pos=<19194572,14786639,76534943>, r=66455485 +pos=<-3476031,-139768,71529521>, r=91037172 +pos=<95880606,44835038,42265119>, r=91398977 +pos=<32774290,22313197,8157431>, r=84922023 +pos=<63884479,47540794,25303754>, r=73658348 +pos=<-13047695,-3863791,46962463>, r=82946682 +pos=<64002095,86062732,35807486>, r=98365620 +pos=<56134537,44586578,54536488>, r=51597055 +pos=<1277122,78229234,-2363444>, r=93803332 +pos=<-63306254,47910903,54520192>, r=85807355 +pos=<95598595,40271767,46128668>, r=91816742 +pos=<-9063115,26628548,17955355>, r=77476868 +pos=<-39147904,48124557,28569808>, r=75451355 +pos=<26873848,18846049,38186783>, r=52459466 +pos=<63773014,19593400,54843300>, r=84535425 +pos=<20593778,18286399,72132072>, r=59951957 +pos=<23227862,61482669,46692836>, r=53712430 +pos=<53526537,84503234,39959195>, r=82178888 +pos=<79868937,19110265,-60803396>, r=72078665 +pos=<52421424,40162463,43642011>, r=51235422 +pos=<-16427834,36089174,36680227>, r=56656210 +pos=<29393585,28300428,109541567>, r=96147214 +pos=<3259445,-6467846,34169018>, r=82037081 +pos=<57691330,59935904,22153515>, r=79582469 +pos=<73876443,63756434,42212702>, r=79528421 +pos=<51482469,65990806,27843510>, r=73738496 +pos=<76843510,46385406,27516609>, r=85559856 +pos=<-23182418,34095984,55291574>, r=60269801 +pos=<46795846,44034285,34362684>, r=51017302 +pos=<17535313,13508991,24689895>, r=61954789 +pos=<30804351,70832968,9894298>, r=75851290 +pos=<-30989231,24291012,37020026>, r=82675828 +pos=<42844346,34723733,2366966>, r=88372153 +pos=<53300566,-7021246,45659925>, r=97280601 +pos=<-18884881,47987062,111541135>, r=98330739 +pos=<30033962,-282555,35161370>, r=77773509 +pos=<69228807,45277494,42766431>, r=63803280 +pos=<39145878,45253565,44254260>, r=96368244 +pos=<-41854978,46608611,39552433>, r=68691952 +pos=<109141704,47542542,50054540>, r=97166459 +pos=<54727565,47295932,28531331>, r=61518662 +pos=<36485232,27730648,401307>, r=90971725 +pos=<43888040,114722266,43356771>, r=99362057 +pos=<203345467,35130560,35403226>, r=76234038 +pos=<37850033,48088182,268360>, r=72111886 +pos=<47173596,15638525,58719392>, r=75767054 +pos=<-3725836,70759131,3332944>, r=85639684 +pos=<28236569,10880725,8958357>, r=91016023 +pos=<-7075582,65770053,34265006>, r=53068180 +pos=<87150803,42780843,35311000>, r=91677327 +pos=<18085200,43711061,962539>, r=56030160 +pos=<76647777,46126618,57783548>, r=73817350 +pos=<75720092,61171147,43732078>, r=77267547 +pos=<101511028,46051483,58758378>, r=99730593 +pos=<2501375,-21130928,51095534>, r=85617201 +pos=<17255601,60931124,-2662199>, r=64957191 +pos=<60928241,39741319,32494245>, r=71311144 +pos=<40290108,-12330363,42903479>, r=92335378 +pos=<89332198,46638319,38241363>, r=87071019 +pos=<16465766,-14762728,29795639>, r=84051231 +pos=<83946992,45319938,32385665>, r=88859782 +pos=<51710586,22897610,77631498>, r=91956982 +pos=<-19978367,16381145,16826174>, r=99768722 +pos=<34506588,91711511,50024428>, r=63245024 +pos=<48635003,9371488,40456276>, r=81425698 +pos=<51451105,-360679,53170686>, r=90494961 +pos=<86002985,43075618,39182127>, r=86363642 +pos=<63451473,47897170,35010139>, r=63162531 +pos=<45765295,53618906,46572448>, r=54105448 +pos=<67982431,29563806,36215213>, r=84822022 +pos=<7252558,21459622,13715670>, r=70569819 +pos=<39155542,9628304,23450909>, r=88694703 +pos=<69564813,55081791,67433902>, r=79083210 +pos=<67109709,45181504,47428433>, r=57118272 +pos=<26525614,21687012,22790961>, r=64666018 +pos=<-15535104,65300544,25315798>, r=70007382 +pos=<65487693,48063533,39034482>, r=61008092 +pos=<49970856,18435302,59964573>, r=77012725 +pos=<85282321,44036760,60372854>, r=87130962 +pos=<42412226,21638106,78745610>, r=85032224 +pos=<65945066,31842198,35733778>, r=80987451 +pos=<56940122,58392056,44183826>, r=55256842 diff --git a/www/statics/aoc/2018/24-1.linq b/www/statics/aoc/2018/24-1.linq new file mode 100644 index 0000000..a56fe63 --- /dev/null +++ b/www/statics/aoc/2018/24-1.linq @@ -0,0 +1,140 @@ + + +class ArmyGroup +{ + public string Source; + + public int UnitCount; + public int HitPoints; + public List Weakness = new List(); + public List Immunity = new List(); + public string DamageType; + public int DamageValue; + public int Initiative; + + public int EffectivePower => UnitCount * DamageValue; + public bool Alive => UnitCount>0; + + public ArmyGroup NextTarget = null; + public bool IsTargeted = false; +} + +void Main() +{ + var groups = Load(File.ReadAllLines(Path.Combine(Path.GetDirectoryName(Util.CurrentQueryPath), @"24_input.txt"))); + + for(int gen=0;;gen++) + { + if (!(groups.GroupBy(g => g.Source).All(g => g.Any(a => a.Alive)))) break; + + Fight(groups); + } + + groups + .GroupBy(g => g.Source) + .Select(g => (g.Key, g.Sum(a => a.UnitCount))) + .Dump(); +} + +List Load(string[] lines) +{ + return new[] + { + lines.Skip(1).TakeWhile(l => !string.IsNullOrWhiteSpace(l)).Select(l => LoadSingle("ImmuneSystem", l)), + lines.Skip(1).SkipWhile(l => !string.IsNullOrWhiteSpace(l)).Skip(2).Select(l => LoadSingle("Infection", l)) + } + .SelectMany(p=>p) + .ToList(); +} + +ArmyGroup LoadSingle(string src, string line) +{ + var ag = new ArmyGroup { Source=src }; + + var i1 = line.IndexOf(' '); + ag.UnitCount = int.Parse(line.Substring(0, i1).Trim()); + line = line.Substring(i1).Trim().Substring(15).Trim(); + + var i6 = line.IndexOf(' '); + ag.HitPoints = int.Parse(line.Substring(0, i6).Trim()); + line = line.Substring(i6).Trim().Substring(11).Trim(); + + var i2 = line.IndexOf(')'); + if (i2 != -1) + { + var spec0 = line.Substring(1, i2).TrimEnd(')'); + line = line.Substring(1).Substring(i2).Substring(1).Trim(); + + foreach (var spc in spec0.Split(';').Select(p => p.Trim())) + { + if (spc.StartsWith("weak to")) ag.Weakness.AddRange(spc.Substring("weak to".Length).Trim().Split(',').Select(p => p.Trim())); + if (spc.StartsWith("immune to")) ag.Immunity.AddRange(spc.Substring("immune to".Length).Trim().Split(',').Select(p => p.Trim())); + } + } + line = line.Substring(25).Trim(); + + var i3 = line.IndexOf(' '); + ag.DamageValue = int.Parse(line.Substring(0, i3).Trim()); + line = line.Substring(i3).Trim().Trim(); + + var i4 = line.IndexOf(' '); + ag.DamageType = line.Substring(0, i4).Trim(); + line = line.Substring(i4).Trim().Trim(); + + var i5 = line.LastIndexOf(' '); + ag.Initiative = int.Parse(line.Substring(i5).Trim()); + + return ag; +} + +void Fight(List groups) +{ + // PHASE 1 + + foreach (var g in groups) { g.IsTargeted=false; g.NextTarget=null; } + + foreach (var g in groups.Where(g => g.Alive).OrderByDescending(g => g.EffectivePower).ThenByDescending(g => g.Initiative)) + { + SelectTarget(g, groups); + } + + // PHASE 2 + + foreach (var g in groups.Where(g => g.Alive).OrderByDescending(g => g.Initiative).Where(g => g.NextTarget!=null)) + { + Attack(g, g.NextTarget); + } +} + +void SelectTarget(ArmyGroup att, List groups) +{ + att.NextTarget = groups + .Where(g => g.Alive) + .Where(g => g.Source != att.Source) + .Where(g => !g.IsTargeted) + .Where(g => CalcFullDamage(att, g)>0) + .OrderByDescending(g => CalcFullDamage(att, g)) + .ThenByDescending(g => g.EffectivePower) + .ThenByDescending(g => g.Initiative) + .FirstOrDefault(); + if (att.NextTarget != null) att.NextTarget.IsTargeted = true; +} + +int CalcFullDamage(ArmyGroup att, ArmyGroup def) +{ + if (att.UnitCount==0) return 0; + + var dmg = att.EffectivePower; + if (def.Immunity.Contains(att.DamageType)) return 0; + if (def.Weakness.Contains(att.DamageType)) return dmg*2; + return dmg; +} + +void Attack(ArmyGroup att, ArmyGroup def) +{ + var dmg = CalcFullDamage(att, def); + + def.UnitCount -= (int)(dmg / def.HitPoints); + if (def.UnitCount<0) def.UnitCount = 0; + +} \ No newline at end of file diff --git a/www/statics/aoc/2018/24-2.linq b/www/statics/aoc/2018/24-2.linq new file mode 100644 index 0000000..c65457f --- /dev/null +++ b/www/statics/aoc/2018/24-2.linq @@ -0,0 +1,148 @@ + + +class ArmyGroup +{ + public string Source; + + public int UnitCount; + public int HitPoints; + public List Weakness = new List(); + public List Immunity = new List(); + public string DamageType; + public int DamageValue; + public int Initiative; + + public int EffectivePower => UnitCount * DamageValue; + public bool Alive => UnitCount>0; + + public ArmyGroup NextTarget = null; + public bool IsTargeted = false; +} + +void Main() => Enumerable.Range(0, int.MaxValue).Select(Calc).First(b=>b>0).Dump(); + +int Calc(int boost) +{ + var groups = Load(File.ReadAllLines(Path.Combine(Path.GetDirectoryName(Util.CurrentQueryPath), @"24_input.txt"))); + + foreach(var g in groups.Where(p => p.Source=="ImmuneSystem")) g.DamageValue += boost; + + for (int gen = 0; ; gen++) + { + if (!(groups.GroupBy(g => g.Source).All(g => g.Any(a => a.Alive)))) break; + + bool dmg = Fight(groups); + + if (!dmg) return 0; + } + + return groups.Where(p => p.Source=="ImmuneSystem").Sum(p => p.UnitCount) - groups.Where(p => p.Source=="Infection").Sum(p => p.UnitCount); +} + +List Load(string[] lines) +{ + return new[] + { + lines.Skip(1).TakeWhile(l => !string.IsNullOrWhiteSpace(l)).Select(l => LoadSingle("ImmuneSystem", l)), + lines.Skip(1).SkipWhile(l => !string.IsNullOrWhiteSpace(l)).Skip(2).Select(l => LoadSingle("Infection", l)) + } + .SelectMany(p=>p) + .ToList(); +} + +ArmyGroup LoadSingle(string src, string line) +{ + var ag = new ArmyGroup { Source=src }; + + var i1 = line.IndexOf(' '); + ag.UnitCount = int.Parse(line.Substring(0, i1).Trim()); + line = line.Substring(i1).Trim().Substring(15).Trim(); + + var i6 = line.IndexOf(' '); + ag.HitPoints = int.Parse(line.Substring(0, i6).Trim()); + line = line.Substring(i6).Trim().Substring(11).Trim(); + + var i2 = line.IndexOf(')'); + if (i2 != -1) + { + var spec0 = line.Substring(1, i2).TrimEnd(')'); + line = line.Substring(1).Substring(i2).Substring(1).Trim(); + + foreach (var spc in spec0.Split(';').Select(p => p.Trim())) + { + if (spc.StartsWith("weak to")) ag.Weakness.AddRange(spc.Substring("weak to".Length).Trim().Split(',').Select(p => p.Trim())); + if (spc.StartsWith("immune to")) ag.Immunity.AddRange(spc.Substring("immune to".Length).Trim().Split(',').Select(p => p.Trim())); + } + } + line = line.Substring(25).Trim(); + + var i3 = line.IndexOf(' '); + ag.DamageValue = int.Parse(line.Substring(0, i3).Trim()); + line = line.Substring(i3).Trim().Trim(); + + var i4 = line.IndexOf(' '); + ag.DamageType = line.Substring(0, i4).Trim(); + line = line.Substring(i4).Trim().Trim(); + + var i5 = line.LastIndexOf(' '); + ag.Initiative = int.Parse(line.Substring(i5).Trim()); + + return ag; +} + +bool Fight(List groups) +{ + // PHASE 1 + + foreach (var g in groups) { g.IsTargeted=false; g.NextTarget=null; } + + foreach (var g in groups.Where(g => g.Alive).OrderByDescending(g => g.EffectivePower).ThenByDescending(g => g.Initiative)) + { + SelectTarget(g, groups); + } + + // PHASE 2 + + bool d = false; + + foreach (var g in groups.Where(g => g.Alive).OrderByDescending(g => g.Initiative).Where(g => g.NextTarget!=null)) + { + var a = Attack(g, g.NextTarget); + if (a)d=true; + } + return d; +} + +void SelectTarget(ArmyGroup att, List groups) +{ + att.NextTarget = groups + .Where(g => g.Alive) + .Where(g => g.Source != att.Source) + .Where(g => !g.IsTargeted) + .Where(g => CalcFullDamage(att, g)>0) + .OrderByDescending(g => CalcFullDamage(att, g)) + .ThenByDescending(g => g.EffectivePower) + .ThenByDescending(g => g.Initiative) + .FirstOrDefault(); + if (att.NextTarget != null) att.NextTarget.IsTargeted = true; +} + +int CalcFullDamage(ArmyGroup att, ArmyGroup def) +{ + if (att.UnitCount==0) return 0; + + var dmg = att.EffectivePower; + if (def.Immunity.Contains(att.DamageType)) return 0; + if (def.Weakness.Contains(att.DamageType)) return dmg*2; + return dmg; +} + +bool Attack(ArmyGroup att, ArmyGroup def) +{ + var dmg = CalcFullDamage(att, def); + var kill = (int)(dmg / def.HitPoints); + def.UnitCount -= kill; + if (def.UnitCount<0) def.UnitCount = 0; + return kill>0; + +} \ No newline at end of file diff --git a/www/statics/aoc/2018/24_challenge.txt b/www/statics/aoc/2018/24_challenge.txt new file mode 100644 index 0000000..2959462 --- /dev/null +++ b/www/statics/aoc/2018/24_challenge.txt @@ -0,0 +1,311 @@ +--- Day 24: Immune System Simulator 20XX --- + +After a weird buzzing noise, 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: + +The immune system and the infection each have an army made up of several groups; each group consists of one or more identical units. The armies repeatedly fight until only one army has units remaining. + +Units within a group all have the same hit points (amount of damage a unit can take before it is destroyed), attack damage (the amount of damage each unit deals), an attack type, an initiative (higher initiative units attack first and win ties), and sometimes weaknesses or immunities. Here is an example group: + +18 units each with 729 hit points (weak to fire; immune to cold, slashing) + with an attack that does 8 radiation damage at initiative 10 + +Each group also has an effective power: the number of units in that group multiplied by their attack damage. The above group has an effective power of 18 * 8 = 144. Groups never have zero or negative units; instead, the group is removed from combat. + +Each fight consists of two phases: target selection and attacking. + +During the target selection phase, each group attempts to choose one target. In decreasing order of effective power, groups choose their targets; in a tie, the group with the higher initiative chooses first. The attacking group chooses to target the group in the enemy army to which it would deal the most damage (after accounting for weaknesses and immunities, but not accounting for whether the defending group has enough units to actually receive all of that damage). + +If an attacking group is considering two defending groups to which it would deal equal damage, it chooses to target the defending group with the largest effective power; if there is still a tie, it chooses the defending group with the highest initiative. If it cannot deal any defending groups damage, it does not choose a target. Defending groups can only be chosen as a target by one attacking group. + +At the end of the target selection phase, each group has selected zero or one groups to attack, and each group is being attacked by zero or one groups. + +During the attacking phase, each group deals damage to the target it selected, if any. Groups attack in decreasing order of initiative, regardless of whether they are part of the infection or the immune system. (If a group contains no units, it cannot attack.) + +The damage an attacking group deals to a defending group depends on the attacking group's attack type and the defending group's immunities and weaknesses. By default, an attacking group would deal damage equal to its effective power to the defending group. However, if the defending group is immune to the attacking group's attack type, the defending group instead takes no damage; if the defending group is weak to the attacking group's attack type, the defending group instead takes double damage. + +The defending group only loses whole units from damage; damage is always dealt in such a way that it kills the most units possible, and any remaining damage to a unit that does not immediately kill it is ignored. For example, if a defending group contains 10 units with 10 hit points each and receives 75 damage, it loses exactly 7 units and is left with 3 units at full health. + +After the fight is over, if both armies still contain units, a new fight begins; combat only ends once one army has lost all of its units. + +For example, consider the following armies: + +Immune System: +17 units each with 5390 hit points (weak to radiation, bludgeoning) with + an attack that does 4507 fire damage at initiative 2 +989 units each with 1274 hit points (immune to fire; weak to bludgeoning, + slashing) with an attack that does 25 slashing damage at initiative 3 + +Infection: +801 units each with 4706 hit points (weak to radiation) with an attack + that does 116 bludgeoning damage at initiative 1 +4485 units each with 2961 hit points (immune to radiation; weak to fire, + cold) with an attack that does 12 slashing damage at initiative 4 + +If these armies were to enter combat, the following fights, including details during the target selection and attacking phases, would take place: + +Immune System: +Group 1 contains 17 units +Group 2 contains 989 units +Infection: +Group 1 contains 801 units +Group 2 contains 4485 units + +Infection group 1 would deal defending group 1 185832 damage +Infection group 1 would deal defending group 2 185832 damage +Infection group 2 would deal defending group 2 107640 damage +Immune System group 1 would deal defending group 1 76619 damage +Immune System group 1 would deal defending group 2 153238 damage +Immune System group 2 would deal defending group 1 24725 damage + +Infection group 2 attacks defending group 2, killing 84 units +Immune System group 2 attacks defending group 1, killing 4 units +Immune System group 1 attacks defending group 2, killing 51 units +Infection group 1 attacks defending group 1, killing 17 units + +Immune System: +Group 2 contains 905 units +Infection: +Group 1 contains 797 units +Group 2 contains 4434 units + +Infection group 1 would deal defending group 2 184904 damage +Immune System group 2 would deal defending group 1 22625 damage +Immune System group 2 would deal defending group 2 22625 damage + +Immune System group 2 attacks defending group 1, killing 4 units +Infection group 1 attacks defending group 2, killing 144 units + +Immune System: +Group 2 contains 761 units +Infection: +Group 1 contains 793 units +Group 2 contains 4434 units + +Infection group 1 would deal defending group 2 183976 damage +Immune System group 2 would deal defending group 1 19025 damage +Immune System group 2 would deal defending group 2 19025 damage + +Immune System group 2 attacks defending group 1, killing 4 units +Infection group 1 attacks defending group 2, killing 143 units + +Immune System: +Group 2 contains 618 units +Infection: +Group 1 contains 789 units +Group 2 contains 4434 units + +Infection group 1 would deal defending group 2 183048 damage +Immune System group 2 would deal defending group 1 15450 damage +Immune System group 2 would deal defending group 2 15450 damage + +Immune System group 2 attacks defending group 1, killing 3 units +Infection group 1 attacks defending group 2, killing 143 units + +Immune System: +Group 2 contains 475 units +Infection: +Group 1 contains 786 units +Group 2 contains 4434 units + +Infection group 1 would deal defending group 2 182352 damage +Immune System group 2 would deal defending group 1 11875 damage +Immune System group 2 would deal defending group 2 11875 damage + +Immune System group 2 attacks defending group 1, killing 2 units +Infection group 1 attacks defending group 2, killing 142 units + +Immune System: +Group 2 contains 333 units +Infection: +Group 1 contains 784 units +Group 2 contains 4434 units + +Infection group 1 would deal defending group 2 181888 damage +Immune System group 2 would deal defending group 1 8325 damage +Immune System group 2 would deal defending group 2 8325 damage + +Immune System group 2 attacks defending group 1, killing 1 unit +Infection group 1 attacks defending group 2, killing 142 units + +Immune System: +Group 2 contains 191 units +Infection: +Group 1 contains 783 units +Group 2 contains 4434 units + +Infection group 1 would deal defending group 2 181656 damage +Immune System group 2 would deal defending group 1 4775 damage +Immune System group 2 would deal defending group 2 4775 damage + +Immune System group 2 attacks defending group 1, killing 1 unit +Infection group 1 attacks defending group 2, killing 142 units + +Immune System: +Group 2 contains 49 units +Infection: +Group 1 contains 782 units +Group 2 contains 4434 units + +Infection group 1 would deal defending group 2 181424 damage +Immune System group 2 would deal defending group 1 1225 damage +Immune System group 2 would deal defending group 2 1225 damage + +Immune System group 2 attacks defending group 1, killing 0 units +Infection group 1 attacks defending group 2, killing 49 units + +Immune System: +No groups remain. +Infection: +Group 1 contains 782 units +Group 2 contains 4434 units + +In the example above, the winning army ends up with 782 + 4434 = 5216 units. + +You scan the reindeer's condition (your puzzle input); the white-bearded man looks nervous. As it stands now, how many units would the winning army have? + +--- Part Two --- + +Things aren't looking good for the reindeer. The man asks whether more milk and cookies would help you think. + +If only you could give the reindeer's immune system a boost, you might be able to change the outcome of the combat. + +A boost is an integer increase in immune system units' attack damage. For example, if you were to boost the above example's immune system's units by 1570, the armies would instead look like this: + +Immune System: +17 units each with 5390 hit points (weak to radiation, bludgeoning) with + an attack that does 6077 fire damage at initiative 2 +989 units each with 1274 hit points (immune to fire; weak to bludgeoning, + slashing) with an attack that does 1595 slashing damage at initiative 3 + +Infection: +801 units each with 4706 hit points (weak to radiation) with an attack + that does 116 bludgeoning damage at initiative 1 +4485 units each with 2961 hit points (immune to radiation; weak to fire, + cold) with an attack that does 12 slashing damage at initiative 4 + +With this boost, the combat proceeds differently: + +Immune System: +Group 2 contains 989 units +Group 1 contains 17 units +Infection: +Group 1 contains 801 units +Group 2 contains 4485 units + +Infection group 1 would deal defending group 2 185832 damage +Infection group 1 would deal defending group 1 185832 damage +Infection group 2 would deal defending group 1 53820 damage +Immune System group 2 would deal defending group 1 1577455 damage +Immune System group 2 would deal defending group 2 1577455 damage +Immune System group 1 would deal defending group 2 206618 damage + +Infection group 2 attacks defending group 1, killing 9 units +Immune System group 2 attacks defending group 1, killing 335 units +Immune System group 1 attacks defending group 2, killing 32 units +Infection group 1 attacks defending group 2, killing 84 units + +Immune System: +Group 2 contains 905 units +Group 1 contains 8 units +Infection: +Group 1 contains 466 units +Group 2 contains 4453 units + +Infection group 1 would deal defending group 2 108112 damage +Infection group 1 would deal defending group 1 108112 damage +Infection group 2 would deal defending group 1 53436 damage +Immune System group 2 would deal defending group 1 1443475 damage +Immune System group 2 would deal defending group 2 1443475 damage +Immune System group 1 would deal defending group 2 97232 damage + +Infection group 2 attacks defending group 1, killing 8 units +Immune System group 2 attacks defending group 1, killing 306 units +Infection group 1 attacks defending group 2, killing 29 units + +Immune System: +Group 2 contains 876 units +Infection: +Group 2 contains 4453 units +Group 1 contains 160 units + +Infection group 2 would deal defending group 2 106872 damage +Immune System group 2 would deal defending group 2 1397220 damage +Immune System group 2 would deal defending group 1 1397220 damage + +Infection group 2 attacks defending group 2, killing 83 units +Immune System group 2 attacks defending group 2, killing 427 units + +After a few fights... + +Immune System: +Group 2 contains 64 units +Infection: +Group 2 contains 214 units +Group 1 contains 19 units + +Infection group 2 would deal defending group 2 5136 damage +Immune System group 2 would deal defending group 2 102080 damage +Immune System group 2 would deal defending group 1 102080 damage + +Infection group 2 attacks defending group 2, killing 4 units +Immune System group 2 attacks defending group 2, killing 32 units + +Immune System: +Group 2 contains 60 units +Infection: +Group 1 contains 19 units +Group 2 contains 182 units + +Infection group 1 would deal defending group 2 4408 damage +Immune System group 2 would deal defending group 1 95700 damage +Immune System group 2 would deal defending group 2 95700 damage + +Immune System group 2 attacks defending group 1, killing 19 units + +Immune System: +Group 2 contains 60 units +Infection: +Group 2 contains 182 units + +Infection group 2 would deal defending group 2 4368 damage +Immune System group 2 would deal defending group 2 95700 damage + +Infection group 2 attacks defending group 2, killing 3 units +Immune System group 2 attacks defending group 2, killing 30 units + +After a few more fights... + +Immune System: +Group 2 contains 51 units +Infection: +Group 2 contains 40 units + +Infection group 2 would deal defending group 2 960 damage +Immune System group 2 would deal defending group 2 81345 damage + +Infection group 2 attacks defending group 2, killing 0 units +Immune System group 2 attacks defending group 2, killing 27 units + +Immune System: +Group 2 contains 51 units +Infection: +Group 2 contains 13 units + +Infection group 2 would deal defending group 2 312 damage +Immune System group 2 would deal defending group 2 81345 damage + +Infection group 2 attacks defending group 2, killing 0 units +Immune System group 2 attacks defending group 2, killing 13 units + +Immune System: +Group 2 contains 51 units +Infection: +No groups remain. + +This boost would allow the immune system's armies to win! It would be left with 51 units. + +You don't even know how you could boost the reindeer's immune system or what effect it might have, so you need to be cautious and find the smallest boost that would allow the immune system to win. + +How many units does the immune system have left after getting the smallest boost it needs to win? diff --git a/www/statics/aoc/2018/24_input.txt b/www/statics/aoc/2018/24_input.txt new file mode 100644 index 0000000..9bace38 --- /dev/null +++ b/www/statics/aoc/2018/24_input.txt @@ -0,0 +1,23 @@ +Immune System: +337 units each with 6482 hit points (weak to radiation, fire; immune to cold, bludgeoning) with an attack that does 189 slashing damage at initiative 15 +571 units each with 3178 hit points (weak to fire) with an attack that does 47 slashing damage at initiative 12 +116 units each with 7940 hit points with an attack that does 638 fire damage at initiative 18 +6017 units each with 9349 hit points (weak to cold) with an attack that does 14 cold damage at initiative 6 +2246 units each with 4002 hit points (weak to radiation, slashing) with an attack that does 16 cold damage at initiative 3 +3950 units each with 4493 hit points (weak to bludgeoning; immune to radiation, fire) with an attack that does 10 radiation damage at initiative 8 +7494 units each with 1141 hit points (immune to bludgeoning) with an attack that does 1 cold damage at initiative 17 +2501 units each with 9007 hit points with an attack that does 35 cold damage at initiative 7 +844 units each with 3222 hit points (immune to bludgeoning, slashing) with an attack that does 37 radiation damage at initiative 9 +1371 units each with 3695 hit points (immune to cold) with an attack that does 25 cold damage at initiative 10 + +Infection: +2295 units each with 16577 hit points (immune to radiation) with an attack that does 12 fire damage at initiative 13 +837 units each with 6736 hit points (weak to fire) with an attack that does 14 radiation damage at initiative 19 +2841 units each with 9360 hit points (immune to bludgeoning; weak to radiation, cold) with an attack that does 6 fire damage at initiative 14 +7374 units each with 51597 hit points (weak to cold; immune to bludgeoning, fire) with an attack that does 12 radiation damage at initiative 1 +1544 units each with 29226 hit points (weak to fire, bludgeoning) with an attack that does 35 bludgeoning damage at initiative 5 +293 units each with 13961 hit points (immune to slashing; weak to radiation) with an attack that does 79 radiation damage at initiative 2 +1219 units each with 38142 hit points (immune to cold, fire) with an attack that does 53 bludgeoning damage at initiative 4 +5233 units each with 30595 hit points (weak to bludgeoning, cold; immune to fire) with an attack that does 11 radiation damage at initiative 11 +397 units each with 43710 hit points (weak to slashing, radiation; immune to cold, bludgeoning) with an attack that does 171 slashing damage at initiative 16 +1316 units each with 36203 hit points (weak to slashing, bludgeoning) with an attack that does 50 cold damage at initiative 20 diff --git a/www/statics/aoc/2018/25-1.linq b/www/statics/aoc/2018/25-1.linq new file mode 100644 index 0000000..68c825b --- /dev/null +++ b/www/statics/aoc/2018/25-1.linq @@ -0,0 +1,44 @@ + + +void Main() +{ + var points = File + .ReadAllLines(Path.Combine(Path.GetDirectoryName(Util.CurrentQueryPath), @"25_input.txt")) + .Select(p => p.Split(',').Select(q => int.Parse(q.Trim())).ToArray()) + .ToList(); + + var constellations = new List>(); + + while(points.Any()) + { + var p = points.First(); + points.RemoveAt(0); + constellations.Add(Constell(p, points).ToList()); + } + + //constellations.Select(c => c.Select(q => string.Join(" ; ", q))).Dump(); + constellations.Count().Dump(); +} + +IEnumerable Constell(int[] p, List points) +{ + yield return p; + for(;;) + { + var f=false; + for (int i = 0; i < points.Count; i++) + { + if (Dist(p, points[i]) <= 3) + { + var np = points[i]; + points.RemoveAt(i); + foreach (var p2 in Constell(np, points)) yield return p2; + f=true; + break; + } + } + if (!f) yield break; + } +} + +int Dist(int[] a, int[] b) => Math.Abs(a[0] - b[0]) + Math.Abs(a[1] - b[1]) + Math.Abs(a[2] - b[2]) + Math.Abs(a[3] - b[3]); \ No newline at end of file diff --git a/www/statics/aoc/2018/25_challenge.txt b/www/statics/aoc/2018/25_challenge.txt new file mode 100644 index 0000000..c1b97f7 --- /dev/null +++ b/www/statics/aoc/2018/25_challenge.txt @@ -0,0 +1,89 @@ +--- 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". + +"Hello, and welcome to the Time Travel Support Hotline! If you are lost in time and space, press 1. If you are trapped in a time paradox, press 2. If you need help caring for a sick reindeer, press 3. If you--" + +Beep. + +A few seconds later, you hear a new voice. "Hello; please state the nature of your reindeer." You try to describe the situation. + +"Just a moment, I think I can remotely run a diagnostic scan." A beam of light projects from the device and sweeps over the reindeer a few times. + +"Okay, it looks like your reindeer is very low on magical energy; it should fully recover if we can fix that. Let me check your timeline for a source.... Got one. There's actually a powerful source of magical energy about 1000 years forward from you, and at roughly your position, too! It looks like... hot chocolate? Anyway, you should be able to travel there to pick some up; just don't forget a mug! Is there anything else I can help you with today?" + +You explain that your device isn't capable of going forward in time. "I... see. That's tricky. Well, according to this information, your device should have the necessary hardware to open a small portal and send some hot chocolate back to you. You'll need a list of fixed points in spacetime; I'm transmitting it to you now." + +"You just need to align your device to the constellations of fixed points so that it can lock on to the destination and open the portal. Let me look up how much hot chocolate that breed of reindeer needs." + +"It says here that your particular reindeer is-- this can't be right, it says there's only one like that in the universe! But THAT means that you're--" You disconnect the call. + +The list of fixed points in spacetime (your puzzle input) is a set of four-dimensional coordinates. To align your device, acquire the hot chocolate, and save the reindeer, you just need to find the number of constellations of points in the list. + +Two points are in the same constellation if their manhattan distance apart is no more than 3 or if they can form a chain of points, each a manhattan distance no more than 3 from the last, between the two of them. (That is, if a point is close enough to a constellation, it "joins" that constellation.) For example: + + 0,0,0,0 + 3,0,0,0 + 0,3,0,0 + 0,0,3,0 + 0,0,0,3 + 0,0,0,6 + 9,0,0,0 +12,0,0,0 + +In the above list, the first six points form a single constellation: 0,0,0,0 is exactly distance 3 from the next four, and the point at 0,0,0,6 is connected to the others by being 3 away from 0,0,0,3, which is already in the constellation. The bottom two points, 9,0,0,0 and 12,0,0,0 are in a separate constellation because no point is close enough to connect them to the first constellation. So, in the above list, the number of constellations is 2. (If a point at 6,0,0,0 were present, it would connect 3,0,0,0 and 9,0,0,0, merging all of the points into a single giant constellation instead.) + +In this example, the number of constellations is 4: + +-1,2,2,0 +0,0,2,-2 +0,0,0,-2 +-1,2,0,0 +-2,-2,-2,2 +3,0,2,-1 +-1,3,2,2 +-1,0,-1,0 +0,2,1,-2 +3,0,0,0 + +In this one, it's 3: + +1,-1,0,1 +2,0,-1,0 +3,2,-1,0 +0,0,3,1 +0,0,-1,-1 +2,3,-2,0 +-2,2,0,0 +2,-2,0,-1 +1,-1,0,-1 +3,2,0,2 + +Finally, in this one, it's 8: + +1,-1,-1,-2 +-2,-2,0,1 +0,2,1,3 +-2,3,-2,1 +0,2,3,-2 +-1,-1,1,-2 +0,-2,-1,0 +-2,2,3,-1 +1,2,2,0 +-1,-2,0,-2 + +The portly man nervously strokes his white beard. It's time to get that hot chocolate. + +How many constellations are formed by the fixed points in spacetime? + +--- Part Two --- + +A small glowing portal opens above the mug you prepared and just enough hot chocolate streams in to fill it. You suspect the reindeer has never encountered hot chocolate before, but seems to enjoy it anyway. You hope it works. + +It's time to start worrying about that integer underflow in time itself you set up a few days ago. You check the status of the device: "Insufficient chronal energy for activation. Energy required: 50 stars." + +The reindeer bumps the device with its nose. + +"Energy required: 49 stars." diff --git a/www/statics/aoc/2018/25_input.txt b/www/statics/aoc/2018/25_input.txt new file mode 100644 index 0000000..2e6a4f6 --- /dev/null +++ b/www/statics/aoc/2018/25_input.txt @@ -0,0 +1,1177 @@ +-2,0,6,-4 +-5,-7,1,-5 +0,6,3,7 +1,8,4,-4 +7,-8,4,4 +-4,7,-2,8 +-7,2,-8,-6 +-7,-8,5,0 +8,0,4,0 +-8,1,3,5 +0,-2,-4,3 +-1,-4,6,6 +-7,-6,-4,4 +3,-7,-5,3 +-2,-8,0,-5 +4,3,0,0 +-3,-1,-1,0 +6,-5,1,-7 +2,0,0,1 +7,8,2,8 +-1,0,3,-2 +2,-4,-4,8 +4,-8,-7,-5 +-3,1,2,1 +-3,3,5,0 +-8,8,7,8 +-2,-5,7,4 +-4,-7,3,3 +-6,-6,5,-4 +-2,7,0,-2 +0,8,0,-5 +-6,-7,6,-3 +-6,3,3,7 +-3,0,0,-1 +-5,-6,-7,0 +-3,-2,5,0 +0,-6,-4,7 +-7,3,8,-6 +-5,0,-5,-2 +-1,7,6,-5 +-5,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/www/statics/aoc/__all.php new file mode 100644 index 0000000..2402b9f --- /dev/null +++ b/www/statics/aoc/__all.php @@ -0,0 +1,37 @@ + + [ + ['day' => 1, 'parts' => 2, 'title' => 'Chronal Calibration', 'languages' => ['cs'], 'solutions' => ['490', '70357'] ], + ['day' => 2, 'parts' => 2, 'title' => 'Inventory Management System', 'languages' => ['cs'], 'solutions' => ['5434', 'agimdjvlhedpsyoqfzuknpjwt'] ], + ['day' => 3, 'parts' => 2, 'title' => 'No Matter How You Slice It', 'languages' => ['cs'], 'solutions' => ['116489', '1260'] ], + ['day' => 4, 'parts' => 2, 'title' => 'Repose Record', 'languages' => ['cs'], 'solutions' => ['143415', '49944'] ], + ['day' => 5, 'parts' => 2, 'title' => 'Alchemical Reduction', 'languages' => ['cs'], 'solutions' => ['10368', '4122'] ], + ['day' => 6, 'parts' => 2, 'title' => 'Chronal Coordinates', 'languages' => ['cs'], 'solutions' => ['2917', '44202'] ], + ['day' => 7, 'parts' => 2, 'title' => 'The Sum of Its Parts', 'languages' => ['cs'], 'solutions' => ['GKPTSLUXBIJMNCADFOVHEWYQRZ', '920'] ], + ['day' => 8, 'parts' => 2, 'title' => 'Memory Maneuver', 'languages' => ['cs'], 'solutions' => ['45194', '22989'] ], + ['day' => 9, 'parts' => 2, 'title' => 'Marble Mania', 'languages' => ['cs'], 'solutions' => ['398242', '3273842452'] ], + ['day' => 10, 'parts' => 2, 'title' => 'The Stars Align', 'languages' => ['cs'], 'solutions' => ['KFLBHXGK', '10659'] ], + ['day' => 11, 'parts' => 2, 'title' => 'Chronal Charge', 'languages' => ['cs'], 'solutions' => ['34,13', '280,218,11'] ], + ['day' => 12, 'parts' => 2, 'title' => 'Subterranean Sustainability', 'languages' => ['cs'], 'solutions' => ['3738', '3900000002467'] ], + ['day' => 13, 'parts' => 2, 'title' => 'Mine Cart Madness', 'languages' => ['cs'], 'solutions' => ['124,90', '145,88'] ], + ['day' => 14, 'parts' => 2, 'title' => 'Chocolate Charts', 'languages' => ['cs'], 'solutions' => ['9276422810', '20319117'] ], + ['day' => 15, 'parts' => 2, 'title' => 'Beverage Bandits', 'languages' => ['cs'], 'solutions' => ['201123', '54188'] ], + ['day' => 16, 'parts' => 2, 'title' => 'Chronal Classification', 'languages' => ['cs'], 'solutions' => ['592', '557'] ], + ['day' => 17, 'parts' => 2, 'title' => 'Reservoir Research', 'languages' => ['cs'], 'solutions' => ['33004', '23294'] ], + ['day' => 18, 'parts' => 2, 'title' => 'Settlers of The North Pole', 'languages' => ['cs'], 'solutions' => ['536370', '190512'] ], + ['day' => 19, 'parts' => 2, 'title' => 'Go With The Flow', 'languages' => ['cs'], 'solutions' => ['1440', '15827040'] ], + ['day' => 20, 'parts' => 2, 'title' => 'A Regular Map', 'languages' => ['cs'], 'solutions' => ['3675', '7953'] ], + ['day' => 21, 'parts' => 2, 'title' => 'Chronal Conversion', 'languages' => ['cs'], 'solutions' => ['103548', '14256686'] ], + ['day' => 22, 'parts' => 2, 'title' => 'Mode Maze', 'languages' => ['cs'], 'solutions' => ['11972', '1092'] ], + ['day' => 23, 'parts' => 2, 'title' => 'Experimental Emergency Teleportation', 'languages' => ['cs'], 'solutions' => ['417', '112997634'] ], + ['day' => 24, 'parts' => 2, 'title' => 'Immune System Simulator 20XX', 'languages' => ['cs'], 'solutions' => ['21070', '7500'] ], + ['day' => 25, 'parts' => 1, 'title' => 'Four-Dimensional Adventure', 'languages' => ['cs'], 'solutions' => ['407'] ], + ], + '2019' => + [ + // + ], + ]; \ No newline at end of file diff --git a/www/statics/blog/__all.php b/www/statics/blog/__all.php index a04286a..9a13207 100644 --- a/www/statics/blog/__all.php +++ b/www/statics/blog/__all.php @@ -24,4 +24,6 @@ return [ 'id' => 9, 'date' => '2016-10-22', 'visible' => true, 'title' => 'A complete sudoku solver in Befunge-93', 'fragment' => 'sudoku_befunge.md', 'type' => 'markdown', 'cat' => 'blog' ], [ 'id' => 21, 'date' => '2018-01-02', 'visible' => true, 'title' => 'A simple javascript befunge-93 runner', 'fragment' => 'js_befrunner.md', 'type' => 'markdown', 'cat' => 'blog' ], [ 'id' => 22, 'date' => '2018-02-06', 'visible' => true, 'title' => 'Homepage iteration 5', 'fragment' => 'v5.md', 'type' => 'markdown', 'cat' => 'log' ], + [ 'id' => 23, 'date' => '2019-11-02', 'visible' => true, 'title' => 'Advent of Code 2018', 'fragment' => '', 'type' => 'aoc', 'cat' => 'blog', 'extras' => ['aoc:year' => '2018'] ], + [ 'id' => 24, 'date' => '2019-12-01', 'visible' => false, 'title' => 'Advent of Code 2019', 'fragment' => '', 'type' => 'aoc', 'cat' => 'blog', 'extras' => ['aoc:year' => '2019'] ], ]; \ No newline at end of file