Lavora di più, rendilo migliore


26

In questa sfida il tuo obiettivo sarà quello di pubblicare i testi di Daft Punk's Harder, Better, Faster, Stronger. In particolare, genera questo testo:

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

L'output potrebbe avere una nuova riga finale o uno spazio bianco finale.

Non sono consentiti metodi di compressione integrati.

Questo è il codice golf, quindi vince il codice più corto!


1
@feersum Sì, se ascolti la canzone puoi vedere che inizia a dire After e poi fa una pausa. Ho aggiunto il trattino per mostrare la pausa e per far infuriare le persone. Posso rimuoverlo se vuoi, però.
TreFox,

9
Sono scioccato che non esolang come HQ9+Daft-Punkquesto lo stampi ...
Fatalizza il

3
Penso che dovresti almeno non consentire metodi di compressione integrati.
Flawr,

9
Il testo di "Around the World" sarebbe stato più semplice. ;)
Reto Koradi,

3
Questa canzone è la prima da un po 'di tempo che nella mia mente non è un duplicato del rickroll. L'ho portato su meta meta.codegolf.stackexchange.com/q/6956/15599
Level River St

Risposte:


11

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]}

Algoritmo

Introduzione alla canzone: prendi 16 token e stampali due volte (l'ultimo ha una nuova riga in più)

Versi: Riffle insieme i token per creare i versi, 4 token per riga, nel seguente ordine:

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

In alcune righe, l'ultimo token viene omesso o sostituito Af- . Queste righe sono indicate con un 1 bit nel numero magico 0x744447 = 7619655.

In tre righe, anche il penultimo token viene omesso, quelli in cui i%51/48==1

La punteggiatura nel mezzo della linea può essere una delle ' ' ', ' '\n'. Questi sono codificati nel numero 02220010000200100010001001110010001000100010001000100010 (base 3) = "l4yq62lhgnizb0kfu" (base 36.)

Con commenti

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

}

9

Perl, 316 309 308 307 byte

La sorgente deve essere codificata come 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

Spiegazione

Iniziamo con il testo originale. Per brevità, supponiamo che lo siano

lyrics = "Work Work Harder Harder"

Ora troviamo sottostringhe corte (≥ 3 caratteri) che si presentano spesso. In questo caso, si "Work "verifica due volte. Sostituiamo ogni occorrenza con il carattere 0xE1. Ricordiamo anche la stringa sostituita in un array:

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

La sottostringa successiva "Harder", viene sostituita con 0xE0. La substsmatrice cresce verso la parte anteriore:

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

Questo continua per un totale di 34 iterazioni fino ad arrivare al carattere 0xC0.

Ora concateniamo l' substsuso del personaggio b(che non compare nei testi) come separatore. Nel codice Perl, l' substsarray viene archiviato @c(usando la parola nuda bper dire splitdove dividere), i nuovi testi confusi si trovano $ee il codice inverte semplicemente le 34 sostituzioni.


1
Qualche spiegazione?
feersum,

1
@feersum: Fatto.
Timwi,

5

Spretti , 302 byte

: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

Ho recentemente creato questo linguaggio e ho deciso di provarlo con questa sfida. Produce \ns invece di nuove righe perché emette in HTML, ma l'interprete è scritto in JavaScript. Per questo motivo, ecco una versione con <br>s anziché \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

Molto interessante. Abbiamo una regola qui che il linguaggio / interprete / compilatore deve esistere prima della sfida. Non vedo una data sul tuo interprete, quando è stata pubblicata?
Level River St

@steveverrill ce l'ho fatta ieri. Immagino che la mia risposta non sia valida allora.
DanTheMan,

3
Il consenso su Meta è che questo può ancora essere pubblicato ma non è applicabile per vincere. Probabilmente dovresti aggiungere un disclaimer alla tua risposta per informare OP
Downgoat

Puoi creare erun singolo token?
Solomon Ucko il

4

GolfScript (275 byte)

Questo contiene caratteri ASCII non stampabili, quindi ecco un 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                                  ](+

Come funziona? Per quanto posso dire, sembra che io sia l'unico ad usare una strategia "riffle and omit", che mi sorprende. Tuttavia, significa che sono al secondo posto dietro questa risposta.
Level River St,

Lempel-Ziv codificato a mano. Niente di interessante. Questo era praticamente il punto che ho cercato di chiarire in meta, ma chiaramente non abbastanza convincente.
Peter Taylor,

1
Beh, sono davvero deluso dal fatto che poche persone abbiano sfruttato appieno la struttura della canzone. L'opportunità era lì, come dimostra il fatto che sono al secondo posto a Ruby, a soli 28 byte dietro di te. Sono propenso a credere che una porta della mia risposta in golfscript verrebbe in meno di 275 byte. Pensi diversamente?
Level River St,

Ci ho provato con tutta la mia batteria di generatori di grammatica, e sono rimasto sorpreso dal fatto che LZ sia uscito avanti (sebbene l'avido costruttore di grammatica fosse solo un byte indietro). Ma non sarei sorpreso se una delle porte di questo GolfScript o una porta dell'approccio grammaticale avido di 276 byte in Ruby uscisse a meno di 303 byte.
Peter Taylor,

2

Rubino - 643 byte

Modifica: golfato da 899 a 830.

Modifica2: 830 -> 755.

Modifica3: 755 -> 684.

Modifica4: 684 -> 670.

Modifica5: 670 -> 643.

Non ho davvero usato il rubino, quindi sono sicuro che questo potrebbe essere risolto, questo è solo un tentativo:

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

2

JAVA 518 / 490Bytes

Modifica: 7 byte non necessari e aggiunta una versione Java 6 con il trucco statico {} Modifica2: Espandi spiegazione

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]);}}

