April Fools Day!

4

3

Your challenge is simple: write a program or function which appears to print the first ten numbers of any integer sequence (on OEIS, the answerer may choose which sequence), but instead prints the exact text:

Happy April Fool's Day!

if and only if it is run on April 1st of any year. Run on any other day should make it output its original output. (Unfortunately, I was a little late posting this challenge). Answers should be voted up for clever hiding of the April fools part.

This is a , so the answer with the most votes on May 8th wins!

vikarjramun

Posted 2017-04-02T03:13:56.553

Reputation: 794

Question was closed 2017-04-02T14:48:58.507

1I really liked this challenge until I got to this part if and only if it is run on April 1st of any year. Run on any other day should make it output its original output. Can I take an input for currentDate or something? – Albert Renshaw – 2017-04-02T04:00:28.483

7

Hiding code within other code makes this an underhanded challenge, and these are no longer welcome on the site. Moreover, "most creative" popularity contests lack an objective winning criterion and have fallen out of favor.

– xnor – 2017-04-02T04:44:42.960

This challenge is [tag:underhanded], and such challenges are no longer on-topic. – Erik the Outgolfer – 2017-04-02T08:15:51.590

@EriktheOutgolfer Huh? It looks more like a [tag:decision-problem] to me. – Matthew Roh – 2017-04-02T08:16:27.480

@SIGSEGV Also a [tag:decision-problem], and not [tag:kolmogorov-complexity], but challenges that ask for answers which appear to do something else than what they really do are [tag:underhanded]. – Erik the Outgolfer – 2017-04-02T08:19:22.917

@EriktheOutgolfer No, It's just one answer which does things the 'underhanded' way. – Matthew Roh – 2017-04-02T08:53:32.717

Underhanded challenges are off-topic per community consensus.

– Dennis – 2017-04-02T14:48:58.507

Any ideas on how I can rewrite this question to be on-topic? Maybe make it a code-golf? – vikarjramun – 2017-04-02T16:37:40.813

Answers

5

TI-Basic (TI-84 Plus CE)

{1001,10,1}→LA
{1010,1,1}→LA
{1011,11,1}→LB
{1020,2,1}→LC
{1021,12,1}→LD
{1030,3,1}→LE
{1040,4,1}→LF
{1050,5,1}→LG
{1060,6,1}→LH
{1070,7,1}→LI

getDate→L1

IF L1(2)=LA(2) and L1(3)=LA(3):Then
"Happy October First!"
End
IF L1(2)=LB(2) and L1(3)=LB(3):Then
"Happy New Year!"
End
IF L1(2)=LC(2) and L1(3)=LC(3):Then
"Happy November First!"
End
IF L1(2)=LD(2) and L1(3)=LD(3):Then
"Happy February First!"
End
IF L1(2)=LE(2) and L1(3)=LE(3):Then
"Happy December First!"
End
IF L1(2)=LF(2) and L1(3)=LF(3):Then
"Happy March First!"
End
IF L1(2)=LG(2) and L1(3)=LG(3):Then
Disp "Happy April Fool's Day!"
Return:End
IF L1(2)=LH(2) and L1(3)=LH(3):Then
"Happy May First!"
End
IF L1(2)=LI(2) and L1(3)=LI(3):Then
"Happy June First!"
End
IF L1(2)=LJ(2) and L1(3)=LJ(3):Then
"Happy July First!"
End

ClrHome
Output(1,1,toString(10000LA(1)+100LA(2)+LA(3)))
Output(2,1,toString(10000LB(1)+100LB(2)+LB(3)))
Output(3,1,toString(10000LC(1)+100LC(2)+LC(3)))
Output(4,1,toString(10000LD(1)+100LD(2)+LD(3)))
Output(5,1,toString(10000LE(1)+100LE(2)+LE(3)))
Output(6,1,toString(10000LF(1)+100LF(2)+LF(3)))
Output(7,1,toString(10000LG(1)+100LG(2)+LG(3)))
Output(8,1,toString(10000LH(1)+100LH(2)+LH(3)))
Output(9,1,toString(10000LI(1)+100LI(2)+LI(3)))
Output(10,1,toString(10000LJ(1)+100LJ(2)+LJ(3)))

Uses OEIS A210884.

Stores the numbers as dates and converts them on-the-fly to output. It even leaves you a message in Ans if today is one of the dates!

pizzapants184

Posted 2017-04-02T03:13:56.553

Reputation: 3 174

Nice one! You only display April fools and use other ones as a way to hide the sequence, right? – Matthew Roh – 2017-04-02T04:18:45.490

@SIGSEGV Yes, at first I was going to use Goto and have the label many many blank lines after the last Output to hide it, but that seemed a bit too obvious. – pizzapants184 – 2017-04-02T04:28:22.193

