26
\$\begingroup\$

In this challenge your goal will be to output the lyrics to Daft Punk's Harder, Better, Faster, Stronger. Specifically, output this text:

Work It
Make It
Do It
Makes Us
Harder
Better
Faster
Stronger
More Than
Hour
Our
Never
Ever
After
Work Is
Over

Work It
Make It
Do It
Makes Us
Harder
Better
Faster
Stronger
More Than
Hour
Our
Never
Ever
After
Work Is
Over

Work It Harder Make It Better
Do It Faster, Makes Us Stronger
More Than Ever Hour After
Our Work Is Never Over

Work It Harder Make It Better
Do It Faster, Makes Us Stronger
More Than Ever Hour After
Our Work Is Never Over

Work It Harder Make It Better
Do It Faster, Makes Us Stronger
More Than Ever Hour After
Our Work Is Never Over

Work It Harder Make It Better
Do It Faster, Makes Us Stronger
More Than Ever Hour After
Our Work Is Never Over

Work It Harder Make It Better
Do It Faster, Makes Us Stronger
More Than Ever Hour After
Our Work Is Never Over

Work It Harder Make It Better
Do It Faster, Makes Us Stronger
More Than Ever Hour After
Our Work Is Never Over

Work It Harder Make It Better
Do It Faster, Makes Us Stronger
More Than Ever Hour After
Our Work Is Never Over

Work It Harder, Make It
Do It Faster, Makes Us
More Than Ever, Hour
Our Work Is Never Over

Work It Harder Make It Better
Do It Faster, Makes Us Stronger
More Than Ever Hour Af-
Our Work Is Never Over

Work It Harder Make It Better
Do It Faster, Makes Us Stronger
More Than Ever Hour Af-
Our Work Is Never Over

Work It Harder Make It Better
Do It Faster, Makes Us Stronger
More Than Ever Hour Af-
Our Work Is Never Over

Work It Harder
Make It Better
Do It Faster Makes Us Stronger
More Than Ever Hour
Our Work Is Never Over

Work It Harder
Do It Faster
More Than Ever
Our Work Is Never Over

Work It Harder
Make It Better
Do It Faster
Makes Us Stronger
More Than Ever
Hour After
Our Work Is Never Over

Your output may have a trailing newline or trailing whitespace.

Built in compression methods are not allowed.

This is code golf, so shortest code wins!

\$\endgroup\$
  • 1
    \$\begingroup\$ @feersum Yes, if you listen to the song you can see he starts to say After and then pauses. I added the hyphen to show the break and to infuriate people. I can remove it if you want, though. \$\endgroup\$ – TreFox Sep 10 '15 at 20:13
  • 9
    \$\begingroup\$ I'm shocked there's no esolang like HQ9+Daft-Punk that prints this... \$\endgroup\$ – Fatalize Sep 10 '15 at 20:15
  • 3
    \$\begingroup\$ I think you should at least disallow built in compression methods. \$\endgroup\$ – flawr Sep 10 '15 at 20:28
  • 9
    \$\begingroup\$ The lyrics to "Around the World" would have been easier. ;) \$\endgroup\$ – Reto Koradi Sep 10 '15 at 20:37
  • 3
    \$\begingroup\$ This song is the first one in a while that in my mind, isn't a duplicate of the rickroll. I've taken it to meta meta.codegolf.stackexchange.com/q/6956/15599 \$\endgroup\$ – Level River St Sep 10 '15 at 22:52

13 Answers 13

11
\$\begingroup\$

Ruby, 308 303

puts a='Work It|Make It|Do It|Makes Us|Harder|Better|Faster|Stronger|More Than|Hour|Our|Never|Ever|After|Work Is|Over

