সমুদ্রের নীচে একটি গর্ত আছে


48

চেষ্টা করে (এবং ব্যর্থ হয়ে) আমার শিশু পুত্রকে তার নৈশভোজ খেতে রাজি করিয়েছে, আমি তাকে গান গাওয়ার চেষ্টা করেছি। এই গানের মধ্য দিয়ে আমি বুঝতে পেরেছি যে সূত্রের কাঠামো কোড গল্ফিংয়ের জন্য নিজেকে ভাল ধার দিতে পারে!

কাজটি হ'ল একটি প্রোগ্রাম বা ফাংশন লিখুন যা কোনও ইনপুট গ্রহণ করে না এবং নীচের পাঠ্য উত্পাদন করে:

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

চ্যালেঞ্জ বিধি:

  • পাঠ্যটি মুদ্রিত বা ফাংশন আউটপুট হিসাবে ফিরে আসতে পারে
  • প্রতিটি আয়াত একক ফাঁকা রেখার দ্বারা পৃথক করা হয়
  • শ্বেত স্পেসটি অনুসরণ করা ঠিক আছে যতক্ষণ না এটি বিন্যাসটি পরিবর্তন করে না (সুতরাং কোনও শ্বেত স্পেস বা শব্দের মধ্যে অতিরিক্ত স্থান নেই)
  • ট্রেলিং নিউলাইনগুলিও ঠিক আছে।
  • কোনও শীর্ষস্থানীয় নিউলাইন নেই।
  • সমস্ত ভাষা স্বাগত জানায়, এবং এটি , তাই প্রতিটি ভাষার জন্য বাইটের মধ্যে সংক্ষিপ্ত উত্তর!

6
ওজড ওল্ড লেডি-এর অনুরূপ (অন্যান্য অনুরূপ চ্যালেঞ্জগুলি যেমন ডুপ্লিকেট হিসাবে বন্ধ করা হয়েছে, যদিও আমি মনে করি না যে তাদের অবশ্যই করা উচিত।)
জনাথন অ্যালান

6
হো, রো, র্যাটলিনের বোগ, উপত্যকা-ও-তে বোগ
fəˈnɛtɪk

4
তুলনা করার জন্য (যদিও একটি প্রোগ্রামিং ভাষা) gzip -5এটা 186 বাইট সংকোচন (এবং bzip2এবং xzখারাপ কাজ করতে হবে বলে মনে হচ্ছে)।
ড্যানিয়েল শেপলার

2
অভিনন্দন, অন্য বিকাশকারী পিতা-মাতার কাছ থেকে :)
এজেফারাডে

1
আমি এই গানটি 05AB1E এর সাথে খাপ খাইয়ে নিতে চাই ... "ওহ-ফাইভ-আই-মৌমাছি-ও-ই-তে একটি গর্ত রয়েছে!"
ম্যাজিক অক্টোপাস উরান

উত্তর:


23

এসওজিএল , 103 94 93 বাইট

