3
\$\begingroup\$

Input

Two dates, each comprising of a month (Dec or Jan) and a day (01-31). These will be given as 4 integers (12 01 01 01, for example), in any reasonable format you choose (leading zeroes, no leading zeroes, list, individual inputs, list of lists, etc.). The first date is supposed to represent today's date.

Output

  • If the second input date is Dec 14, output Sufganiyot
  • If it is Dec 18, output A new hope
  • For Dec 23, The airing of grievances
  • For Dec 25, O Tannenbaum
  • For Dec 31 or Jan 1, Auld Lang Syne
  • Otherwise output Try some other day! (in which case you will not compare the dates, see below)

This is followed by

  • , Go and get it! if the first and second input dates are same.
  • , Wait for it! if the first date comes before the second date.
  • , But you missed it! if the first date comes after the second date.

Sample runs

Dec 23 Dec 23 -> The airing of grievances, Go and get it!

Dec 28 Jan 1 -> Auld Lang Syne, Wait for it!

Dec 18 Dec 17 -> Try some other day!

Jan 25 Dec 25 -> O Tannenbaum, But you missed it!

Score

This is code golf, so shortest code in bytes wins.

\$\endgroup\$
  • 2
    \$\begingroup\$ You should be more prescriptive about the date format. "Any other format" is open to all kinds of misinterpretation. Is 1225 for Christmas Day and 0101 for New Years day acceptable? I could even say that my program uses a "format" where December 18 is represented by A new hope \$\endgroup\$ – Level River St Dec 15 '15 at 18:28
  • 1
    \$\begingroup\$ What do you mean "for convenience"? How many bytes do you get for free? \$\endgroup\$ – Not that Charles Dec 15 '15 at 18:28
  • 1
    \$\begingroup\$ @steveverrill So the only parts to golf are: 1) Comparing dates, and 2) a switch statement, right? \$\endgroup\$ – Not that Charles Dec 15 '15 at 18:35
  • 2
    \$\begingroup\$ Both the date format and the final paragraph are very open to interpretation. \$\endgroup\$ – Doorknob Dec 15 '15 at 19:38
  • 1
    \$\begingroup\$ Please use the Sandbox before posting a challenge so due time is given to working out little details. \$\endgroup\$ – cat Dec 15 '15 at 19:42
1
\$\begingroup\$

Java, 400 340 333 - 139 = 261 201 194 bytes

I considered these characters "convenient":

, Go and get it!, Wait for it!, But you missed it!Try some other day!Auld Lang SyneO TannenbaumThe airing of grievancesA new hopeSufganiyot

Here is the code (called with s(first month number, first month date, second month number, second month date)):

String s(int a,int b,int c,int d){String x="";int e=(a*b!=1)?a*b:372;if(e==372)x="Auld Lang Syne";if(e==216)x="A new hope";if(e==276)x="The airing of grievances";if(e==300)x="O Tannenbaum";if(x=="")return"Try some other day!";int f=(c==1)?372*d:c*d;return x+", "+((e>f)?"Wait for it...":(e<f)?"But you missed it!":"Go and get it!");}

Ungolfed:

static String v(int a,int b,int c,int d){
    String x="";
    int e=(a*b!=1)?a*b:372;
    if(e==372)x="Auld Lang Syne";
    if(e==216)x="A new hope";
    if(e==276)x="The airing of grievances";
    if(e==300)x="O Tannenbaum";
    if(x=="")return"Try some other day!";
    int f=(c==1)?372*d:c*d;
    return x+", "+((e>f)?"Wait for it...":(e<f)?"But you missed it!":"Go and get it!");
}
\$\endgroup\$
  • \$\begingroup\$ why do you need the static keyword? You could remove that and the space for -7 bytes. \$\endgroup\$ – Ashwin Gupta Dec 18 '15 at 4:11
  • 1
    \$\begingroup\$ @AshwinGupta You'll also notice that I haven't included it in the golfed declaration. ;) \$\endgroup\$ – Addison Crump Dec 19 '15 at 2:18
0
\$\begingroup\$

Mouse-2002, 664 - 171 = 493 bytes

I consider the following strings "convenient":

"Sufganiyot""A new hope""The airing of grievances""O Tannenbaum""Auld Lang Syne""Auld Lang Syne"", go and get it!"", wait for it!"", but you missed it""Try some other day"

And the code:

?a:?b:?c:?d:c.12=[d.14=["Sufganiyot"a.12=[b.14=[#R,1;|b.14<[#R,2;|b.14>[#R,3;]]]|a.1=[#R,3;]]|d.18=["A new hope"|a.12=[b.18=[#R,1;|b.18<[#R,2;|b.18>[#R,3;]]]|a.1=[#R,3;]]|d.23=["The airing of grievances"|a.12=[b.23=[#R,1;|b.23<[#R,2;|b.23>[#R,3;]]]|a.1=[#R,3;]]|d.25=["O Tannenbaum"|a.12=[b.23=[#R,1;|b.23<[#R,2;|b.23>[#R,3;]]]|a.1=[#R,3;]]|d.31=["Auld Lang Syne"|a.12=[b.31=[#R,1;|b.31<[#R,2;|b.31>[#R,3;]]]|a.1=[b.1=[#R,1;|b.1<[#R,2;|b.1>[#R,3;]]]]]]]]]]|c.1=[d.1=["Auld Lang Syne"|a.1=[b.1=[#R,1;|b.1<[#R,2;|b.1>[#R,3;]]]]]|#R,4;]]$R1%a:a.1=[", Go and get it"#E;|a.2=[", Wait for it"#E;|a.3=[", But you missed it"#E;|a.4=["Try some other day"#E;]]]]@$E33!'"!"@$

Ungolfed:

~ Create a Winter Bash 2015 hat reminder

? a: ? b: ? c: ? d:

c. 12 = [ d. 14 = [ "Sufganiyot" a. 12 = [ b. 14 = [ #R,1; | b. 14 < [ #R,2; | b. 14 > [ #R,3; ] ] ] | a. 1 = [ #R,3; ] ] | d. 18 = [ "A new hope" | a. 12 = [ b. 18 = [ #R,1; | b. 18 < [ #R,2; | b. 18 > [ #R,3; ] ] ] | a. 1 = [ #R,3; ] ] | d. 23 = [ "The airing of grievances" | a. 12 = [ b. 23 = [ #R,1; | b. 23 < [ #R,2; | b. 23 > [ #R,3; ] ] ] | a. 1 = [ #R,3; ] ] | d. 25 = [ "O Tannenbaum" | a. 12 = [ b. 23 = [ #R,1; | b. 23 < [ #R,2; | b. 23 > [ #R,3; ] ] ] | a. 1 = [ #R,3; ] ] | d. 31 = [ "Auld Lang Syne" | a. 12 = [ b. 31 = [ #R,1; | b. 31 < [ #R,2; | b. 31 > [ #R,3; ] ] ] | a. 1 = [ b. 1 = [ #R,1; | b. 1 < [ #R,2; | b. 1 > [ #R,3; ] ] ] ] ] ] ] ] ] ] | c. 1 = [ d. 1 = [ "Auld Lang Syne" | a. 1 = [ b. 1 = [ #R,1; | b. 1 < [ #R,2; | b. 1 > [ #R,3; ] ] ] ] ] | #R,4; ] ]

$R 1% a: a. 1 = [ ", Go and get it" #E; | a. 2 = [ ", Wait for it" #E; | a. 3 = [ ", But you missed it" #E; | a. 4 = [ "Try some other day" #E; ] ] ] ] @ $E33!'"!"@ $

I am never, ever, ever going anywhere near this thing ever, ever again.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.