From ab399e76f3712a096b87cd5a019c6981c3fde323 Mon Sep 17 00:00:00 2001 From: "Jan \"Yenya\" Kasprzak" Date: Thu, 14 Dec 2023 18:20:14 +0100 Subject: [PATCH] Day 14 part 2: minor cleanup --- 2023/28.pl | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/2023/28.pl b/2023/28.pl index 2d147f4..f0547dd 100755 --- a/2023/28.pl +++ b/2023/28.pl @@ -5,7 +5,8 @@ use v5.38; my $map; { local $/; $map = <>; } my (@score, %seen, $round); -while (++$round) { +while (!$seen{$map}) { + $seen{$map} = $round++; for (1 .. 4) { my $map1; do { # rotate the map: @@ -16,9 +17,6 @@ while (++$round) { } $score[$round] +=()= substr($map, pos($map)) =~ /\n/g while $map =~ /O/g; - - last if $seen{$map}; - $seen{$map} = $round; } my $remains = (1000000000 - $round) % ($round - $seen{$map}); -- 2.43.5