A versão mais bonita, você diz? Então, vamos tentar este em ...
The Marvelously Insane FizzBuzzJazz Program.
Lady Capulet, an old bossy woman that loves to count.
The Archbishop of Canterbury, an old fart who adores to spit out letters.
Act I: The only one of them.
Scene I: The Archbishop of Canterbury is a bastard.
[Enter The Archbishop of Canterbury and Lady Capulet]
The Archbishop of Canterbury:
You are nothing!
Scene II: Count, Lady Capulet, count.
The Archbishop of Canterbury:
You are as beautiful as the sum of yourself and a cat!
Lady Capulet:
Am I worse than the square of the product of the sum of a warm gentle flower and a rose
and my pretty angel?
The Archbishop of Canterbury:
If not, let us proceed to Scene VIII.
Scene III: Fizzing to no end!
The Archbishop of Canterbury:
Is the remainder of the quotient between yourself and the sum of a happy cow and a
chihuahua as good as nothing?
Lady Capulet:
If not, let us proceed to Scene IV. Thou art as handsome as the sum of the sum of
the sweetest reddest prettiest warm gentle peaceful fair rose and a happy proud kindgom
and a big roman. Speak thy mind!
Thou art as fair as the sum of thyself and a honest delicious cute blossoming peaceful
hamster. Thou art as cunning as the sum of the sum of an embroidered King and a horse
and thyself. Speak thy mind!
Thou art as amazing as the sum of the sum of a good happy proud rich hero and a hair and
thyself! Speak thy mind.
Speak your mind!
Scene IV: Milady, there is jazz in thy robe.
The Archbishop of Canterbury:
Is the remainder of the quotient between yourself and a proud noble kingdom as good as
nothing?
Lady Capulet:
If not, let us proceed to Scene V. You are as charming as the sum of the sum of a noble
cunning gentle embroidered brave mighty King and a big warm chihuahua and an amazing
pony! Speak your mind!
You are as prompt as the sum of yourself and a big black sweet animal. You are as noble
as the sum of the sum of a gentle trustworthy lantern and yourself and a hog. Speak your
mind!
You are as bold as the sum of the sum of yourself and a good delicious healthy sweet
horse and my smooth cute embroidered purse. You are as peaceful as the sum of a flower
and yourself. Speak your mind.
Speak your mind!
Scene V: Buzz me up, Scotty!
The Archbishop of Canterbury:
Is the remainder of the quotient between yourself and the sum of a gentle happy cow and a
chihuahua as good as nothing?
Lady Capulet:
If not, let us proceed to Scene VI. Thou art as handsome as the sum of the sweetest
reddest prettiest warm gentle peaceful fair rose and a small town. Speak your mind!
You are as prompt as the sum of yourself and a big healthy peaceful fair rich kingdom.
You are as loving as the sum of the sum of an embroidered King and a horse and thyself.
You are as amazing as the sum of yourself and a cute fine smooth sweet hamster. Speak
your mind!
You are as prompt as the sum of the sum of yourself and an amazing cunning Lord and a
hair. Speak your mind.
Speak your mind!
The Archbishop of Canterbury:
Let us proceed to Scene VII.
Scene VI: Output or die!
The Archbishop of Canterbury:
Open your heart!
Scene VII: Oh, to jump the line.
Lady Capulet:
You are as handsome as the sum of a proud noble rich kingdom and a rural town. Speak your
mind! You are as gentle as the sum of the sum of yourself and a green mistletoe and my
father. Speak your mind!
The Archbishop of Canterbury:
We must return to Scene II.
Scene VIII: Goodbye, cruel world!
[Exeunt]
Então, depois da minha luta com a SPL aqui , senti que tinha que fazer pelo menos uma finalização em qualquer desafio. E é isso.
Então, o que é tudo isso então?
Então, primeiro, declaramos as variáveis que usaremos ao longo do programa, que devem vir das peças de Shakespeare. Farto de Romeu, Julieta, Ofélia e Othello, fui com o Arcebispo de Cantuária e Lady Capulet . Suas descrições, assim como os títulos de Atos / Cenas, são desprezados pelo analisador, para que você possa colocar praticamente tudo o que quiser.
Então, vamos fazer um rei da tradução para algo um pouco menos sem sentido .
Ato I, Cena I
Begin
Lady Capulet = 0;
O ato I é bem direto: inicializamos nossa variável com 0.
Ato I, Cena II
Lady Capulet += 1;
if(Lady Capulet < Math.pow((2*2*1+1)*(2*1),2))
continue;
else
goto Scene VIII;
Nós aumentamos o valor de Lady Capulet e o comparamos com 100 (sim, essa frase inteira serve apenas para obter o número 100); se não for menor, pularemos para a cena VIII (final); caso contrário, continuamos na próxima cena.
Ato I, Cena III
if(Lady Capulet % (2+1) == 0)
continue;
else
goto Scene IV;
The Archbishop of Canterbury = 2*2*2*2*2*2*1;
System.out.print((char)The Archbishop of Canterbury);
The Archbishop of Canterbury += 2*2*2*2*2*1;
The Archbishop of Canterbury += 2*1+1;
System.out.print((char)The Archbishop of Canterbury);
The Archbishop of Canterbury += 2*2*2*2*1+1;
System.out.print((char)The Archbishop of Canterbury);
System.out.print((char)The Archbishop of Canterbury);
Primeiro, vemos se o módulo da divisão por 3 é 0; caso contrário, passamos para a cena IV; se for, começamos a fazer operações aritméticas e as armazenamos no Arquieperson, produzindo-as na forma de caractere assim que encontrarmos a que procuramos. Sim, no final, a ideia é entender Fizz
.
Ato I, Cena IV
if(Lady Capulet % (2*2) == 0)
continue;
else
goto Scene V;
The Archbishop of Canterbury = 2*2*2*2*2*2*1+2*2*1+2*1;
System.out.print((char)The Archbishop of Canterbury);
The Archbishop of Canterbury += 2*2*2*1;
The Archbishop of Canterbury += 2*2*1+(-1);
System.out.print((char)The Archbishop of Canterbury);
The Archbishop of Canterbury += 2*2*2*2*1+2*2*2*1;
The Archbishop of Canterbury += 1;
System.out.print((char)The Archbishop of Canterbury);
System.out.print((char)The Archbishop of Canterbury);
Primeiro verifica se o módulo da divisão por 4 é 0 e depois continua como a mesma cena de antes Jazz
.
Ato I, Cena V
if(Lady Capulet % (2*2+1) == 0)
continue;
else
goto Scene VI;
The Archbishop of Canterbury = 2*2*2*2*2*2*1+2*1;
System.out.print((char)The Archbishop of Canterbury);
The Archbishop of Canterbury += 2*2*2*2*2*1;
The Archbishop of Canterbury += 2*1+1;
The Archbishop of Canterbury += 2*2*2*2*1;
System.out.print((char)The Archbishop of Canterbury);
The Archbishop of Canterbury += 2*2+1;
System.out.print((char)The Archbishop of Canterbury);
System.out.print((char)The Archbishop of Canterbury);
goto Scene VII;
Funciona como as duas anteriores, verificando se o módulo da divisão por 5 retorna 0 e, em seguida, tenta escrever Buzz
; a única diferença é que, no final, pulamos uma cena.
Ato I, Cena VI
System.out.print(Lady Capulet);
Para chegar a essa cena, o número assumido por Lady Capulet não deve ter sido nem Fizz, nem Jazz, nem Buzz; então, nós a produzimos na forma numérica.
Ato I, Cena VII
The Archbishop of Canterbury = 2*2*2*1+2*1;
System.out.print((char)The Archbishop of Canterbury);
The Archbishop of Canterbury += 2*1+1;
System.out.print((char)The Archbishop of Canterbury);
goto Scene II;
Então, essa é a única maneira que encontrei para pular para a próxima linha: saída, primeiro, um CR, depois um LF; então, voltamos à cena II, para a qual podemos continuar com o programa.
Ato I, Cena VIII
End.
Simples o suficiente.
Ainda estou tentando ver se posso mostrar isso em execução on-line, mas não consigo encontrar um compilador on-line - aquele que eu conheço não parece combinar bem com nenhum programa, exceto o que já foi carregado, ou talvez haja algum tipo de problema com a interface entre o teclado e a cadeira ...
Atualização 1:
Após o comentário de mathmandan, editei a ordem das cenas de Jazz e Buzz. Tinha que ser feito.