Ψ ~Δ№Q‘离vζh‛←&M⁶╥7[P≈╔6≡⁸(φΔ\⅔Σ‚>≡ā⁷⁽○¹‘Ξ⁵K4s³‘⁽Bθ2n{@∑" the ”+Κ:bΚē‽:C}TPb"n@²‘+Tō, upcPøP

এখানে চেষ্টা করুন!

...‘                 push "bottom of the sea" - kept for the loop, here for 
    ...‘             push "hole in log in bump on frog on wart on hair on fly on flea on smile on"
        ...‘         push "there's a "
            ⁽        uppercase the 1st letter of that
             B       save "There's a " in B
              θ      split the long data string on spaces
               2n    split in arrays of length 2

{                     for each of those:
 @∑                   join the current array with spaces - e.g. "hole in"
   " the ”+           append " the " to it
           Κ          prepend that to "bottom of the sea" (or whatever it is now)
            :         create a copy
             bΚ       prepend B to it - finishes current line
               ē‽:C}  if (E++), save a copy of that in C (for the last line)

TP                   print the current line twice
  b"...‘+            B + "hole" - "There's a hole"
         T           output that, keeping item
          ō,         output ", "
             up      print the kept item lowercased
               cP    print the contents of C
                 øP  print an empty line

14
কিন্তু .... তবে কীভাবে?
সুমশাইনিজেক্ট

8
অবিশ্বাস্য। কীভাবে সমান
অস্টিন বুর্ক

1
এইচএনকিউ আবার হরতাল! : \
শেগি

4
আপনি একটি ব্যাখ্যা যোগ করতে আপত্তি হবে? এটি কীভাবে কাজ করে তা দেখার জন্য আগ্রহী।
কেভিন ক্রুইজসেন

@ কেভিন ক্রুজসেন যোগ করেছেন
ডিজাইমা

19

স্ট্যাক্স , 90 87 75 বাইট

¥▌▼h4█☻■Ω1gçΔ¶Zjµ│☺X▄)/╞▄╒)¥jêLqα╧ñu┌⌂½╧ûⁿ↕O◘╔╪kl<æàbπïfuσ♪╫qΓ╪ûQ├╘Te♥Æó♣ƒE

এটি চালান এবং এটি ডিবাগ করুন

আনপ্যাকড, অরগল্ফড এবং মন্তব্য করা দেখে মনে হচ্ছে এটি এমনই।

`;$w]i"50h1&V~OP>F$`            compressed literal for "There's a hole in the bottom of the sea"
X                               store in register X without popping
zG                              push an empty string and jump to the target (trailing }) 
`hfUiVx}.|j~vG12])Bxk?v zF`j    split "log bump frog wart hair fly flea smile" into array of words
F                               for each word, execute the following
  i. o. i?                      (i ? " o" : " i") where i is the 0-based iteration index
  +                             concatenate to the word
  `_o9!`+                       concatenate "n the "
  G                             jump to target below, resume next foreach iteration when finished
}                               this is the target of `G`, execution resumes when finished
  As|@                          insert substring at position 10
  QQ                            peek and print with newlines twice
  x14(                          trim string to leftmost 14 characters
  q                             peek and print without newlines
  ., p                          print ", " without newline
  vP                            lowercase 14 characters and print with newline
  xP                            push value of register X, then print with newline
  zP                            print blank line

এটি চালান


2
আপনি একটি ব্যাখ্যা যোগ করতে আপত্তি হবে? এটি কীভাবে কাজ করে তা দেখার জন্য আগ্রহী।
কেভিন ক্রুইজসেন

আমি কিন্তু আমার এখনও অনুভূতি আছে যে সম্পূর্ণ ভিন্ন পদ্ধতির আরও ভাল করা সম্ভব। আমি সফল বা ব্যর্থ হওয়ার পরে আমি যা যা বাকী আছে তা ব্যাখ্যা করব।
পুনরাবৃত্তি

1
@ কেভিন ক্রুজসেন: আমার মনে হয়েছিল যে আরও অনেক ভাল উপায় আছে। নিশ্চিতভাবেই, আমি এটি পুরোপুরি আবার লিখেছি এবং আরও 12 টি বাইট ফোলাতে সংরক্ষণ করেছি। আমি পাশাপাশি কিছু ব্যাখ্যা যোগ।
পুনরাবৃত্তি

16

পার্ল 5, 158 154 বাইট

$_="There's a bottom of the sea
";for$,(<{{hole,log}" i",{bump,frog,wart,hair,fly,flea,smile}" o"}>){s/a/a $,n the/;say$_.$_.($t||=s/.{14}/$&, \l$&
$&/r)}

154 বাইট

158 বাইট


5
There's a bottom of the sea। তথ্যগুলি পরীক্ষা করে দেখুন, +1
জো কিং

:), এই প্রকরণটি দিয়ে শুরু হচ্ছে There's a seaতবে এটি আরও দীর্ঘ
নাহুয়েল ফুইলুল

13

পাইথন 2 , 202 190 187 185 183 182 181 বাইট

s="bottom of the sea\n"
a="There's a "
for w in'hole log bump frog wart hair fly flea smile'.split():s=w+" %sn the "%'io'['g'in s]+s;print(a+s)*2+a+"hole, t%shole\n"%a[1:]+a+s[-30:]

এটি অনলাইন চেষ্টা করুন!

পুরানো বিকল্প 'io'['g'in s](13 বাইট):

  • 14: 'oi'[s[5]<'n']
  • 15: 'io'[len(s)>30], 'ioo'[len(s)%3], 'ooi'[len(s)%4], এবং'io'[w[1]=='o']

সংরক্ষিত:

  • -1 বাইট, জোনাথন অ্যালানকে ধন্যবাদ
  • -১ বাইট, রডকে ধন্যবাদ
  • -1 বাইট, এরিক দি আউটগলফারকে ধন্যবাদ

"hole, t%shole\n"%a[1:]একটি বাইট সংরক্ষণ করুন
জোনাথন অ্যালান

আপনি জিপটি ফেলে একটি বাইট সংরক্ষণ করতে পারেন
রড


@ রড ধন্যবাদ, :-)
টিফিল্ড

'oi'[s[5]<'n']একটি পুরানো বিকল্পও হবে: বৈশিষ্ট্যযুক্ত 'io'['g'in s]!
এরিক আউটগলফার

13

সি (জিসিসি) , 261 246 236 বাইট

#define X" on the "
char*a="smile"X"flea"X"fly"X"hair"X"wart"X"frog"X"bump"X"log in the hole in the bottom of the sea\n";f(i){for(i=0;i<9;)printf("T%s%sT%1$s%2$sT%1$shole, t%1$shole\nT%1$s%3$s\n","here's a ",a+"_TH<0$\31\r"[i++],a+95);}

-15 বাইটস, ড্যানিয়েল শেপলার
-10 বাইট, সিলিংক্যাট ধন্যবাদ

এটি অনলাইন চেষ্টা করুন!


2
আপনি কি ,*b="_TH<0$\31\r"পরিবর্তে লিখতে পারেন ?
ড্যানিয়েল শেপলার

এটি "ইন" সংজ্ঞায়িত করতে কোনও বাইট সংরক্ষণ করবে?
OldBunny2800


12

05AB1E , 103 100 99 97 96 93 92 বাইট

কেভিন ক্রুইজসেনকে একটি বাইট ধন্যবাদ সংরক্ষণ করা