'.split(?|),a
56.times{|i|puts a[j=i%4/2*4+i%4*2]+' '+a[j+4]+[[' ',', ','
']["l4yq62lhgnizb0kfu".to_i(36)/3**i%3]+a[j+1]+' ',''][i%51/48]+[a[j+5],['','Af-'][i%44/32]][7619655>>i-28&1]}

Algorithm

Song intro: Take 16 tokens, and print them twice (last one bears an extra newline)

Verses: Riffle the tokens together to make the verses, 4 tokens per line, in the following order:

 0  4  1  5
 2  6  3  7
 8 12  9 13
10 14 11 15

In some lines, the last token is omitted, or exchanged for Af-. These lines are noted with a 1 bit in the magic number 0x744447=7619655.

In three lines, the penultimate token is also omitted, those where i%51/48==1

The punctuation in the middle of the line can be one of ' ' ', ' '\n'. These are encoded in the number 02220010000200100010001001110010001000100010001000100010 (base 3) = "l4yq62lhgnizb0kfu" (base 36.)

With comments

puts a='Work It|Make It|Do It|Makes Us|Harder|Better|Faster|Stronger|More Than|Hour|Our|Never|Ever|After|Work Is|Over

'.split(?|),a                                                    #Set up array containing all 16 tokens, print it, and print it again (note newlines at end of last token.)

56.times{|i|                                                     #14 verses, 4 lines each

puts a[j=i%4/2*4+i%4*2]+                                         #expression cycles through 0,2,8,10. Print the first token on the line.

' '+a[j+4]+                                                      #print a space, and the second token on the line.

[[' ',', ','
']["l4yq62lhgnizb0kfu".to_i(36)/3**i%3]+a[j+1]+' ',''][i%51/48]+ #if i%51/48==1,print nothing. Otherwise print the 3rd token, followed by a space, and preceded by one of ' ' or ', ' or '\n'

[a[j+5],['','Af-'][i%44/32]][7619655>>i-28&1]                    #if 7619655>>i-28&1==0 print the fourth token. Otherwise print either nothing or Af- depending on the value of i%44/32

}
\$\endgroup\$
9
\$\begingroup\$

Perl, 316 309 308 307 bytes

The source must be encoded as Latin-1.

@c=split b,'
Â×
Ô
ÚáÐÙáÒ
ÅOÆÖáEváAftáØ
bÑÏábÝà
bÑÈ-
bÈÇÈÇbHoÆbur
btáÑbÏßËÌÊßÉbHoÜAfbÔ ÒÍbÝà ÐÎber, b Evb× ÙbÓ ÚbBettábOÜØ ÖßbStrongáÛbÕ
ÞàbÝs UsbOvábNevbDoàbÞ IsbFastbHardbMore Thanbur bMakebWorkber b Itber
';$e='ÞàÀÓÀÄÄÄÈÇÏÌÂÎÌÔ
ÛÍÌÅÃÃÃÁËßÊßÅÁÎáÛÍáÁËáÊáÉÇÕ';$f=chr$_+192,$e=~s/$f/$c[$_]/g for 0..34;print$e

Explanation

We start out with the original lyrics. For brevity, let’s assume they are

lyrics = "Work Work Harder Harder"

Now we find short substrings (≥ 3 characters) that occur often. In this case, "Work " occurs twice. We replace each occurrence with character 0xE1. We also remember the replaced string in an array:

lyrics = "ááHarder Harder"
substs = ["Work "]

The next substring, "Harder", is replaced with 0xE0. The substs array grows towards the front:

lyrics = "ááà à"
substs = ["Harder", "Work "]

This continues for a total of 34 iterations until we get to character 0xC0.

Now we concatenate the substs using the character b (which doesn’t occur in the lyrics) as a separator. In the Perl code, the substs array is stored in @c (using the bareword b to tell split where to split), the new jumbled lyrics are in $e, and the code simply reverses the 34 substitutions.

\$\endgroup\$
  • 1
    \$\begingroup\$ Any explanations? \$\endgroup\$ – feersum Sep 12 '15 at 16:01
  • 1
    \$\begingroup\$ @feersum: Done. \$\endgroup\$ – Timwi Sep 13 '15 at 15:29
5
\$\begingroup\$

Sprects, 302 bytes

:xxnnnnnnnmW12603 27428 3s59qp wb12604280qpb12603 2742803s59qp0wjb:ncvb:mcQb:WcEb:x1203 204203s50607809q0w0y0i0p0j01l0z00:c1263 27428, 3s59:vqp wj:Qqp, w:Eqp wAf-:b0y1liz00:0\n:1Work :2It :3Make:4Do :5 Us :6Harder :7Better\n:8Faster:9Stronger\n:qMore Than :wHour :yOur :iNever :pEver:jAfter :lIs :zOver

I just recently made this language and I decided to test it out with this challenge. It outputs \ns instead of new lines because it outputs into HTML, but the interpreter is written in JavaScript. Because of this, here's a version with <br>s instead of \ns:

:xxnnnnnnnmW12603 27428 3s59qp wb12604280qpb12603 2742803s59qp0wjb:ncvb:mcQb:WcEb:x1203 204203s50607809q0w0y0i0p0j01l0z00:c1263 27428, 3s59:vqp wj:Qqp, w:Eqp wAf-:b0y1liz00:0<br>:1Work :2It :3Make:4Do :5 Us :6Harder :7Better<br>:8Faster:9Stronger<br>:qMore Than :wHour :yOur :iNever :pEver:jAfter :lIs :zOver
\$\endgroup\$
  • \$\begingroup\$ Very interesting. We have a rule here that the language/interpreter/compiler must exist before the challenge. I don't see a date on you interpreter, when was it published? \$\endgroup\$ – Level River St Sep 12 '15 at 20:00
  • \$\begingroup\$ @steveverrill I made it yesterday. I guess my answer is invalid then. \$\endgroup\$ – DanTheMan Sep 12 '15 at 21:16
  • 3
    \$\begingroup\$ Consensus on Meta is that this can still be posted but isn't applicable for winning. You should probably add a disclaimer to your answer to inform OP \$\endgroup\$ – Downgoat Sep 13 '15 at 5:42
  • \$\begingroup\$ Can you make er a single token? \$\endgroup\$ – Solomon Ucko Jan 22 at 2:14
4
\$\begingroup\$

GolfScript (275 bytes)

This contains non-printable ASCII characters, so here's a hexdump:

0000000: 3a6b 2757 6f72 6b20 4974 0a4d 616b 6586  :k'Work It.Make.
0000010: 0444 6f8c 0873 2055 730a 4861 7264 6572  .Do..s Us.Harder
0000020: 0a42 6574 7485 0346 6173 8504 5374 726f  .Bett..Fas..Stro
0000030: 6e67 9503 4d6f 7265 2054 6861 6e0a 486f  ng..More Than.Ho
0000040: 7572 0a4f 8203 4e65 76ae 0345 8304 4166  ur.O..Nev..E..Af
0000050: b204 df06 730a 4f96 048c 07ed 7020 d606  ....s.O.....p ..
0000060: 20f4 0720 de07 fb05 20e4 062c 9b05 7320   .. .... ..,..s 
0000070: 5573 20ee 1220 df04 20f3 0420 e406 f903  Us .. .. .. ....
0000080: 20e8 0720 4e65 9b04 eeff eeff eeb6 d206   .. Ne..........
0000090: fe03 e817 df0f 2ce0 05da 5c27 d908 2042  ......,...\'.. B
00000a0: 6574 d303 e017 2053 7472 6f6e 67bd 03e9  et.... Strong...
00000b0: 0ee8 0520 4166 2dec ffec 040a ec1b eb26  ... Af-........&
00000c0: e728 d80c c60f c128 4d61 6b65 d004 4265  .(.....(Make..Be
00000d0: 74c3 04d0 0e9a 0373 2055 7320 5374 726f  t......s Us Stro
00000e0: 6e67 e212 486f e303 4166 fc04 ed16 277b  ng..Ho..Af....'{
00000f0: 6b7b 7b6b 247d 2a30 3a6b 3b7d 7b31 3237  k{{k$}*0:k;}{127
0000100: 2e32 243c 7b2d 3a6b 7d2a 3b7d 6966 7d2f  .2$<{-:k}*;}if}/
0000110: 5d28 2b                                  ](+
\$\endgroup\$
  • \$\begingroup\$ How does this work? As far as I can tell it seems I'm the only one using a "riffle and omit" strategy, which surprises me. Still, it means I'm in second place behind this answer. \$\endgroup\$ – Level River St Sep 12 '15 at 9:13
  • \$\begingroup\$ Hand-coded Lempel-Ziv. Nothing interesting. Which was pretty much the point I tried to make in meta, but clearly not convincingly enough. \$\endgroup\$ – Peter Taylor Sep 12 '15 at 9:29
  • 1
    \$\begingroup\$ Well I am indeed disappointed that few people took full advantage of the structure of the song. The opportunity was there, as evidenced by the fact that I'm in second place in Ruby, only 28 bytes behind you. I'm inclined to believe that a port of my answer into golfscript would come in shorter than 275 bytes. Do you think otherwise? \$\endgroup\$ – Level River St Sep 12 '15 at 9:48
  • \$\begingroup\$ I tried my full battery of grammar generators on it, and was surprised that LZ came out ahead (although the greedy grammar builder was only one byte behind). But I wouldn't be surprised if one of a port of this GolfScript or a port of the 276-byte greedy grammar approach into Ruby came out at less than 303 bytes. \$\endgroup\$ – Peter Taylor Sep 12 '15 at 10:58
2
\$\begingroup\$

Ruby - 643 bytes

Edit: Golfed down from 899 to 830.

Edit2: 830 -> 755.

Edit3: 755 -> 684.

Edit4: 684 -> 670.

Edit5: 670 -> 643.

I haven't really used ruby, so I'm sure this could be golfed down, this is just an attempt:

l=%w[Work Make Do Harder Better Faster Stronger More Than Hour Our Never Ever After Over Faster,]
i,j,f,u,d=->x{l[x]+' It'},->x,y{l[x]+' It '+l[y]+' '},->a,b,c,d,e{a+' '+b+' '+c+' '+d+' '+e},'s Us ',l[6]
s,q,w,e,r,y,k=f[l[10],l[0],'Is',l[11],l[14]],j[0,3],j[1,4],j[2,15],j[2,5],->d,e{f[l[7],l[8],l[12],d,e]},l[1]+u
t,z,m=e+k,->a{puts q+w,t+d,y[l[9],a],s,''},y['','']
2.times{puts i[0],i[1],i[2],k,l[3],l[4],l[5],d,l[7]+' '+l[8],l[9],l[10],l[11],l[12],l[13],l[0]+' Is',l[14],''}
7.times{z[l[13]]}
puts q+i[1],t,f[l[7],l[8],l[12]+',',l[9],''],s,''
3.times{z['Af-']}
puts q,w,r+k+d,y[l[9],''],s,'',q,r,m,s,'',q,w,r,k+d,m,l[9]+' '+l[13],s
\$\endgroup\$
2
\$\begingroup\$

JAVA 518/490Bytes

Edit: unneeded 7 Bytes and added a Java 6 version with the static{} trick Edit2: Explanation expand

class E{public static void main(String[]_){String l="\n#, #Work#Make#Do#Makes Us#Hard#Bett#Fast#Strong#More#Than#Hour#Our#Nev#Ev#Aft#Af-#Work Is#Ov# #er# It",a="cwadwaewafagvahvaivajvakulamanaovapvaqvasatvaa",z="anusuovutvaa",y="kulupvu",x="cwugv",w="fujva",b=x+"udwuhvuaewuivb"+w,c=b+y+"muqvu"+z,d=x+"bdwaewuivbfakulupvbm"+z,e=b+y+"mur"+z,f=x+"adwuhvaewuivu"+w+y+z+x+"aewuivakulupv"+z+x+"adwuhvaewuiva"+w+"kulupvamuqv"+z,r=a+a+c+c+c+c+c+c+c+d+e+e+e+f;for(char o:r.toCharArray())System.out.print(l.split("#")[o-97]);}}

java6:

class E{static{String l="\n#, #Work#Make#Do#Makes Us#Hard#Bett#Fast#Strong#More#Than#Hour#Our#Nev#Ev#Aft#Af-#Work Is#Ov# #er# It",a="cwadwaewafagvahvaivajvakulamanaovapvaqvasatvaa",z="anusuovutvaa",y="kulupvu",x="cwugv",w="fujva",b=x+"udwuhvuaewuivb"+w,c=b+y+"muqvu"+z,d=x+"bdwaewuivbfakulupvbm"+z,e=b+y+"mur"+z,f=x+"adwuhvaewuivu"+w+y+z+x+"aewuivakulupv"+z+x+"adwuhvaewuiva"+w+"kulupvamuqv"+z,r=a+a+c+c+c+c+c+c+c+d+e+e+e+f;for(char o:r.toCharArray())System.out.print(l.split("#")[o-97]);}}

Thanks to @Chris Drost for the hint with the many "ER"s in the text. First String is a lookup table, second part uses the lowercase letters (which are a sequential block in ascii) as a index into the table by subtracting the magic value of a from the value.

Second part consists of multiple Strings of different length (short ones are common parts shared between multiple verses) which get assembled to a long one before the looping through the chars happens

\$\endgroup\$
  • \$\begingroup\$ Nice answer! +1 And I know it's been about 1.5 years, but you can golf two things: Remove l and use the String containing all the # directly in the for-each loop, and change the char in the for-each loop to int: for(int o:r.toCharArray())System.out.print("\n#, #Work#Make#Do#Makes Us#Hard#Bett#Fast#Strong#More#Than#Hour#Our#Nev#Ev#Aft#Af-#Work Is#Ov# #er# It".split("#")[o-97]); Which results in -5 bytes / 513 bytes. \$\endgroup\$ – Kevin Cruijssen Apr 19 '17 at 7:17
2
\$\begingroup\$

JavaScript ES6, 440 bytes 438 bytes

This is a bunch of simple compression optimizations. As a one-liner:

eval("a='w_m_d_u_h_b_f_s_M_H_O_N_E_A_W_VX';b='w hTm b_d f,Tu s_M ETH A_O W N VX';c=bRA/,'Y');o={};'wWork It|mMake It|dDo It|uMakes Us|hHard&bBett&fFast&sStrong&MMore Than|HHour|OOur|NNev&EEv&AAft&WWork Is|VOv&X\\n\\n|YAf-|_\\n|T 'R&/g,'er|').split('|').map(x=>o[x[0]]=x.slice(1));console.log((a+a+b.repeat(7)+bR._/g,'_')R,?T/g,',T')+c+c+c+bRT/,'_')R,/,'')+bR,?T. ._/g,'_')+bR,?T/g,'_'))R\\w/g,x=>o[x]).trim())".replace(/R/g,'.replace(/'))

This was written to be an executable script via iojs --harmony_arrow_functions file.js; you can shave off the console.log() overhead depending on the meaning of "output the lyrics".

Explanation

After performing the outer .replace(), the code fed to eval is:

// The first three lines, with each phrase compressed to a single character, newlines
// compressed to _, and block-endings compressed to X. Call this compressed-format.
a = 'w_m_d_u_h_b_f_s_M_H_O_N_E_A_W_VX';

// The compressed-format main block: this is repeated seven times literally but
// every other stanza, besides `a` above, ultimately uses some simple variant
// of this block.
b = 'w hTm b_d f,Tu s_M ETH A_O W N VX';
// The new character T above is a new character we're adding to compressed-format, it is
// a space in the main block but also a hook for some regular expressions later.

// We need one more entry in compressed-format: some blocks, here assigned to
// the variable `c`, shorten "After" to Y = "Af-".
c = b.replace(/A/, 'Y');

// Now we want to build a lookup table for this compressed format above. That is done by
// these lines, which have also been compressed:
o={};
'wWork It|mMake It|dDo It|uMakes Us|hHard&bBett&fFast&sStrong&MMore Than|HHour|OOur|NNev&EEv&AAft&WWork Is|VOv&X\n\n|YAf-|_\n|T '
    .replace(/&/g, 'er|')
    .split('|')
    .map(x => o[x[0]] = x.slice(1));
// The fact that so many fragments end in 'er' allows us to actually shave a couple 
// bytes above, but the compression scheme is fundamentally creating a dict like
//     {a: "Phrase 1", b: "Phrase 2", c: "Phrase 3", d: "Phrase 4"}
// from the string "aPhrase 1|bPhrase 2|cPhrase 3|dPhrase4".

// Now we have the part that actually does the work:
console.log(
    ( // build-string phase
        // first two opening blocks `a`
        a + a + 

        // seven repetitions of `b`
        b.repeat(7) +

        // a version of `b` without final words and with commas before each T.
        b.replace(/._/g, '_').replace(/,?T/g, ',T') + 

        // three repetitions with the 'Af-' suffix.
        c + c + c + 

        // one with the first T converted into a newline and no commas
        b.replace(/T/, '_').replace(/,/, '') + 

        // one with only the first halfs of the three lines
        b.replace(/,?T. ._/g, '_') + 

        // one with no commas and all T's converted to newlines.
        b.replace(/,?T/g, '_')
    ) // end build-string phase
    // Now we convert from compressed-format to actual format
    .replace(/\w/g, x => o[x])
    // We are only told that one trailing newline is allowed; we have two extra:
    .trim() 
)

Kudos

  • @vihan, who reminded me that ES6 also has this shiny new .repeat function for strings, saving 2 bytes.
\$\endgroup\$
  • \$\begingroup\$ You can probably use b.repeat(7) instead of b+b+b+b+b+b+b \$\endgroup\$ – Downgoat Sep 13 '15 at 5:42
1
\$\begingroup\$

PowerShell, 659 Bytes

$a=@(" ","`n",",","Stronger","Make It","Do It","Makes Us","Harder","Better","Faster","Work It","More Than","Hour","Our","Never","Ever","After","Work Is","Over","Af-")
$z="1000070"
$y="01130017001400180101"
$x="010500090200060"
$v="00301110015001200"
$b="100104010501060107010801090103011101120113011401150116011701180101"
$c=$z+"0040008$x$v"+"16$y"
$d=$z+"20004$x"+"1110015020012$y"
$e=$z+"0040008$x$v"+"19$y"
$f=$z+"10400080105000900060003011100150012$y"
$g=$z+"105000901110015$y"+"10000701040008010500090106000301110015011200160113001700140018"
$($b,$b,$c,$c,$c,$c,$c,$c,$c,$d,$e,$e,$e,$f,$g|%{for($i=0;$i-lt$_.length;$i+=2){$a[$_.Substring($i,2)]}})-join''

Creates an array of keywords $a, then encodes the lyrics using a series of numerical strings which are sent into a for loop. The loop takes two-digit substrings, pulls the corresponding keyword from the $a array, and finally the -join'' concatenates it all together.

I think this is about as good as this method can be done, as every time I tried to golf further (e.g., replacing 040008 with a new variable), it turned out to be a couple bytes longer because the substring length wasn't enough to account for all the extra quotes needed. Though there have been some new answers posted since I started that have slightly different methods that look like they might be shorter in PowerShell (like using ASCII characters to encode, rather than two-digits, maybe?), I'm going to stick with this one.

Edit - forgot the replacement encoding I used:

00  <space>
01  `n
02  ,
10  Work It
04  Make It
05  Do It
06  Makes Us
07  Harder
08  Better
09  Faster
03  Stronger
11  More Than
12  Hour
13  Our
14  Never
15  Ever
16  After
17  Work Is
18  Over
19  Af-
\$\endgroup\$
  • \$\begingroup\$ if you got a way to get ascii code of a character thats easy to use then that should work out to shave off a bunch of bytes \$\endgroup\$ – masterX244 Sep 14 '15 at 7:43
1
\$\begingroup\$

GolfScript, 251 bytes golfed

'Work It
Make It
Do It
Makes Us
Harder
Better
Faster
Stronger
More Than
Hour
Our
Never
Ever
After
Work Is
Over

'2*.n/:a;56,{:@4%.2&+2*:^a=' ':|4^+a='jSRSSS]SSSSSST'81base 3@?/3%[|', 'n]=^)a=+@ 51%48/!*|237118176 2 55@-?/1&@44%32/'Af-'*5^+a=if^9/n*n}/

Try it online!

Eliminated unnecessary [] and simplified code accordingly. Changed i and j to @ and ^ to permit removal of whitespace. Assigned first occurence of ' ' to variable | to avoid repeating the same three characters.

GolfScript, First working version 262 bytes

'Work It
Make It
Do It
Makes Us
Harder
Better
Faster
Stronger
More Than
Hour
Our
Never
Ever
After
Work Is
Over

'2*.n/:a;56,{:i;[i 4%.2&+2*:j a=' '4j+a='jSRSSS]SSSSSST'81base 3i?/3%[' '', 'n]=j)a=+i 51%48/!*' '237118176 2 55i-?/1&i 44%32/'Af-'*5j+a=if j 9/n*n]}/

Try it online!

This is a port of my Ruby answer into golfscript using the same basic algorithm: output the list of tokens twice, then riffle them into the verses and build the verses line by line, adjusting for the peculiarities of each.

There are a couple of differences. The number for the correct mid-line punctuation is in base 81 (conveniently this makes one printable ascii character per verse); and the number encoding whether or not to print the last token is modified because the index is 55-iinstead of i-28 (the latter was found to cause problems with negative powers generating fractional numbers instead of truncating to integer.)

Commented

'Work It
Make It
Do It
Makes Us
Harder
Better
Faster
Stronger
More Than
Hour
Our
Never
Ever
After
Work Is
Over

'2*                                               #make a string of all the tokens twice and push on the stack
.n/:a;                                            #duplicate the string, split into tokens at newline to form array. Assign to a
56,{:i;                                           #iterate through i= (0..55) 
  [i 4%.2&+2*:j                                   #calculate j=(i%4+(i%4&2))*2 to cycle through 0 2 8 10.
  a=' '                                           #leave a[j] on stack followed by space (token A)
  4j+a=                                           #leave a[j+4] on stack (token B))
  'jSRSSS]SSSSSST'81base 3i?/3%[' '', 'n]=j)a=+   #leave ' ' ', ' or newline on stack as appropriate followed by a[j+1] (token C)
  i 51%48/!*                                      #multiply the data described in the previous line by  !(i%51/48)  (1 or 0)
  ' '                                             #leave a space on the stack
  237118176 2 55i-?/1&                            #leave 237118176/2**55-i & 1 on stack (true or false indicates token D required)
  i 44%32/'Af-'*5j+a=                             #leave i%44/32= 0 or 1 copies of 'Af-' on the stack. Leave a[j+5] on the stack.  
  if                                              #depending on value of last but one line, select an option from the previous line.
  j 9/n*n]                                        #leave a newline on the stack. if 9/n is 1 or more (last line of verse) leave an additional newline
}/                                                #close the loop
                                                  #printing done by implied stack dump on program exit.
\$\endgroup\$
  • \$\begingroup\$ 252 bytes. Use unused symbols as variable names to avoid whitespace, and store space (" ") in a variable. Also, don't pop after assigning to a variable out of habit. \$\endgroup\$ – Erik the Outgolfer May 1 '18 at 19:02
  • \$\begingroup\$ @EriktheOutgolfer thanks for the tips, but I already posted a 251 byte version incorporating most of them. You spotted a space before 51 that I missed though. I will fix it later, and possibly look for other ways to shorten it. This is my first golfscript program, and I find them very hard to read when symbols are used as variables, hence I also left my 262-byte first working version up at least for now. \$\endgroup\$ – Level River St May 1 '18 at 20:54
  • \$\begingroup\$ Ah you apparently did, lol. \$\endgroup\$ – Erik the Outgolfer May 1 '18 at 20:56
0
\$\begingroup\$

Python - 1056 Charaters

a,b,d,s,w,i,t,e,f,h,H,mi,mu,mt,ad,n,o,O="After","Better","Do It ","Stronger","Work ","Is ","It ","Ever ","Faster ","Harder ","Hour ","Make It ","Makes Us ","More Than ","Af-","Never ","Our ","Over"
owinO=o+w+i+n+O
mus=mu+s
df=d+f
dfmu=df[0:-1]+", "+mu
dfmus=df+mus
dfcmus=df[0:-1]+", "+mus
ha=h+a
Ha=H+a
mib=mi+b
mte=mt+e
mteh=mte+H
mtech=mte[0:-1]+", "+H
mtehad=mteh+ad
mteha=mteh+a
wi=w+i
wt=w+t
wth=wt+h
wthmt=wth[0:-1]+", "+mi
wthmib=wth+mi+b
E = ""
l =[wt,mi,d,mu,h,b,f,s,mt,H,o,n,e,a,wi,O,E,wt,mi,d,mu,h,b,f,s,mt,H,o,n,e,a,wi,O,E,wthmib,dfcmus,mteha,owinO,E,wthmib,dfcmus,mteha,owinO,E,wthmib,dfcmus,mteha,owin
O,E,wthmib,dfcmus,mteha,owinO,E,wthmib,dfcmus,mteha,owinO,E,wthmib,dfcmus,mteha,owinO,E,wthmib,dfcmus,mteha,owinO,E,wthmt,dfmu,mtech,owinO,E,wthmib,dfcmus,mteha
d,owinO,E,wthmib,dfcmus,mtehad,owinO,E,wthmib,dfcmus,mtehad,owinO,E,wth,mib,dfmus,mteh,owinO,E,wth,df,mte,owinO,E,wth,mib,df,mus,mte,Ha,owinO]

for ln in l:
    print ln

Still room for improvement with variable names, but its a start.

\$\endgroup\$
  • 2
    \$\begingroup\$ Might it help to separately write out a list of all your variable names so you can easily see which single letters haven't been used yet and then search-replace your long variable names? \$\endgroup\$ – trichoplax Sep 24 '15 at 10:58
0
\$\begingroup\$

Ruby, 486 Bytes

i=%w(Work\ It Make\ It Do\ It Makes\ Us Harder Better Faster Stronger More\ Than Hour Our Never Ever After Work\ Is Over)
z=i[1]+p+i[5]
y=i[2]+p+i[6]
x=z+n+y
w=i[3]+p+i[7]
v=i[8]+p+i[12]
u=w+n+v
t="Our "+i[14]+" Never Over"
s=i[0]+p+i[4]
r=i[9]+p+i[13]
n="\n"
p=' '
m=', '
a=i.join n
q=n+t
l=s+n
b=s+p+x+m+u+p+r+q
c=s+m+i[1]+n+y+m+i[3]+n+v+m+i[9]+q
d=b.gsub("After","Af-")
e=l+x+p+u+p+i[9]+q
f=l+y+n+v+q
g=l+x+n+u+n+r+q
def o s
s+"

"
end
puts o(a)*2+o(b)*7+o(c)+o(d)*2+o(d)+o(e)+o(f)+g
\$\endgroup\$
0
\$\begingroup\$

Ruby, 483 bytes

puts "#{'a buc bud bucs eufuguhuiuj kulumuoupuqua rutuu'*2}#{'a b f c b gud b h, cs e iuj k p l qum a r o tuu'*7}a b f, c bud b h, cs euj k p, lum a r o tuu#{'a b f c b gud b h, cs e iuj k p l num a r o tuu'*3}a b fuc b gud b h cs e iuj k p lum a r o tuua b fud b huj k pum a r o tuua b fuc b gud b hucs e iuj k pul qum a r o tu".gsub /./,Hash[[*?a..?u,' ',','].zip %w{Work It Make Do Us Harder Better Faster Stronger More Than Hour Our Af- Never Ever After Is s Over}+[?\n,' ',',']]

Works by encoding every word used in the song to a single letter, multiplying some stanzas, then substituting the encoded letters with the actual lyrics. Commas, spaces are left as is. u is a newline.

\$\endgroup\$
  • 2
    \$\begingroup\$ Easter egg: contains the phrase fuc b gud \$\endgroup\$ – dkudriavtsev Apr 18 '17 at 23:38
0
\$\begingroup\$

PHP, 434 Bytes

$m="Make It";$b="$m Better";$o="Our Work Is Never Over
";$u="Makes Us";$s="$u Stronger";$d="Do It";$f="$d Faster";$e="More Than Ever";$h="Hour";$w="Work It Harder";echo strtr("001111111$w, $m
$f, $u
$e, $h
$o
222$w
$b
$f $s
$e $h
$o
$w
$f
$e
$o
$w
$b
$f
$s
$e
$h After
$o",["Work It
$m
$d
$u
Harder
Better
Faster
Stronger
More Than
$h
Our
Never
Ever
After
Work Is
Over

","$w $b
$f, $s
$e $h After
$o
","$w $b
$f, $s
$e $h Af-
$o
"]);

Try it online!

\$\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.