prettier
This commit is contained in:
parent
b1cf1719a3
commit
c7b8b6a8c8
@ -18,7 +18,8 @@ sub parse_input($input) {
|
||||
|
||||
return {
|
||||
directions => $directions,
|
||||
nodes => \%nodes };
|
||||
nodes => \%nodes
|
||||
};
|
||||
}
|
||||
|
||||
sub solution_1 ($input) {
|
||||
@ -33,7 +34,8 @@ sub solution_1 ($input) {
|
||||
while ( $current ne 'ZZZ' ) {
|
||||
$visited++;
|
||||
|
||||
$current = $nodes{$current}->[ $directions[$next_index++ % @directions ] ];
|
||||
$current =
|
||||
$nodes{$current}->[ $directions[ $next_index++ % @directions ] ];
|
||||
}
|
||||
|
||||
return $visited;
|
||||
|
@ -6,7 +6,6 @@ use Part1;
|
||||
|
||||
use List::AllUtils qw/ /;
|
||||
|
||||
|
||||
sub solution_2 ($input) {
|
||||
...;
|
||||
}
|
||||
|
@ -13,7 +13,8 @@ my %solutions = deserialize_file('solutions.yml')->%*;
|
||||
|
||||
my $parsed = Part1::parse_input($example);
|
||||
|
||||
use DDP; p $parsed;
|
||||
use DDP;
|
||||
p $parsed;
|
||||
|
||||
is $parsed->{directions} => [ 1, 0 ];
|
||||
is $parsed->{nodes}{AAA} => [qw/ BBB CCC /];
|
||||
@ -32,6 +33,4 @@ END
|
||||
is Part1::solution_1($input) => $solutions{1};
|
||||
}
|
||||
|
||||
|
||||
|
||||
done_testing;
|
||||
|
Loading…
Reference in New Issue
Block a user