Famous Songs in Code (What’s Your Guess?)

Inspired by Philipp Lenssen’s fabulous idea to express idioms in code, I came up—just for fun—with the following 10 well-known song titles, written in horrible C/Java/PHP pseudocode.

Have fun… and take a guess in the comments!

// Song 1:
it = b

// Song 2:
for (i=0; i<people.count(); i++)
  people[i].attributes |= (shiny | happy);

// Song 3:
function get(want) {
  if (random.bool() == true)
    return want;
  else
    return null;
}

// Song 4:
//function leave() {
//  return new Color(0,0,0);
//}
// Oh, I think I screwed this one up, so here it goes:
// Version 2.0 of Song 4: ;-)
function leave(me) {
  me.setColor(0,0,0);
  return me;
}

// Song 5:
who = fire.getStarter();
assert(who != us);

// Song 6:
function cry(person) {
  return (person.gender == female);
}

// Song 7:
person = king.getWife();
person.dance();

// Song 8:
life = me.getLife();
life.setSunshine(you);

// Song 9:
person = USGovernmentEmployees.getRandom();
while (person.boss != null)
  person = person.boss;
person.writeLetter();

// Song 10:
train = trains.getLine(A);
you.take(train);

Update: I fixed Song 4 and 9 because they made way too little sense. Oops ;)



25 Responses to “Famous Songs in Code (What’s Your Guess?)”

Pages: « 1 [2] Show All

  1. 21
    Brian P. Says:

    Darn it was a toss up for me between Back in Black and Fade to Black. But now I think I get that one better so it makes sense.

    The idioms were awesome too. They were easier though.

  2. 22
    Fred Says:

    Brian: No worries — as I said, I made this one way too fuzzy. Hope you had fun anyway! :)

  3. 23
    Michael Romero Says:

    #2 is shiny happy people by rem.

  4. 24
    Max Kanat-Alexander Says:

    Hahahaha, those are all wonderful!!

    -Max

  5. 25
    Gail Says:

    1) Let It Be
    2) Shiny Happy People
    3) You Can’t Always Get What You Want
    4) Back in Black
    5) Light My Fire
    6 & 7 stumped me . . . .
    8) You Are the Sunshine of My Life
    9 & 10 stumped there too

Pages: « 1 [2] Show All

Leave a Reply