aoc2015

Advent of Code 2015 solutions in Perl.
git clone git://git.samirparikh.com/aoc2015
Log | Files | Refs | README

commit d7e7f44519aaa1b47d4490e550d5d0818edea3ab
parent 7800f64aca5cd485f17443a3fbaf766fd9dd532b
Author: Samir Parikh <noreply@samirparikh.com>
Date:   Tue,  8 Nov 2022 01:33:11 +0000

make last optimizations for the evening

Diffstat:
Mday14/day14.pl | 12++----------
1 file changed, 2 insertions(+), 10 deletions(-)

diff --git a/day14/day14.pl b/day14/day14.pl @@ -33,13 +33,5 @@ foreach my $time ( 1 .. $TIME ) { $reindeer{ $_ }{ points } += 1 foreach @furthest_reindeer; } -# find distance furthest traveled and most points -my @distances; -my @points; - -foreach my $reindeer ( sort keys %reindeer ) { - push @distances => $reindeer{ $reindeer }{ position }; - push @points => $reindeer{ $reindeer }{ points }; -} -say "part 1: ", max @distances; -say "part 2: ", max @points; +say "part 1: ", max map { $reindeer{ $_ }{ position } } keys %reindeer; +say "part 2: ", max map { $reindeer{ $_ }{ points } } keys %reindeer;