about summary refs log tree commit diff
diff options
context:
space:
mode:
authorLeah Neukirchen <leah@vuxu.org>2019-12-11 22:29:21 +0100
committerLeah Neukirchen <leah@vuxu.org>2019-12-11 22:29:21 +0100
commitcf1fe41d4fc13725f15adfe7a8ca4094adb70a80 (patch)
treec6a0c77bc8381f576f35eb4efee79857a69c4d68
parentd87d35be738179dadcade23563c39e812507573d (diff)
downloadadventofcode2019-cf1fe41d4fc13725f15adfe7a8ca4094adb70a80.tar.gz
adventofcode2019-cf1fe41d4fc13725f15adfe7a8ca4094adb70a80.tar.xz
adventofcode2019-cf1fe41d4fc13725f15adfe7a8ca4094adb70a80.zip
day10 (part1 only) HEAD master
-rw-r--r--day10.pl21
1 files changed, 21 insertions, 0 deletions
diff --git a/day10.pl b/day10.pl
new file mode 100644
index 0000000..5061bcd
--- /dev/null
+++ b/day10.pl
@@ -0,0 +1,21 @@
+#!/usr/bin/perl -w
+use v5.16;
+
+use File::Slurper 'read_lines';
+use List::Util qw'max uniq';
+use Math::Complex;
+
+my @as;
+my @l = read_lines('day10t');
+while (my ($x, $l) = each(@l)) {
+    my @c = split('', $l);
+    while (my ($y, $c) = each(@c)) {
+        push @as, cplx($x, $y)  if $c eq "#";
+    }
+}
+
+say max map { my $a = $_; scalar uniq map { arg($a - $_) } @as } @as;
+# 288
+
+# Part 2 TBD
+# 616