J 79
echo((6!:0'')(('',:'Happy birthday to me!'){~])@:-:&(1 2&{)&:>])1{,1!:0{:4!:3''
Bonus version120 - 15% = 102
Do I get extra credit for also printing both when both are having their birthday?
echo((2 6$(6!:0 '') , 0 2 7)(' ','Happy birthday to ',"2 1]3 5$'you! me! both!'){~#.@:(-:&(1 2&{)"1)&:>])1{,1!:0{:4!:3''
Explanation (right to left):
last =: {:4!:3'' NB. Take the last script run (i.e. the file itself)
time =: 1{,1!:0 last NB. the modification time is the second element in that file's listing
The central verb of the train
unbox_both =: &:> NB. unboxes left and right argument
match =: -:&(1 2&{)"1 NB. for each date given, left and right, compare them
to_int =: #. NB. convert boolean to int
from =: {~ NB. from the left array, take element right.
NB. H contains messages an empty row, appended to all combinations of messages.
H =: (' ','Happy birthday to ',"2 1]3 5$'you! me! both!')
V =: (H from to_int)@:match unbox_both NB. after unboxing and comparing,
NB. select the according message
The left tine for the central train:
dates=: (2 6$(6!:0 '') , 0 2 7) NB. the current date, and the relevant fields of my birthday.
NB. Combining the bricks:
echo (dates V ]) time NB. output the monads result on time.