2023-12-01 18:03:18 +00:00
|
|
|
use 5.38.0;
|
|
|
|
|
|
|
|
use Test2::V0;
|
|
|
|
|
|
|
|
use Path::Tiny;
|
|
|
|
|
|
|
|
use Part1;
|
|
|
|
|
2023-12-02 16:17:13 +00:00
|
|
|
|
|
|
|
is Part1::parse_line("Game 1: 3 blue, 4 red; 1 red, 2 green, 6 blue; 2 green") => +{ game => 1, entries => [
|
|
|
|
{ blue => 3, red => 4 }, { red => 1, green => 2, blue => 6},
|
|
|
|
{ green => 2 },
|
|
|
|
]};
|
|
|
|
|
2023-12-02 16:28:35 +00:00
|
|
|
is Part1::solution_1( <<'END' ) => 8;
|
|
|
|
Game 1: 3 blue, 4 red; 1 red, 2 green, 6 blue; 2 green
|
|
|
|
Game 2: 1 blue, 2 green; 3 green, 4 blue, 1 red; 1 green, 1 blue
|
|
|
|
Game 3: 8 green, 6 blue, 20 red; 5 blue, 4 red, 13 green; 5 green, 1 red
|
|
|
|
Game 4: 1 green, 3 red, 6 blue; 3 green, 6 red; 3 green, 15 blue, 14 red
|
|
|
|
Game 5: 6 red, 1 blue, 3 green; 2 blue, 1 red, 2 green
|
|
|
|
END
|
2023-12-02 16:17:13 +00:00
|
|
|
|
2023-12-01 18:03:18 +00:00
|
|
|
my $input = path('input')->slurp;
|
|
|
|
|
2023-12-02 16:28:35 +00:00
|
|
|
is Part1::solution_1($input) => 1853;
|
|
|
|
|
|
|
|
done_testing();
|