“¥ÊˆŽ bumpÑå‡îtíÁ¤†îÌea¹²“#v’T€Î's a ’s„oiN2‹èy“ÿ ÿn€€ ÿ“©“—耂€€í™“JDN_iDU}X14£Dl‚„, ýXõ»,®

এটি অনলাইন চেষ্টা করুন!

ব্যাখ্যা

“¥ÊˆŽ bumpÑå‡îtíÁ¤†îÌea¹²“#vতালিকার উপর দিয়ে একটি লুপ শুরু করে ["hole", "log", "bump", "frog", "wart", "hair", "fly", "flea", "smile"]। শব্দগুলি 05AB1E অভিধান ব্যবহার করে সংক্ষিপ্ত করা হয়েছে।

প্রতিটি আমরা করি:

’T€Î's a ’    # push the string "There's a "
s             # move the string from the previous iteration to the top of the stack
              # will be an empty string the first iteration since there is no input
„oiN2‹è       # push "i" for the first 2 iterations and "o" otherwise
y             # push the current word
“ÿ ÿn€€ ÿ“    # use interpolacing to create the meat of the current iteration string
              # meaning "hole in the ", "log in the hole in the " and so on
©             # store a copy in the register for the next iteration
“—耂€€í™“    # push the string "bottom of the sea"
JD            # join the whole line together and duplicate it
N_iDU}        # if this is the first iteration, store a copy of the line in X
X14£          # push the first 14 chars of X, which is "There's a hole"
Dl            # make a lower-case copy
‚„, ý         # join the original with the lowercase copy on ", ", forming line 3
X             # push X which is line 4
õ             # push and empty string, to create the line break between sections
»,            # join the whole section on newlines and print
®             # push the register for the next iteration

2
আপনি নেতৃস্থানীয় মুছে ফেলতে পারেন õ, কারণ স্ট্যাকের কোনও কিছুই না রেখে যখন একটি sওয়াপ ব্যবহার করা হয় তখন স্পষ্টতই এটি ডিফল্ট হিসাবে একটি খালি স্ট্রিং আউটপুট দেয় । আমি গল্ফের আর কিছু খুঁজে পাইনি; খুব সুন্দর উত্তর!
কেভিন ক্রুইজসেন

1
@ কেভিন ক্রুজসেন: ওহ হ্যাঁ, আমি সাধারণত বিবেচনা করি না যে ইনপুট রয়েছে। ধন্যবাদ :)
এমিগিনা

11

পাওয়ারশেল , 194 188 185 180 174 বাইট

$z=$a="in the bottom of the sea"
$b="here's a"
$h="$b hole"
echo hole log bump frog wart hair fly flea smile|%{,"T$b $_ $a"*2
$a='oi'[!$j++]+"n the $_ $a"
"T$h, t$h
T$h $z
"}

এটি অনলাইন চেষ্টা করুন!

পাইথন ধরতে বেশ মনে হচ্ছে না ...

মূলত, কয়েকটি সাধারণ স্ট্রিং সেট $h, $a, $z, এবং $b, তারপর যায় আইটেম প্রতিটি মাধ্যমে একটি লুপের মাধ্যমে ( hole, log, ... flea, smile), প্রতিটি পুনরাবৃত্তির উপযুক্ত শ্লোক outputting। !$j++মাঝখানে কিছুটা যুক্তি আছে যা ঘটে in/ onস্যুইচ হয়ে যায় তার জন্য অ্যাকাউন্ট করতে । অন্যথায়, সমস্ত স্ট্রিং কেবল পাইপলাইনে রেখে গেছে, এবং ডিফল্টটি Write-Outputআমাদের জন্য নিখরচায় নতুন লাইন দেয়।

-6 বাইট ধন্যবাদ আর্নল্ডকে।
-3 বাইট মজির ধন্যবাদ।
-5 বাইট ধন্যবাদ ভেস্কাহকে।
-6 বাইট মজির ধন্যবাদ।



@ মমজি এটি একটি চালাক কৌশল। আমার এটি মনে রাখা দরকার, কারণ আমি -splitশব্দ পাওয়ার জন্য বেশ খানিকটা ব্যবহার করি ।
অ্যাডমবর্কবার্ক




9

জাভাস্ক্রিপ্ট (ES6),  201 194 189 188  187 বাইট

1 শাটগি ধন্যবাদ 1 বাইট সংরক্ষণ করা

_=>`14log4bump5frog5wart5hair5fly5flea5smile5`.replace(/.+?\d/g,w=>`T0${(p=w+3+p)+p}1, t01
T01432
`.replace(/\d/g,n=>`here's a |hole|bottom of the sea
|n the | i| o`.split`|`[n]),p=`2T0`)

এটি অনলাইন চেষ্টা করুন!


জাভাস্ক্রিপ্ট (ES6), 235 বাইট

সহজভাবে RegPack'ed

_=>[..."Z[]^_$cdjkqvxz{}~"].reduce((p,c)=>(l=p.split(c)).join(l.pop()),`Tj{{}qq}$$}~~}dd}__}xx}cc}[[v~ frogz$}v
Z{kZz on^x flyz_v], tj]Zkq log in^{k] in^ bottom of^ seajhere's ad wartz~c fleazx$ bumpzq_ hairzd^ the] hole[ smilezcZ
Tj`)

এটি অনলাইন চেষ্টা করুন!



7

জাপট -Rx, 126 116 113 112 111 109 107 বাইট

দেখা যাচ্ছে যে আপনার ফোনে বোজারটি ডাউন করার সময় একটি স্ট্রিং সংক্ষেপণ চ্যালেঞ্জকে গল্ফ করা অবিশ্বাস্যরকম কঠিন - কে থামবে ?!

`T's»dâ ÈÞ­omºfdÈ a`rdS
tE8
¯E
`logn¿mpnfgnØnirnf§nf¤Úè`qÍË2ÆiAV¯E©8 iF¯E ÔqVri'oÃpW+v iSi,)UPÃc

এটা পরীক্ষা করো

                                              :The first 3 lines get assigned to variables U, V & W, respectively
`...`                                         :The compressed string "There'sdadholedindthedbottomdofdthedsea"
     rdS                                      :Replace all "d"s with spaces
tE8                                           :Substring of U from 0-based index 14 (E), of length 8 (="  in the ")
¯E                                            :Slice U to index 14 (="There's a hole")
`...`                                         :The compressed string "lognbumpnfrognwartnhairnflynfleasmilent"
     qÍ                                       :Split on "n" (note that the last element is irrelevant)
       Ë                                      :Map each element at 0-based index E in array F
        2Æ                                    :  Map the range [0,2)
          iA                                  :    Insert the following in U at index 10
            V¯                                :      V sliced to index
              E©8                             :        Logical AND of E and 8 (=0 on first iteration, 8 on all others)
                  i                           :      Prepend
                   F¯E                        :        Slice F to index E
                       Ô                      :        Reverse
                        q                     :        Join with
                         Vri'o                :          Replace "i" with "o" in V
                              Ã               :  End map
                               p              :  Push
                                W+            :    W appended with
                                  v           :      W lowercased
                                    iSi,      :      Prepended with a space prepended with a comma
                                        )     :    End append
                                         UP   :    U and an empty string
                                           Ã  :End map
                                            c :Flatten
                                              :Implicitly join with newlines, trim & output

