commit f11534a75a5ead557232193fb7518f1139c3ef54
parent fe8dff04d75dff3a58583c6277b131a38df93441
Author: Samir Parikh <noreply@samirparikh.com>
Date: Sat, 5 Nov 2022 01:38:16 +0000
cleanup code
Diffstat:
1 file changed, 1 insertion(+), 15 deletions(-)
diff --git a/day13/day13.pl b/day13/day13.pl
@@ -3,17 +3,16 @@
use strict;
use warnings;
-use diagnostics;
use v5.32;
use List::Util qw( max );
use Algorithm::Permute;
-use Data::Dumper;
@ARGV = "input" unless @ARGV;
chomp( my $input = do { local $/; <> } );
my @deltas = split /\n/, $input;
my %people;
my %hap_units;
+my @answers;
foreach ( @deltas ) {
my ( $person, $gain_lose, $units, $neighbor ) =
@@ -23,17 +22,6 @@ foreach ( @deltas ) {
}
my @people = sort keys %people;
-my @answers;
-
-#foreach my $person ( keys %hap_units ) {
-# foreach my $neighbor ( keys %{ $hap_units{ $person } } ) {
-# say "sitting $person next to $neighbor would net ",
-# $hap_units{ $person }{ $neighbor }, " points.";
-# }
-#}
-
-#say @people;
-#say "-------------";
Algorithm::Permute::permute {
# since we are already iterating on @people, it is a read-only variable
@@ -41,10 +29,8 @@ Algorithm::Permute::permute {
# we have to copy it into a new variable, @seat_assign
my @seat_assign = @people;
my $hap_change = 0;
- print @seat_assign, " ---> ";
unshift @seat_assign => $seat_assign[ -1 ];
push @seat_assign => $seat_assign[ 1 ];
- say @seat_assign;
foreach my $position ( 1 .. scalar @people ) {
my $person = $seat_assign[ $position ];
my $left = $seat_assign[ $position - 1 ];