जब भी कोशिश की (और असफल) मेरे शिशु बेटे को अपना खाना खाने के लिए मना लिया, मैंने उसे गाने की कोशिश की। इस गीत के माध्यम से मध्य मार्ग मुझे एहसास हुआ कि फार्मूलाबद्ध संरचना गोल्फ कोडिंग के लिए अच्छी तरह से उधार दे सकती है!
कार्य एक प्रोग्राम या फ़ंक्शन लिखना है जो बिना इनपुट के स्वीकार करता है और निम्नलिखित पाठ का उत्पादन करता है:
There's a hole in the bottom of the sea
There's a hole in the bottom of the sea
There's a hole, there's a hole
There's a hole in the bottom of the sea
There's a log in the hole in the bottom of the sea
There's a log in the hole in the bottom of the sea
There's a hole, there's a hole
There's a hole in the bottom of the sea
There's a bump on the log in the hole in the bottom of the sea
There's a bump on the log in the hole in the bottom of the sea
There's a hole, there's a hole
There's a hole in the bottom of the sea
There's a frog on the bump on the log in the hole in the bottom of the sea
There's a frog on the bump on the log in the hole in the bottom of the sea
There's a hole, there's a hole
There's a hole in the bottom of the sea
There's a wart on the frog on the bump on the log in the hole in the bottom of the sea
There's a wart on the frog on the bump on the log in the hole in the bottom of the sea
There's a hole, there's a hole
There's a hole in the bottom of the sea
There's a hair on the wart on the frog on the bump on the log in the hole in the bottom of the sea
There's a hair on the wart on the frog on the bump on the log in the hole in the bottom of the sea
There's a hole, there's a hole
There's a hole in the bottom of the sea
There's a fly on the hair on the wart on the frog on the bump on the log in the hole in the bottom of the sea
There's a fly on the hair on the wart on the frog on the bump on the log in the hole in the bottom of the sea
There's a hole, there's a hole
There's a hole in the bottom of the sea
There's a flea on the fly on the hair on the wart on the frog on the bump on the log in the hole in the bottom of the sea
There's a flea on the fly on the hair on the wart on the frog on the bump on the log in the hole in the bottom of the sea
There's a hole, there's a hole
There's a hole in the bottom of the sea
There's a smile on the flea on the fly on the hair on the wart on the frog on the bump on the log in the hole in the bottom of the sea
There's a smile on the flea on the fly on the hair on the wart on the frog on the bump on the log in the hole in the bottom of the sea
There's a hole, there's a hole
There's a hole in the bottom of the sea
चुनौती नियम:
- पाठ को फ़ंक्शन आउटपुट के रूप में मुद्रित या लौटाया जा सकता है
- प्रत्येक कविता को एक खाली लाइन द्वारा अलग किया जाता है
- व्हाट्सएप को पीछे छोड़ना तब तक ठीक है, जब तक कि यह लेआउट में बदलाव न करे (इसलिए शब्दों के बीच कोई अग्रणी व्हाट्सएप या अतिरिक्त स्थान नहीं)
- अनुगामी newlines भी ठीक हैं।
- कोई नई बात नहीं।
- सभी भाषाओं ने स्वागत किया, और यह कोड-गोल्फ है , इसलिए प्रत्येक भाषा की जीत के लिए बाइट्स में सबसे छोटा उत्तर है!
gzip -5
इसे 186 बाइट्स तक संपीड़ित करता है ( bzip2
और xz
लगता है कि यह और भी बदतर है)।