7

এক্সএমএল, 719 673 603 514 493 486 বাইট

<!DOCTYPE a[<!ENTITY T "There's a"><!ENTITY O " on the"><!ENTITY a " hole in the bottom of the sea
"><!ENTITY b " log in the&a;"><!ENTITY c " bump&O;&b;"><!ENTITY d " frog&O;&c;"><!ENTITY e " wart&O;&d;"><!ENTITY f " hair&O;&e;"><!ENTITY g " fly&O;&f;"><!ENTITY i " flea&O;&g;"><!ENTITY z "&T; hole, there's a hole
&T;&a;
">]><a>&T;&a;&T;&a;&z;&T;&b;&T;&b;&z;&T;&c;&T;&c;&z;&T;&d;&T;&d;&z;&T;&e;&T;&e;&z;&T;&f;&T;&f;&z;&T;&g;&T;&g;&z;&T;&i;&T;&i;&z;&T; smile&O;&i;&T; smile&O;&i;&z;</a>

আপনি এটি দিয়ে "চালনা" করতে পারেন xmlstarlet sel -t -m '//a' -v . -n <xml_file_here>

এক্সএমএলটি ভার্ভোস না থাকলে এটি অনেক সহজ হবে তবে উজ্জ্বল দিকে, এটি মূল পাঠ্যের 25% এরও কম less


5

রেটিনা 0.8.2 , 150 বাইট


THsmile oNflea oNfly oNhair oNwart oNfrog oNbump oNlog iNE
N
$&$'¶TH
O^$`

.+
$&¶$&¶THW, tHW¶THE¶
H
here's a 
E
W iNbottom of the sea
W
hole
N
n the 

এটি অনলাইন চেষ্টা করুন! ব্যাখ্যা:


THsmile oNflea oNfly oNhair oNwart oNfrog oNbump oNlog iNE

শেষ আয়াত .োকান।

N
$&$'¶TH

সমস্ত আয়াত গণনা।

O^$`

আয়াতগুলি সঠিক ক্রমে রাখুন।

.+
$&¶$&¶THW, tHW¶THE¶

প্রতিটি শ্লোকটি সম্পূর্ণ করুন এবং কোরাস যুক্ত করুন।

H
here's a 
E
W iNbottom of the sea
W
hole
N
n the 

কিছু স্থানধারক প্রসারিত করুন।



5

পিএইচপি, 180 178 বাইট

foreach([hole,log,bump,frog,wart,hair,fly,flea,smile]as$w)echo$a=T.($b="here's a ").($s="$w ".io[++$i>2]."n the $s").$c="bottom of the sea
",$a,T,$b.=hole,", t$b
T$b in the $c
";

এটি দিয়ে চালান -nrবা অনলাইনে চেষ্টা করুন

পিএইচপি 7.2 এ ফলনের সতর্কতা; সমাধানের জন্য, প্রায় কোট করা
অ্যারের উপাদান, io, holeএবং দুই স্বতন্ত্র T


4

সি (জিসিসি) , 334 328 307 299 বাইট

char*s="here's a \0smile 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\n";i;k=105;a[]={0,1,1,1,1,0,1,2,2};main(j){for(;i<9;k-=11+a[i++])do{printf("T%s%s",s,s+k);}while(j++&1||!printf("T%shole, t%shole\nT%s%s\n",s,s,s,s+105));}

এটি অনলাইন চেষ্টা করুন!





4

ব্যাচ, 267 বাইট

@echo off
set r=i
set t= There's a hole
set s=bottom of the sea
for %%w in (hole log bump frog wart hair fly flea smile)do call:c %%w
exit/b
:c
set s=%1 %r%n the %s%
echo%t:~,11%%s%
echo%t:~,11%%s%
echo%t%,%t:T=t%
echo%t%%s:~-25%
echo(
if %1==log set r=o

tকোরাসটিতে পুনরাবৃত্তি করা একটি স্ট্রিং sরয়েছে , এতে বেশিরভাগ শ্লোক রেখা রয়েছে, এবং এর rমধ্যে in theএবং এর মধ্যে নির্বাচন করা হয় on the। আয়াত কেবল প্রথম 11 অক্ষর tপ্রয়োজন হয়, যখন প্রথম ধুয়া লাইন দ্বিতীয় কপি tতার হয়েছে Tlowercased এবং দ্বিতীয় ধুয়া লাইন শেষ 25 অক্ষর reuses s



4

হাস্কেল , 243 215 বাইট

নিম থেকে দুর্দান্ত সহায়তায় 215 বাইটে হ্রাস পেয়েছে

c[[l n,l n,'T'#h++", "++'t'#h,l 8,""]|n<-[8,7..0]]
t#u=t:"here's a "++u
h="hole"
c=concat
l n='T'#c(drop n$map(++" on the ")(words"smile flea fly hair wart frog bump")++["log in the ",h," in the bottom of the sea"])

এটি অনলাইন চেষ্টা করুন!

(পুরাতন 243 বাইট সংস্করণটি এখানে রয়েছে )।

বেশ সরল সমাধান।

-- main function producing a list of lines
v = concat [[
    l n,
    l n, -- second line of each verse equals to its first line
    'T' # h ++ ", " ++ 't' # h,
    l 8, -- last line of each verse is the same in all verses
    ""
  ] | n <- [8,7..0]]

-- a small helper to construct similar strings 
t # u = t : "here's a " ++ u

h = "hole"

-- construct a first line of n-th verse (with n = 8 is the first and n = 0 is the last one)
-- Every such line begins with a constant prefix followed by expanding list of nested entities
l n = 'T' # concat (
      drop n $
         map (++ " on the ") (words "smile flea fly hair wart frog bump")
         ++ ["log in the ", h, " in the bottom of the sea"]
    )

1
কিছু টিপস: ক) আপনি sকেবল একবার ব্যবহার করেন , যাতে আপনি এটি ইনলাইন করতে পারেন। খ) আপনি সবসময় শুরুতে যোগ এবং সংযোজন কিছু t, তাই আপনি এটি একটি (পোতা) ফাংশন করতে পারেন: t#u=t:"here's a "++u। গ) lসাথে ফাংশনে বড় তালিকা তৈরি map(++" on the ")(words"smile flea ..."করা সংক্ষিপ্ত। এছাড়াও: সেই তালিকায় সংযুক্ত সমস্ত কিছুকে নিজেই তালিকায় স্থানান্তর করুন। d) এখন 8নামার 0তালিকাগুলি নীচে থেকে নেমে চলেছে (একক সংখ্যা সংখ্যা!) ই) এখন ইনলাইনিংয়ে iকিছু বাইটও সংরক্ষণ করে। চ) আপনার মূল ফাংশনটির নামকরণের দরকার নেই। আমাদের মেটা অনুসারে, হাস্কেল মানগুলি যথাযথ ফাংশন হিসাবে বিবেচিত হয়, তাই এটিকে ছেড়ে দিন v=
নিমি


1
আরেকটি 3 বাইট সংরক্ষণ করতে: তালিকা ধী পরিবর্তে আপনি ব্যবহার করতে পারেন >>=তালিকা একসংখ্যা এবং ইনলাইন থেকে (concatMap) concatফাংশনে lএটি অনলাইন চেষ্টা করুন!
নিমি

3

জাভাস্ক্রিপ্ট (বাবেল নোড) , 239 বাইট

অলিভার থেকে -7 বাইট *.*

(x=0,r='hole0log0bump0frog0wart0hair0fly0flea0smile'.split`0`).map(a=>(t=(i="There's a ")+a+r.slice(0,x++).reverse().map((h,_)=>` ${"io"[_<x-2|0]}n the ${h}`).join``+(o=` in the bottom of the sea
`))+t+(`${k=i+"hole"}, ${k}
`)+k+o).join`
`

এটি অনলাইন চেষ্টা করুন!


1
Tপ্রতিটি শ্লোকের তৃতীয় লাইনে দ্বিতীয় সেকেন্ডটি ছোট হাতের হওয়া উচিত।
শেগি

3

পাইথন 3 , 213 206 198 193 বাইট

k='n the ';o=e='bottom of the sea\n';b="There's a ";h='hole'
for j in[h]+'log bump frog wart hair fly smile'.split():o=j+' '+'io'['g'in o]+k+o;print(b+o+b+o+b+h+', t'+b[1:]+h+'\n'+b+h+' i'+k+e)

এটি অনলাইন চেষ্টা করুন!


-15 বাইটস
@ স্যারা -5 বাইট ধন্যবাদ কেবলমাত্র ASCII- এর জন্য ধন্যবাদ

সম্ভবত কিছুটা গল্ফযোগ্য, তবে বেশি নয়।



@ সরজ ধন্যবাদ আমি (স্পষ্টত ভুল) ছাপের অধীনে ছিলাম যা o=e=উভয়কেই তৈরি করে oএবং eএকই বস্তুকে বোঝায়। আমি ভেবেছিলাম বিভক্তি আরও দীর্ঘ হবে।
আর্টেমিস ফাউল

@ArtemisFowl oএবং e না একই বস্তুর পড়ুন ... এটা ঠিক যে স্ট্রিং পাইথন মধ্যে অপরিবর্তনীয় হয় তাই ভালো জিনিস +=একটি নতুন অনুলিপি তৈরি করবে পরিবর্তে বিদ্যমান mutating
হওয়া ASCII শুধুমাত্র


@ হওয়া ASCII শুধুমাত্র আমি জানি, কিন্তু আমার মনে হয়েছে যে পাইথন একরকম তৈরি নিশ্চিত যে তাদেরকে অব্যাহত একই বস্তুর পড়ুন।
আর্টেমিস ফাউল


2

সিকেন্টস , 238 219 বাইট

|@
#36::"T"~c1)~j\rbk));@ )~c2,Z,"T"~c1)~"hole, t"~c1)~"hole","T"~c1)~c2)~@

::"","log in the","bump"~c3,"frog"~c3,"wart"~c3,"hair"~c3,"fly"~c3,"flea"~c3,"smile"~c3
:"here's a ","hole in the bottom of the sea"," on the"

এটি অনলাইন চেষ্টা করুন!

এই চ্যালেঞ্জটি আমাকে শেষ পর্যন্ত আমার ভাষায় তালিকা এবং স্ট্রিংগুলি বাস্তবায়িত করে। এই ভাষাটি পূর্ণসংখ্যার সিকোয়েন্সগুলির জন্য নির্মিত, সুতরাং এটি বেশ ভাল করেছে!

ব্যাখ্যা

:"here's a ","hole in the bottom of the sea"," on the"

    helper line: c1), c2), and c3) access the three terms in this list

