]> www.fi.muni.cz Git - aoc.git/blobdiff - lib/Y/AoC.pm
New fancy infrastructure: downloader, inotify watcher, submitter
[aoc.git] / lib / Y / AoC.pm
diff --git a/lib/Y/AoC.pm b/lib/Y/AoC.pm
new file mode 100644 (file)
index 0000000..8fbb606
--- /dev/null
@@ -0,0 +1,26 @@
+package Y::AoC;
+
+use v5.36;
+
+use Exporter qw(import);
+our @EXPORT_OK = qw(red grey white yellow day year);
+
+use FindBin qw($Bin);
+use Term::ANSIColor;
+
+sub red    { colored(['bright_red    on_black'], @_); }
+sub white  { colored(['bright_white  on_black'], @_); }
+sub grey   { colored(['white         on_black'], @_); }
+sub yellow { colored(['bright_yellow on_black'], @_); }
+
+sub day {
+       my ($num) = $0 =~ /.*\D(\d+)/;
+       int ((1+$num)/2);
+}
+
+sub year {
+       my ($num) = $Bin =~ /.*(\d{4})/;
+       $num;
+}
+
+1;