2024-12-10 23:34:16 +00:00
|
|
|
use 5.36.0;
|
|
|
|
|
2024-12-10 23:39:19 +00:00
|
|
|
package AoC::Puzzle;
|
2024-12-10 23:34:16 +00:00
|
|
|
|
|
|
|
use Moo;
|
|
|
|
|
|
|
|
use Path::Tiny;
|
|
|
|
|
|
|
|
has file => ( is => 'ro' );
|
|
|
|
|
|
|
|
has path_file => (
|
|
|
|
is => 'lazy',
|
|
|
|
default => sub ($self) {
|
|
|
|
path( $self->file );
|
|
|
|
}
|
|
|
|
);
|
|
|
|
|
|
|
|
sub day_part ($self) {
|
|
|
|
$self =~ /Part(\d)/g;
|
|
|
|
return $1;
|
|
|
|
}
|
|
|
|
|
|
|
|
sub file_lines ($self) {
|
|
|
|
$self->path_file->lines( { chomp => 1 } );
|
|
|
|
}
|
|
|
|
|
|
|
|
sub file_slurp ($self) {
|
|
|
|
my $content = $self->path_file->slurp;
|
|
|
|
chomp $content;
|
|
|
|
return $content;
|
|
|
|
}
|
|
|
|
|
|
|
|
has input => (
|
|
|
|
is => 'lazy',
|
|
|
|
default => sub { ... }
|
|
|
|
);
|
|
|
|
|
|
|
|
sub solve { ... }
|
|
|
|
|
|
|
|
1;
|