::"","log in the","bump"~c3,"frog"~c3,"wart"~c3,"hair"~c3,"fly"~c3,"flea"~c3,"smile"~c3

    helper line: yields a list containing the first n terms in it, accessed with bx)
    for example, the first three terms are:

"","log in the","bump"~c3

    so b3) would yield ["","log in the","bump on the"] (~ is concatenation and c3 is " on the")


|@
#36::"T"~c1)~j\rbk));@ )~c2,Z,"T"~c1)~"hole, t"~c1)~"hole","T"~c1)~c2)~@


|@
                              join sequence on literal newline
#36::                         output first 36 terms in sequence joined together
                              following are the 4 terms in the sequence, which will cycle through 9 times (for a total of 36 terms)
"T"~c1)~j\rbk));@ )~c2,       first term
"T"~c1)~                      "T" concat "here's a " concat
        j\rbk));@ )           the first k terms of b, reversed, and joined on " "
                   ~c2,       concat "hole in the bottom of the sea"
Z,                            second term - same as previous
"T"~c1)~"hole, t"~c1)~"hole", third term
"T"~c1)~                      "T" concat "here's a " concat
        "hole, t"~c1)~"hole", "hole, t" concat "here's a " concat "hole"
"T"~c1)~c2)~@
                              fourth term - "T" concat "here's a " concat "hole on the bottom of the sea" concat newline