Grazie a @Chris Drost per il suggerimento con i numerosi "ER" nel testo. La prima stringa è una tabella di ricerca, la seconda parte utilizza le lettere minuscole (che sono un blocco sequenziale in ascii) come indice nella tabella sottraendo il valore magico di a dal valore.

La seconda parte è composta da più stringhe di diversa lunghezza (quelle brevi sono parti comuni condivise tra più versetti) che vengono assemblate in una lunga prima che avvenga il looping dei caratteri


Bella risposta! +1 E so che sono passati circa 1,5 anni, ma puoi giocare a golf due cose: Rimuovi le usa la stringa contenente tutto #direttamente nel ciclo for-each, e cambia il charciclo for-each in int: Il 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]);risultato è -5 byte / 513 byte .
Kevin Cruijssen,

2

JavaScript ES6, 440 byte 438 byte

Questo è un mucchio di semplici ottimizzazioni della compressione. Come una linea:

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(/'))

Questo è stato scritto per essere uno script eseguibile tramite iojs --harmony_arrow_functions file.js; puoi radere l' console.log()overhead a seconda del significato di "output the lyrics".

Spiegazione

Dopo aver eseguito l'esterno .replace(), il codice inserito evalè:

// 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() 
)

gloria

  • @vihan, che mi ha ricordato che ES6 ha anche questa nuova brillante .repeatfunzione per le stringhe, risparmiando 2 byte.

Probabilmente puoi usare b.repeat(7)invece dib+b+b+b+b+b+b
Downgoat il

1

PowerShell, 659 byte

$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''

Crea una serie di parole chiave $a, quindi codifica i testi utilizzando una serie di stringhe numeriche che vengono inviate in un forciclo. Il ciclo accetta sottostringhe a due cifre, estrae la parola chiave corrispondente $adall'array e infine -join''concatena tutto insieme.

Penso che questo sia buono quanto questo metodo può essere fatto, poiché ogni volta che ho provato a giocare a golf ulteriormente (ad esempio, sostituendo 040008con una nuova variabile), si è rivelato essere un paio di byte più lunghi perché la lunghezza della sottostringa non era sufficiente per conto di tutte le citazioni extra necessarie. Sebbene siano state pubblicate alcune nuove risposte da quando ho iniziato che hanno metodi leggermente diversi che sembrano essere più brevi in ​​PowerShell (come usare i caratteri ASCII per codificare, piuttosto che due cifre, forse?), Continuerò con questo.

Modifica: ho dimenticato la codifica sostitutiva che ho usato:

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-

se hai un modo per ottenere il codice ASCII di un personaggio che è facile da usare, allora dovrebbe funzionare per radere un mucchio di byte
masterX244

1

GolfScript , golf 251 byte

'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}/

Provalo online!

Codice inutile []e semplificato eliminato di conseguenza. Modificato ie jper @e ^consentire la rimozione di spazi bianchi. Assegnata la prima occorrenza ' 'alla variabile |per evitare di ripetere gli stessi tre caratteri.

GolfScript , prima versione funzionante 262 byte

'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]}/

Provalo online!

Questa è una porta della mia risposta di Ruby in golfscript usando lo stesso algoritmo di base: emette due volte l'elenco dei token, poi sfogliali nei versi e costruisci i versetti riga per riga, adattandoti alle peculiarità di ciascuno.

Ci sono un paio di differenze. Il numero per la punteggiatura della linea mediana corretta è nella base 81 (convenientemente rende un carattere ASCII stampabile per verso); e il numero che codifica se stampare o meno l'ultimo token viene modificato perché l'indice è 55-iinvece di i-28(quest'ultimo è stato trovato per causare problemi con poteri negativi che generano numeri frazionari invece di troncare a numero intero).

Commentate

'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.

252 byte. Utilizzare i simboli non utilizzati come nomi di variabili per evitare spazi bianchi e memorizzare lo spazio ( " ") in una variabile. Inoltre, non eseguire il pop dopo l'assegnazione a una variabile per abitudine.
Erik the Outgolfer,

@EriktheOutgolfer grazie per i suggerimenti, ma ho già pubblicato una versione da 251 byte che incorpora la maggior parte di essi. 51Tuttavia, hai notato uno spazio prima che mi mancasse. Lo riparerò più tardi e forse cercherò altri modi per accorciarlo. Questo è il mio primo programma di golfscript e li trovo molto difficili da leggere quando i simboli sono usati come variabili, quindi ho anche lasciato la mia prima versione funzionante a 262 byte almeno per ora.
Level River St

Ah, a quanto pare l'hai fatto, lol.
Erik the Outgolfer,

0

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

Ancora margini di miglioramento con nomi di variabili, ma è un inizio.


2
Potrebbe essere utile scrivere separatamente un elenco di tutti i nomi delle variabili in modo da poter vedere facilmente quali singole lettere non sono state ancora utilizzate e quindi cercare-sostituire i nomi delle variabili lunghe?
trichoplax,

0

Rubino, 486 byte

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

0

Rubino, 483 byte

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,' ',',']]

Funziona codificando ogni parola utilizzata nella canzone in una singola lettera, moltiplicando alcune stanze, quindi sostituendo le lettere codificate con i testi effettivi. Le virgole, gli spazi vengono lasciati così come sono. uè una newline.


2
Uovo di Pasqua: contiene la frasefuc b gud
dkudriavtsev,

0

PHP, 434 byte

$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
"]);

Provalo online!

Utilizzando il nostro sito, riconosci di aver letto e compreso le nostre Informativa sui cookie e Informativa sulla privacy.
Licensed under cc by-sa 3.0 with attribution required.