about summary refs log tree commit diff
path: root/day10.pl
blob: 5061bcdc36d318331392fe0917c891e495d9c5ec (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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