2

পার্ল 5 , 194 বাইট

@ এএসসিআইআই-কেবলমাত্র আক্ষরিক নিউলাইনগুলি এবং \lআমি ভুলে গিয়েছিলাম এমন একটি কৌশল সহ 6 বাইট বন্ধ করে দিয়েছি

$"=" on the ";say+($b=($e="There's a ").hole,$c=" in the bottom of the sea",$/)x2,$.="$b, \l$b
$b$c
";say"$e@a[-$_..-1] in the hole$c
"x2,$.for 1..(@a=qw/smile flea fly hair wart frog bump log/)

এটি অনলাইন চেষ্টা করুন!



হা. চমৎকার কাজ. আমার অবশ্যই নতুন লাইনের কথা মনে রাখা উচিত ছিল। আমি \lআগে দেখেছি , তবে এটি ব্যবহার করার কারণ ছিল না, তাই এটি কখনই ভাবেনি।
এক্সকালি




2

কাঠকয়লা , 115 106 বাইট

≔There's a holeθEE⁹⁺…θχ⪫⮌…⪪”↶±∧⟲!↶⁼,(_⎇RB↧ω⪪zθⅉQθ`✳&⬤⸿◧σ⁻y▷»ΣK▶↙⁻υX`SξQ6 /ι⁹Wq”x⁺²ιn the ⟦ιι⁺⁺θ, ↧θ⁺θ✂ι±²⁵