Well, I think I did corrupt too much on getting the month. See mine. – Matthew Roh – 2017-04-02T04:41:36.063

You can omit ) or } at the end of a line or before , if TI didn't decide to scrap that feature from the TI-84+CE. You can also remove the small L from the variable being stored when assigning a value to a list. – bb94 – 2019-04-12T22:35:59.263

5

C

I use some fun CLANG properties to do tricky math and print the text sneakishly. I am printing the sequence of even numbers 0,2,4,6 etc up to 42.

This is a nice solution because I don't use any letters or hard coded strings, just pure math trickery to end up outputting the desired text even though it appears to a human brain that this should just be outputting 0,2,4,6,etc

Try it online! (Just the sneaky April Fools Day version)

#define printNumber(x) printf("%c", x)

main() {

    SYSTEMTIME st;
    GetLocalTime(&st);
    BOOL isFunDay = (st.wDay == 4 && st.wDay == 1);

    if (isFunDay) {
        printEvenNumbersTheFunWay();//fun way for a fun day!
    } else {
        printSomeEvenNumbersTheBoringWay();
    }

}

printEvenNumbersTheFunWay() {

    //print sequence: 0,2,4,6,8,10,12,14...42

    //print 0
    #define zero 72-72
    printNumber(2*zero+0);

    //print 2
    #define zero 5-5
    printNumber(20*zero+2);

    //print 4
    #define zero 108-108
    printNumber(2*zero+4);

    //print 6
    #define zero 106-106
    printNumber(2*zero+6);

    //print 8
    #define zero 113-113
    printNumber(2*zero+8);

    //print 10
    #define zero 22-22
    printNumber(2*zero+10);

    //print 12
    #define zero 53-53
    printNumber(2*zero+12);

    //print 14
    #define zero 98-98
    printNumber(2*zero+14);

    //print 16
    #define zero 98-98
    printNumber(2*zero+16);

    //print 18
    #define zero 87-87
    printNumber(2*zero+18);

    //print 20
    #define zero 88-88
    printNumber(2*zero+20);

    //print 22
    #define zero 10-10
    printNumber(2*zero+22);

    //print 24
    #define zero 46-46
    printNumber(2*zero+24);

    //print 26
    #define zero 85-85
    printNumber(2*zero+26);

    //print 28
    #define zero 83-83
    printNumber(2*zero+28);

    //print 30
    #define zero 78-78
    printNumber(2*zero+30);

    //print 32
    #define zero 7-7
    printNumber(2*zero+32);

    //print 34
    #define zero 81-81
    printNumber(2*zero+34);

    //print 36
    #define zero 2-2
    printNumber(-1*zero+36);

    //print 38
    #define zero 30-30
    printNumber(2*zero+38);

    //print 40
    #define zero 57-57
    printNumber(2*zero+40);

    //print 42
    #define zero 79-79
    printNumber(2*zero+42);

    //print 44
    #define zero 1-1
    printNumber(-10*zero+44);

}

printSomeEvenNumbersTheBoringWay() {

    //print sequence: 0,2,4,6,8,10,12,14...42

    int i = 0;
    while (i <= 42) {
        printf("%i, ", i);
        i+=2;
    }

}

Albert Renshaw

Posted 2017-04-02T03:13:56.553

Reputation: 2 955

Isn't this just the same answer as your deleted one? – Erik the Outgolfer – 2017-04-02T08:21:16.887

My deleted one used a BOOL for detecting date which was not valid for this competition so I posted this valid submission which actually checks system-time – Albert Renshaw – 2017-04-02T16:20:22.960

4

JS, A000027

d=new Date();
if(d.getMonth()+("")[(![]+"")[+[]]+"ontcol"+(!![]+[]["fi"+(![]+"")[!+[]+!+[]]+"l"])[10]+"r"]()[11]+("")["fon"+(!![]+"")[0]+"color"]()[11]+!+[]+!+[]*!+[]+!+[]&&d.getDate()==+!+[])alert("Happy April Fool's Day!");
else{for(i=0;i<10;)alert(++i);}

Mmm, good mixture of JS and JSF*ck. (Fun fact: The majority of the code is used to represent ==.)

Good tip for corrupting code like mine: JS to JSFuck Conversion code/list

Matthew Roh

Posted 2017-04-02T03:13:56.553

Reputation: 5 043

-2

Python 2, A000027

import datetime as a
if(str(a.date.today())[5:]=='04-01'):print("Happy April Fool's Day!")
else:
 for i in range(10):print(i+1)

Try it online!

officialaimm

Posted 2017-04-02T03:13:56.553

Reputation: 2 739