TI-Basic (TI-84 Plus CE with OS 5.2+), 64 bytes
getDate
"It's "+toString(Ans(1))+" already, folks, go home.
TI-Basic is a tokenized language. Some commands (getDate
, toString(
, etc.), and all lowercase letters are two-bytes and everything else used here is one byte each.
Explanation:
getDate # 3, store {Y,M,D} in Ans
"It's "+toString(Ans(1))+" already, folks, go home. # 61, implicitly return required string with Y from getDate
TI-Basic (TI-84 Plus CE with OS 5.1), 108 bytes
{0,1→L1
getDate
Ans(1)L1→L2
LinReg(ax+b) Y1
Equ►String(Y1,Str0
sub(Str0,1,length(Str0)-3→Str0
"It's "+Str0+" already, folks, go home.
TI-Basic is a tokenized language. The more complicated user variables (Y1
, L1
, L2
, Str0
), some commands (LinReg(ax+b
, getDate
, sub(
, Equ►String(
, length(
), and all lowercase letters are two-bytes and everything else used here is one byte each.
OS 5.2 added a toString(
command, which obsolesces about half of this submission, which is based off of this algorithm.
Explanation:
{0,1→L1 # 8 bytes
getDate # 3 bytes, store {Y,M,D} list in Ans
Ans(1)L1→L2 # 10 bytes, multiply L1 by the year and store in L2
LinReg(ax+b) Y1 # 5 bytes, take a linear regression of the points specified by each pair of corresponding coordinates in L1 and L2 and store it in Y1
Equ►String(Y1,Str0 # 8 bytes, convert Y1 to a string
sub(Str0,1,length(Str0)-3→Str0 # 18 bytes, remove the "X+0" from LinReg
"It's "+Str0+" already, folks, go home. # 56 bytes, implicitly return the required output
17First test run, got the time instead of the date: It's 8:58 already, folks, go home. – steenbergh – 2017-04-01T09:59:20.923
Can I take input and then ignore it (i.e do something along the lines of
String goHome(Object foo){return "It's "+currentYear()+" already, folks, go home.";}
(but much shorter, of course))? – user8397947 – 2017-04-01T17:02:23.233It's a shame I shouldn't compile the challenge to literally: ///, 46 bytes
It's the current year already, folks, go home.
– Comrade SparklePony – 2017-04-01T17:33:28.3833@steenbergh If only school was that way in the morning. xD :P – HyperNeutrino – 2017-04-01T21:33:18.040
I feel this challenge would be more appropriate if it were "if it's not the current year, output this, else output nothing", but still good challenge +1 – Tas – 2017-04-03T02:50:49.887
Are we allowed to assume that this will be used on years after 2000 or it has to work on whatever year the target machine may support? – Matteo Italia – 2017-04-03T11:49:10.970
@MatteoItalia Yes, Year will be after the Epoch (1900 on most languages). I mean, come on. It's 2017. – Matthew Roh – 2017-04-03T12:01:25.503
@SIGSEGV: let's make this extra clear: I'm talking about after 2000, not after 1900. My language supports 1980-2099, but I can shave some bytes by assuming the year to be always after 2000. – Matteo Italia – 2017-04-03T12:10:56.893
@MatteoItalia ...No. Please don't assume that. – Matthew Roh – 2017-04-03T12:11:38.400
would this be [tag:kolmogorov-complexity]? – FantaC – 2018-03-03T22:41:45.190
@tfbninja I don't think so... It may only change annually, but the output is not constant, and the program does essentially take input (just, from the system and not the user). – brhfl – 2018-03-07T19:47:16.740