262
\$\begingroup\$

Write the shortest program that prints the entire lyrics of "Never Gonna Give You Up" by Rick Astley.

Rules:

  • Must output the lyrics exactly as they appear in the above pastebin*. Here's the raw dump: http://pastebin.com/raw/wwvdjvEj
  • Cannot rely on any external resources - all lyrics must be generated by / embedded in code.
  • No use of existing compression algorithms (e.g. gzip / bzip2) unless you include the full algorithm in your code.
  • Use any language, shortest code wins.

Update, 1st June 2012:
For solutions containing non-ASCII text, the size of your solution will be counted in bytes, based on UTF-8 encoding. If you use codepoints that cannot be encoded in UTF-8, your solution will not be judged as valid.

Update, 7th June 2012:
Thank you all for your awesome solutions! I'll be accepting the shortest answer tomorrow afternoon. Right now, Peter Taylor's GolfScript answer is winning, so get cracking on some improvements if you want to beat him! :)

*There is a typo in the Pastebin (line 46, "know" should be "known"). You may either replicate it or not at your discretion.

\$\endgroup\$
  • 4
    \$\begingroup\$ @w0lf You're correct. I only scanned the lyrics to verify their accuracy, I must've missed that one. I'll accept either "know" or "known". \$\endgroup\$ – Polynomial May 29 '12 at 7:30
  • 11
    \$\begingroup\$ 26k+ views in just 3 days. WOW... \$\endgroup\$ – Gaffi Jun 1 '12 at 21:30
  • 9
    \$\begingroup\$ How in the world did this generate so many views and votes? Whatever he did, I'm going to reverse engineer it. \$\endgroup\$ – PhiNotPi Jun 2 '12 at 21:27
  • 42
    \$\begingroup\$ @PhiNotPi Good luck reverse engineering "Jeff Atwood tweeting you". \$\endgroup\$ – breadbox Jun 3 '12 at 8:04
  • 9
    \$\begingroup\$ The restriction with UTF-8 makes no sense. What if my code is shorter when encoded as UTF-16 or as Latin-1? You should either count the number of bytes or the number of characters, but leave the encoding up to the author. \$\endgroup\$ – Timwi Jan 25 '14 at 0:22

63 Answers 63

1 2
3
1
\$\begingroup\$

ink, 839 777 764 bytes

~temp o="(Ooh, g{g})"
We're no strangers to love
You know the rules and so do I
A full commitment's what I'm thinking of
You wouldn't get this from any other guy
->w->l->
And if you ask me how I'm feeling
Don't tell me you're too blind to see->c->c->
\ 
{o}
{o}
(Ooh)
N{n}give, n{n}give
(G{g})
(Ooh)
N{n}give, n{n}give
(G{g})->l->
\ 
->w->c->c->
=l
\ 
\ 
We've known each other for so long
Your heart's been aching but
You're too shy to say it
Inside we both know what's been going on
We know the game and we're gonna play it
->->
=w
I just wanna tell you how I'm feeling
Gotta make you understand->c->->
=c
\ 
\ 
-(d)N{n}{&g{g}|let you down|run around and desert you|make you cry|say goodbye|tell a lie and hurt you->->}
->d
VAR n="ever gonna "
VAR g="ive you up"

Try it online!

  • -62 (!!!) bytes why the H E C C did I think functions were the way to go here?
  • -13 bytes by reworking the chorus to use a sequence and making w call c before exiting (since the chorus always happens at least once after the "We've known eachother..." part)

It's not a very nice solution, but I spent too long on it to just throw it away.

I'm still not a huge fan of those tunnels, but assigning a multiline strings to a variable in ink is weirder than you'd think.

I thought I could make some fancy changes to that l stitch, but they turned out to not be worth it, and also messed up the whitespace a bunch.

| improve this answer | |
\$\endgroup\$
0
\$\begingroup\$

iX2Web, 2778 bytes

Just had to make an iX2Web solution ;)

**iX200196 64378DMwlX ZSdyZSBuby BzdHJhbmdl cnMgdG8gbG 92ZbZZb3Ug a25vdyB0aG UgcnVsZXMg YW5kIHNvIG RvIEm2QSBm dWxsIGNvbW 1pdG1lbnQn cyB3aGF0IE knbSB0aGlu a2luZyBvZr ZZb3Ugd291 bGRuJ3QgZ2 V0IHRoaXMg ZnJvbSBhbn kgb3RoZXIg Z3V5tkkgan VzdCB3YW5u YSB0ZWxsIH lvdSBob3cg SSdtIGZlZW xpbme2R290 dGEgbWFrZS B5b3UgdW5k ZXJzdGFuZL a2TmV2ZXIg Z29ubmEgZ2 l2ZSB5b3Ug dXC2TmV2ZX IgZ29ubmEg bGV0IHlvdS Bkb3dutk5l dmVyIGdvbm 5hIHJ1biBh cm91bmQgYW 5kIGRlc2Vy dCB5b3W2Tm V2ZXIgZ29u bmEgbWFrZS B5b3UgY3J5 tk5ldmVyIG dvbm5hIHNh eSBnb29kYn lltk5ldmVy IG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91fF8wCTAN Cg===*
| improve this answer | |
\$\endgroup\$
0
\$\begingroup\$

Swift, 697 bytes

import Foundation
var s="We'r!n$str+gers*$love2 6*h!rules 4s$d$I\nA full commitmen8wha&I'm*hink3 of2 wouldn'&get*his from +y70uyJ%\n\nFnH\nAnd if .ask m!<Don't5m!1=blind*$see%%\n\n@@EE\nFH\nJ%%%"
for(a,b)in zip("JHFECB@?%=<:987654#>-0/.13&2+!*$","\nI jus&w+na5.<Gotta mak-nd/st+d; each7/ for s$long2r hear: ach3 but2=shy*$9it\nInsid!w!both 6 wha: go3 on\nW!6*h!gam!4we'r!goBplay it;We'v!6;?)#C, nev0oBC\n(Giv-p)\n;give;nna ;?, giv-p)\n;(Ooh;\n#giv-p#le&.down#run around 4des/&1#mak!.cry#9goodbye>5a li!4hur&1;'re*o$;how I'm feel3\n;8been;say ;t's ; oth;know;*ell ;+d ;> ;\nNev0onna;!.u;/ g;er;1 ;you;ing;t ;\nYou;an;e ; t;o ;".split{$0==";"}){s=s.replacingOccurrences(of:"\(a)",with:b)}
print(s)

Try it online!

Explanation

import Foundation                               // Import `replacingOccurrences`
var s = "<...>"                                 // The compressed text
for(a,b)in zip("<...>","<...>".split{$0==";"}){ // For every character in the first string,
  s=s.replacingOccurrences(of:"\(a)",with:b)    // replace all occurences of it with its
}                                               // replacement in the second string
print(s)                                        // Print the resulting text
| improve this answer | |
\$\endgroup\$
1 2
3

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.