]> www.fi.muni.cz Git - aoc.git/blob - 2019/16.pl
Day 25: examining the input
[aoc.git] / 2019 / 16.pl
1 #!/usr/bin/perl -w
2
3 use v5.16;
4
5 chomp (my $data = <>);
6
7 my @min;
8 my $count = 25*6;
9 my @p;
10 for my $l ($data =~ /.{$count}/g) {
11         my @px = split //, $l;
12         my @p1;
13         for (@px) {
14                 my $p0 = shift @p;
15                 push @p1, !defined $p0 || $p0 == 2 ? $_ : $p0;
16         }
17         @p = @p1;
18         say "---";
19 }
20
21 my $i = 0;
22 for (@p) {
23         print $_ ? '#' : ' ';
24         print "\n" if ++$i % 25 == 0;
25 }