]> www.fi.muni.cz Git - aoc.git/blob - lib/Y/AoC.pm
8fbb606a6486cba86f744dd9af0332441b61e6de
[aoc.git] / lib / Y / AoC.pm
1 package Y::AoC;
2
3 use v5.36;
4
5 use Exporter qw(import);
6 our @EXPORT_OK = qw(red grey white yellow day year);
7
8 use FindBin qw($Bin);
9 use Term::ANSIColor;
10
11 sub red    { colored(['bright_red    on_black'], @_); }
12 sub white  { colored(['bright_white  on_black'], @_); }
13 sub grey   { colored(['white         on_black'], @_); }
14 sub yellow { colored(['bright_yellow on_black'], @_); }
15
16 sub day {
17         my ($num) = $0 =~ /.*\D(\d+)/;
18         int ((1+$num)/2);
19 }
20
21 sub year {
22         my ($num) = $Bin =~ /.*(\d{4})/;
23         $num;
24 }
25
26 1;