এটি অনলাইন চেষ্টা করুন! লিঙ্কটি কোডটির ভার্জোজ সংস্করণ। সম্পাদনা: কোরাসটির শেষ লাইনের জন্য আমার ব্যাচ কোডটি অনুলিপি করে 9 বাইট সংরক্ষণ করা হয়েছে। ব্যাখ্যা:

≔There's a holeθ

স্ট্রিংটি সংরক্ষণ করুন There's a hole, যা দ্বিগুণ হিসাবে ব্যবহৃত হয়, তৃতীয়বার নিম্নের ক্ষেত্রে এবং চতুর্থবারের মতো তবে কেবল প্রথম 10 অক্ষর।

⪪”↶±∧⟲!↶⁼,(_⎇RB↧ω⪪zθⅉQθ`✳&⬤⸿◧σ⁻y▷»ΣK▶↙⁻υX`SξQ6 /ι⁹Wq”x

এর bottom of the seaxhole ixlog ixbump oxfrog oxwart oxhair oxfly oxflea oxsmile oউপর স্ট্রিং বিভক্ত করুন x

E⁹⁺…θχ⪫⮌…...⁺²ιn the 

9 টি পদক্ষেপের উপর লুপ i+2করুন, অ্যারের প্রথম উপাদানগুলি গ্রহণ করা , তাদের বিপরীত করা, তাদের সাথে যোগদান করা n the, এবং ফলাফলটির উপসর্গ There's aরেখে।

E...⟦ιι⁺⁺θ, ↧θ⁺θ✂ι±²⁵

লাইনটি সদৃশ করে এবং কোরাসটি তৈরি করে প্রতিটি লাইনকে একটি শ্লোকে বিস্তৃত করুন। আয়াতটির প্রতিটি লাইন তারপরে প্রতিটি নিজস্ব লাইনে স্পষ্টভাবে মুদ্রিত হয় এবং প্রতিটি আয়াত সুস্পষ্টভাবে ফাঁকা রেখার দ্বারা পৃথক করা হয়।


2

ভি , 184 170 বাইট

4iThere's a hole in the bottom of the sea
kky5w5eá,lpD5brtHj4yyGp4w8ion the 2briilog 3bibump 3bifrog 3biwart 3bihair 3bifly 3biflea 3bismile 7ñ4yykp4wd3wñ8ñÄ5jñ

এটি অনলাইন চেষ্টা করুন!

ব্যাখ্যা:

  • 4iThere's a hole in the bottom of the sea<\n><esc> "সমুদ্রের নীচে একটি গর্ত" থেরেসকে 4 বার .োকান।
  • kk তৃতীয় লাইনে যান
  • y5w "একটি গর্ত আছে" অনুলিপি করুন
  • 5eá, "এখানে একটি গর্ত আছে" এর পরে কমা প্রবেশ করুন
  • lp কমা পরে পেস্ট করুন
  • D বাকি রেখাটি মুছুন
  • 5brt লোয়ারকেস দ্বিতীয় টি
  • Hj4yy দ্বিতীয় লাইন থেকে 4 লাইন অনুলিপি করুন
  • Gp প্রথম লাইনের পরে সবকিছু আটকান
  • 4w8ion the <esc>(প্রথম আয়াতের শেষে) দ্বিতীয় আয়াতে প্রথম "গর্ত" এ যান এবং "বার" onোকান
  • 2briilog <esc> সর্বশেষ "অন" এ পিছনে সরে যান, ওকে একটি আই দিয়ে প্রতিস্থাপন করুন এবং তারপরে "লগ" সন্নিবেশ করুন
  • 3bibump <esc>3bifrog <esc>3biwart <esc>3bihair <esc>3bifly <esc>3biflea <esc>3bismile <esc> "" উপর "প্রত্যেকের মধ্যে যথাযথ শব্দ সন্নিবেশ করে রেখার মধ্য দিয়ে পিছনে সরে যান
  • 7ñ4yykp4wd3wñ4yykp4wd3w7 বার চালানো
    • 4yykp এই এক আগে শ্লোক নকল
    • 4wd3w "সেখানে একটি গর্ত আছে" এর পরে প্রথম শব্দের দিকে যান এবং 3 টি শব্দ মুছুন
  • 8ñÄ5jñ প্রথমটির পরে প্রতিটি শ্লোকের প্রথম লাইনটি নকল করুন (এর মধ্যে 8 টি রয়েছে)

2

/// , 216 বাইট

/V/\/\///U/\/ VS/TCVR/iBVQUtheVPUoBVOUholeVN/RASVM/ASO, tCO
SA
VL/RMSVKUlog VJUbumpPKVIUfrogPJVHUwartPIVGUhairPHVFUflyPGVEUfleaPFVDUsmilePEVC/here's aVB/nQVA/O R bottom ofQ sea
/SASMSKNKLJNJLINILHNHLGNGLFNFLENELDNDRM

এটি অনলাইন চেষ্টা করুন!

এই ধরণের টাস্কটি একমাত্র এবং একমাত্র জিনিস যা /// এ যুক্তিসঙ্গতভাবে ভাল। : ডি আরে, ফলাফলটি সি, সি # বা জাভার চেয়ে ছোট!

এই প্রোগ্রামটি থেকে আউটপুট দুটি শেষ লাইন বিরতিতে শেষ হয় ; আশা করি এটি কোনও চুক্তিভঙ্গকারী নয়

যাইহোক, এখানে কোন আসল চতুরতা নেই। আমি কেবল পুনরাবৃত্ত স্ট্রিংগুলি সনাক্ত করেছি এবং তাদের জন্য একটি-চরিত্রের শর্টকাট সংজ্ঞায়িত করেছি এবং যতক্ষণ না আমি আর কোনও পুনরাবৃত্ত স্ট্রিং না দেখি পুনরাবৃত্তি করি। আমি এটি কম-বেশি নিরীহ এবং লোভী ফ্যাশনে করেছি। তবে, আমি ইচ্ছাকৃতভাবে "... সমুদ্রের উপরের ফ্লাইয়ায় হাসি" এর শর্টকাটটি সংজ্ঞায়িত করেছি, তারপরে "সামুদ্রিক উড়ানের উপরে ..." সমুদ্রের শ্বাসনালী এবং আরও কিছুক্ষণ শর্টকাটের শৃঙ্খলা গঠনের জন্য । ফলাফলটি হ'ল নতুন বিশেষ্যগুলির পুরো ক্রমটি কোডে স্পষ্টভাবে দৃশ্যমান এবং আমি দেখতে বেশ আনন্দদায়ক। :)

ভি এবং ইউ প্রতিস্থাপনের পরে, আমাদের নিম্নলিখিত আরও পঠনযোগ্য কোড রয়েছে:

/S/TC//R/iB//Q/ the//P/ oB//O/ hole//N/RAS//M/ASO, tCO
SA
//L/RMS//K/ log //J/ bumpPK//I/ frogPJ//H/ wartPI//G/ hairPH//F/ flyPG//E/ fleaPF//D/ smilePE//C/here's a//B/nQ//A/O R bottom ofQ sea
/SASMSKNKLJNJLINILHNHLGNGLFNFLENELDNDRM

2

ল্যাটেক্স, 265 268 টি অক্ষর

\documentclass{book}\input{pgffor}\def\i{bottom of the sea}\let~\i\def\b{here's a }\def\h{hole}\def\s#1{ in}\begin{document}\foreach\x in{\h\s,log\s,bump,frog,wart,hair,fly,flea,smile}{\xdef~{\x{ on} the ~}T\b~\\T\b~\\T\b\h, t\b\h\\T\b\h\,in the \i\par}\enddocument

অনুচ্ছেদে ইনডেন্টেশন এবং সমস্ত কিছু সহ একটি দুর্দান্ত পিডিএফ সংকলন করে।

অবহেলিত এবং মন্তব্য করেছেন:

\documentclass{book}
\input{pgffor}
\def\i{bottom of the sea}   %for re-use in the last two verses 
\let~\i                     %here I keep attaching words
\def\b{here's a }               
\def\h{hole}
\def\s#1{ in}               %this replaces the next token with "in", useful for log and hole where "in" is used instead of"on"
\begin{document}
\foreach\x in{\h\s,log\s,bump,frog,wart,hair,fly,flea,smile}{
    \xdef~{\x{ on} the ~}   %keep attaching words and on/on to ~
    T\b~\\                  %verse 1
    T\b~\\                  %verse 2
    T\b\h, t\b\h\\          %verse 3
    T\b\h\,in the \i\par    %verse 4
}
\enddocument

আউটপুট:

এখানে চিত্র বর্ণনা লিখুন


2

সি # (ভিজ্যুয়াল সি # ইন্টারেক্টিভ সংকলক) , 220 বাইট

string b="There's a ",d="hole in the bottom of the sea\n",e,f;" log bump frog wart hair fly flea smile".Split().Any(s=>Write((e=b+(f=s!=""?s+(f!=""?" o":" i")+"n the "+f:s)+d)+e+b+$@"hole, there's a hole
{b+d}
")is int);

এটি অনলাইন চেষ্টা করুন!

-৫ বাইটস @ এএসসিআইআইইলিকে ধন্যবাদ এবং -২ বাইট ধন্যবাদ @ সোমোনকে!

আমার একটি ছোট বাচ্চা আছে এবং আপনাকে আশ্বস্ত করতে পারি এই গানটি সমান অংশ আকর্ষণীয় এবং বিরক্তিকর।


1
আমি তোমাদের স্মরণ করিয়ে করার জন্য দুঃখিত যে উপস্থিত আছি, হে)
সোক

.Any()-> !=""?
ASCII- কেবল


এবং আপনি পরে জায়গা প্রয়োজন হবে না inযে foreach>: _>
হওয়া ASCII শুধুমাত্র

@ এএসসিআইওলি - টিপসের জন্য ধন্যবাদ :)
দানা
আমাদের সাইট ব্যবহার করে, আপনি স্বীকার করেছেন যে আপনি আমাদের কুকি নীতি এবং গোপনীয়তা নীতিটি পড়েছেন এবং বুঝতে পেরেছেন ।
Licensed under cc by-sa 3.0 with attribution required.