Versi paling indah, katamu? Lalu, mari kita coba yang ini di ...
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]
Jadi, setelah perjuangan saya dengan SPL di sini , saya merasa harus melakukan setidaknya satu pengajuan dengan itu pada setiap tantangan. Dan ini dia.
Jadi, ada apa ini?
Jadi, pertama, kami mendeklarasikan variabel yang akan kami gunakan di seluruh program, yang harus berasal dari drama Shakespeare. Muak dengan Romeo, Juliet, Ophelia dan Othello, saya pergi dengan Uskup Agung Canterbury dan Lady Capulet . Deskripsi mereka, serta judul Kisah Para Rasul '/, adegan dihilangkan oleh parser, sehingga Anda dapat meletakkan apa pun yang Anda suka di sana.
Jadi, mari kita buat raja terjemahan ke sesuatu yang sedikit kurang omong kosong .
Babak I, Adegan I
Begin
Lady Capulet = 0;
Babak I cukup mudah: kita menginisialisasi variabel kita dengan 0.
Babak I, Adegan II
Lady Capulet += 1;
if(Lady Capulet < Math.pow((2*2*1+1)*(2*1),2))
continue;
else
goto Scene VIII;
Kami menambah nilai Lady Capulet dan membandingkannya dengan 100 (ya, seluruh kalimat itu hanya berfungsi untuk mendapatkan angka 100); jika tidak lebih kecil, kita lompat ke Scene VIII (akhir); jika tidak, kami melanjutkan ke Adegan berikutnya.
Babak I, Adegan 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);
Pertama, kita melihat apakah modulus pembagian dengan 3 adalah 0; jika tidak, kita lompat ke Adegan IV; jika ya, kita mulai melakukan operasi aritmatika dan menyimpannya di Archieperson, mengeluarkannya dalam bentuk karakter begitu kita menemukan yang kita cari. Ya, pada akhirnya, idenya adalah untuk mendapatkan Fizz
.
Babak I, Adegan 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);
Pertama memeriksa apakah modulus pembagian dengan 4 adalah 0, kemudian berlanjut sebagai adegan yang sama seperti sebelumnya, untuk Jazz
.
Babak I, Adegan 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;
Berfungsi seperti dua sebelumnya, memeriksa apakah modulus pembagian dengan 5 mengembalikan 0, kemudian mencoba untuk menulis Buzz
; satu-satunya perbedaan adalah, pada akhirnya, kami melewatkan adegan.
Babak I, Adegan VI
System.out.print(Lady Capulet);
Untuk mencapai Adegan ini, nomor yang diasumsikan oleh Lady Capulet pastilah bukan Fizz, Jazz, atau Buzz; jadi, kami mengeluarkannya dalam bentuk angka.
Babak I, Adegan 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;
Jadi, ini adalah satu-satunya cara yang saya temukan untuk melompat ke baris berikutnya: output, pertama, CR, lalu LF; lalu, kita kembali ke Scene II, untuk itu kita bisa melanjutkan program.
Babak I, Adegan VIII
End.
Cukup mudah.
Saya masih mencoba untuk melihat apakah saya dapat menunjukkan ini berjalan online, tetapi saya tidak dapat menemukan kompiler online - yang saya tahu tampaknya tidak dapat digabungkan dengan baik dengan program apa pun kecuali yang sudah dimuat, atau mungkin ada semacam masalah dengan antarmuka antara keyboard dan kursi ...
Pembaruan 1:
Setelah komentar mathmandan, saya mengedit urutan adegan Jazz dan Buzz. Itu harus dilakukan.