day05
This commit is contained in:
parent
1e20c2a640
commit
424e0310af
1097
05/input.txt
Normal file
1097
05/input.txt
Normal file
File diff suppressed because it is too large
Load Diff
13
05/maze.pl
Normal file
13
05/maze.pl
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
|
||||||
|
use 5.20.0;
|
||||||
|
|
||||||
|
my @maze = <>;
|
||||||
|
my $position = 0;
|
||||||
|
my $steps = 0;
|
||||||
|
|
||||||
|
while( $position < @maze ) {
|
||||||
|
$steps++;
|
||||||
|
$position += $maze[$position]++;
|
||||||
|
}
|
||||||
|
|
||||||
|
say $steps;
|
14
05/maze2.pl
Normal file
14
05/maze2.pl
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
use 5.20.0;
|
||||||
|
|
||||||
|
my @maze = <>;
|
||||||
|
my $position = 0;
|
||||||
|
my $steps = 0;
|
||||||
|
|
||||||
|
while( $position < @maze ) {
|
||||||
|
$steps++;
|
||||||
|
my $i = $position;
|
||||||
|
$position += $maze[$position];
|
||||||
|
$maze[$i] += $maze[$i] > 2 ? -1 : 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
say $steps;
|
Loading…
Reference in New Issue
Block a user