tidak ada yang akan cukup gila untuk memasuki tantangan kode-golf dengan SPL, jadi ...
Kata-kata saya sendiri, beberapa waktu lalu. Namun, seseorang cukup gila untuk melakukannya. Ya ya saya tahu. Terlalu banyak byte. Tapi SPL layak untuk dimasukkan di sini, saya pikir. Dan percayalah , saya telah melakukan upaya besar untuk "golf" program ini, itulah sebabnya itu sedikit berulang dan menggunakan sebagian besar kata-kata yang sama (saya selalu bisa mengikuti saran DLosc , tapi itu akan menjadi terlalu ekstrem bahkan untuk saya) .
A Happy Birth Day
Ajax, a hero
Ford, a man
Act I: 1
Scene I: 1
[Enter Ajax and Ford]
Ajax:
You are nothing!
Scene II: 2
Ford:
Am I nicer than the sum of a big cow and a son?
Ajax:
If so, we shall go to Scene V. You are as big as the sum of thyself and a cat!
Scene III: 3
Ford:
You are as red as the sum of a big red warm rich bold fair cat and a big rich fine son.
Speak thy mind! You are as big as the sum of thyself and the sum of a cute fair fine
rich cat and a hog! Speak thy mind! You are as big as the sum of thyself and the sum
of a cute fair fine rich cat and a hog. Speak thy mind. Speak thy mind! You are as bold as
the sum of thyself and the sum of a big fine fair cat and a cow. Speak thy mind! You are
as big as a red old fair fine tiny cow. Speak thy mind! You are as old as the sum of
thyself and the sum of a red old fair fine tiny cow and a big joy. Speak thy mind.
You are as red as the sum of thyself and the sum of the sum of a red old fair fine
tiny cow and a rich old red sky and a pig. Speak thy mind! You are as old as the sum
of thyself and the sum of a big fine fair joy and a son. Speak thy mind. You are as
red as the sum of thyself and a cute son. Speak thy mind! You are as cute as the sum
of thyself and the sum of a bad fat vile pig and a fat bad lie. Speak thy mind! You are
as fat as the sum of thyself and a vile evil war. Speak thy mind! You are as vile as the
sum of thyself and the sum of a pig and a toad. Speak thy mind! You are as fair as the
sum of thyself and the sum of a big fair hard fine son and a red fine fair joy. Speak
thy mind! Are you as old as a big cow?
Ajax:
If so, we shall go to Scene IV.
Ford:
You are as big as a red old fair fine tiny cow. Speak thy mind! You are as old as the sum
of thyself and the sum of the sum of a big red warm rich bold fair cat and a red old fair
fine tiny cow and a bad hog. Speak thy mind! You are as big as the sum of thyself and the
sum of a fat bad hog and a war. Speak thy mind! You are as big as a red old fair fine tiny
cow. Speak thy mind! You are as old as the sum of thyself and the sum of a big red warm
rich bold fair cat and a fat foul bad hog and a son. Speak thy mind. You are as fat as
the sum of thyself and the sum of the sum of a big fair hard fine son and a big fine
fair joy and a bad pig. Speak thy mind.
Ajax:
Let us return to Scene II.
Scene IV: 4
Ford:
You are as big as a red old fair fine tiny cow. Speak thy mind! You are as old as the
sum of thyself and a big red warm rich bold fair cat and a warm sky. Speak thy mind.
You are as fat as the sum of thyself and the sum of a red old fair fine tiny cow and a
cat. Speak thy mind. You are as fat as the sum of thyself and a bad foul hog. Speak
thy mind. You are as cute as the sum of thyself and the sum of a big fair hard fine
son and a sky. Speak thy mind. You are as big as a red old fair fine tiny cow. Speak thy
mind! You are as old as the sum of thyself and the sum of thyself and the sum of the sum
of the sum of a red old fair fine tiny cow and a big fair hard fine son and a big joy and
a son. Speak thy mind. You are as bad as the sum of thyself and the sum of a fat pig and a
hog. Speak thy mind. You are as fat as the sum of thyself and a lazy pig. Speak thy mind.
Ajax:
Let us return to Scene II.
Scene V: 5
[Exeunt]
Arti dari semua ini?
OK, jika Anda ingin tahu bagaimana semua ini seharusnya bekerja, izinkan saya mencoba dan menjelaskan alasan saya. Pertama, variabel. Mereka harus berasal dari drama Shakesperian dan, karena jumlah bakteri penting, kita harus memilih yang kecil; demikian, Ajax
dan Ford
muncul. Mereka membutuhkan deskripsi setelah dideklarasikan (yang diabaikan, tetapi masih); Saya bisa menggunakan satu huruf, tapi heh.
Babak I, Adegan I
var Ajax, Ford;
Ford = 0;
Kami membawa variabel ke atas panggung dan memberi Ajax
tahu Ford
bahwa nilainya adalah 0.
Babak I, Adegan II
if (Ford > 2*1+1)
goto Scene V;
Ford = Ford + 1;
OK, jika nilai yang disimpan Ford
lebih besar dari 3, program melompat ke Scene V; selain itu, nilainya bertambah.
Babak I, Adegan III
Ford = 2*2*2*2*2*2*1+2*2*2*1;
print((char) Ford);
Ford = Ford+2*2*2*2*1-1;
print((char) Ford);
Ford = Ford+2*2*2*2*1-1;
print((char) Ford);
print((char) Ford);
Ford = Ford+2*2*2*1+1;
print((char) Ford);
Ford = 2*2*2*2*2*1;
print((char) Ford);
Ford = Ford+2*2*2*2*2*1+2*2*2*1+(-1);
print((char) Ford);
Ford = Ford+2*2*2*1+1;
print((char) Ford);
Ford = Ford+2*1;
print((char) Ford);
Ford = Ford+2*2*2*(-1)+2*2*(-1);
print((char) Ford);
Ford = Ford+2*2*(-1);
print((char) Ford);
Ford = Ford+2*(-1)+(-1);
print((char) Ford);
Ford = Ford+2*2*2*2*1+2*2*2*1;
print((char) Ford);
if (Ajax == 2*1)
goto Scene IV;
Ford = 2*2*2*2*2*1;
print((char) Ford);
Ford = Ford+2*2*2*2*2*2*1+2*2*2*2*2*1+2*(-1);
print((char) Ford);
Ford = Ford+2*2*(-1)+(-1);
print((char) Ford);
Ford = 2*2*2*2*2*1;
print((char) Ford);
Ford = Ford+2*2*2*2*2*2*1+2*2*2*(-1)+1;
print((char) Ford);
Ford = Ford+2*2*2*2*1+2*2*2*1+2*(-1);
print((char) Ford);
Ford = Ford+2*2*2*1+2*-1;
print((char) Ford);
goto Scene II;
Banyak dan banyak garis. Idenya adalah untuk mengutak-atik nilai yang disimpan Ford
, melakukan banyak dan banyak operasi aritmatika untuk mendapatkan nomor ASCII dari huruf yang diinginkan, kemudian kami memberitahu kompiler untuk menampilkan angka dalam bentuk karakter. Begitulah cara Anda menulis Happy Birthday
. Ada bagian if
dalam adegan ini: idenya adalah untuk memeriksa apakah ini adalah frase ketiga dari lagu; jika ya, kita lompat ke Scene IV; kalau tidak kita terus maju, untuk menulis to You
. Setelah itu, kita kembali ke Scene II.
Babak I, Adegan IV
Ford = 2*2*2*2*2*1;
print((char) Ford);
Ford = Ford+2*2*2*2*2*2*1+2*2*1;
print((char) Ford);
Ford = Ford+2*2*2*2*2*1+1;
print((char) Ford);
Ford = Ford+2*2*(-1);
print((char) Ford);
Ford = Ford+2*2*2*2*1+1;
print((char) Ford);
Ford = 2*2*2*2*2*1;
print((char) Ford);
Ford = Ford+2*2*2*2*2*1+2*2*2*2*1+2*1+1;
print((char) Ford);
Ford = Ford+2*(-1)+(-1);
print((char) Ford);
Ford = Ford+2*2*(-1);
print((char) Ford);
goto Scene II;
Cara kerjanya mirip dengan Adegan di atas: idenya adalah menulis Dear SPL
.
Babak I, Adegan V
End.
Seperti itu.
Saya masih belum menemukan tempat di mana ini dapat diuji, sayangnya ...