New answers tagged

1

Pyth, 142 bytesSBCS Like many of the other answers, and my Python answer, encodes the lengths of the 474 Morse codewords into 119 bytes using base 4. Shares many similarities with my Pyth + Jelly's dictionary answer. My primary reason for posting this answer is to show that in Pyth, apparently the 474-codeword-lengths method does not beat the 115-Jelly-...


1

Pyth + Jelly's dictionary, 135 134 131 130 (127🐌) bytesSBCS Kcwd=bmsm@KxGkdTVjC"êêVÞøA?cUqg´§¼F¦e~zEºÊú[!Áw¶uQå´çý½Ê*¤jrkIæwÐó*S.(4áëÌöÅ×¹ñp.ÑQÐgBê "51=>zl@bJ@smxdb_._<z24Np@TJ (contains C1 control characters, forbidden by HTML5, thus the above can't be copied to clipboard and is for illustration purposes only) Try it online! - 130 byte version, ...


7

APL (Dyalog) + dfns + Jelly's dictionary, 181 175 (172🐌) bytesSBCS Full program. Requires ⎕IO←0 and ⎕AV redefinition. Doesn't use the challenge's Morse code library. M←∊∘morse¨D⋄C←∊(7⍴51)⊤246⊥5 17⍴¯7+⎕AV⍳'k%aÏ⍵FþfÅ⍵ìÆ⌶á≥å3¶cÒ⍺\ujü─⍳%S⊣ì⍙ÒÛÙ3Ùp`Ø,hÇñ⊂┴Ö⍪l∪⍒i1⍵Í:-îà⌽ì≥3€ã(⍝S]ÁGXræ∇O7Uæî' C↓⍨←≢i↓⍨←≢M⊃⍨w←(⊃C)⌷∊(⍸M⍷⍨⊂)¨⌽,\24↑i ⍞←819⌶w⊃D →2 Try it online! - ...


2

Python 3 Caddy, interprets BrainF*** Score: \$\frac{38}{224}\approx0.17\$ (with newlines removed) Program E from textwrap import wrap x = input('Code: ') i = ['<', '>', '+', '-', '[', ']', '.', ','] o = '' for c in x: if c in i: o += str(i.index(c) + 1) if o: d = wrap(o, 6) d = [int(x) for x in d] o = '' for c in d: ...


2

Python 3, 265 261 259 bytes Uses the same base-256-in-a-string data-encoding method as my other Python answer, but actually uses the Morse code input. Like many of the other answers, encodes the lengths of the 474 Morse codewords into 119 bytes using base 4. The Morse stage of the decoding is based on steviestickman's answer, with some further golfing. ...


1

Python 3, 381 375 372 bytes Just like Seb's answer and ScoopGracie's answer, gracefully takes the Morse code representation and any of the three libraries as input, blithely ignores them and gives you the output. Takes Seb's strategy a step further, encoding the text in base 26 in an integer encoded in base 256 in a string (as opposed to Seb's which ...


1

Python 3, 452 bytes lambda a,b:''.join([chr(96+int(''.join([f'{ord(c):07b}'for c in'''ezVswP,A8BpeH A82d DY po4ZqVH Dw,A8AMa+!ezd(a1J+/NCkuN"Rq'L JRdQd)>2I)8BK 3!2ssIY>Rl,S...


3

05AB1E, 149 131 129 bytes •Nα0Ω¤èGë™jƒć› Ù¾₂¶É¨=Yàf§ì[ðEÎλ`÷¡2Ä|~āΔí¹–4₂≠āó3Tv₁‰[Öò‚S»‰CþEηFA‡γ÷¯¿Þ₃âÖ.³εûV^ÕÜ₄Ú¹þ‘ΘVÅÍÅΘΛ9m|\Ó8g8ì&ÓiUΩÎQ:ǺZÎgöæ•4в>£I#A‡ -18 bytes thanks to @Deadcode. -2 bytes thanks to @Grimmy. Uses the complete morse-string as first input, and the lookup format as second input. Try it online. (Outputs as a list of characters, ...


3

MATLAB R2016a, 290 285 277 266 245 223 219 bytes (99+119+1) function r(m,d);[a,b]=ismember(mat2cell(m,1,fread(fopen('j'),474,'bit2')+3),strsplit(d));char(b+96) The inputs are the Morse code sequence m and the dictionary d in the third format. The function uses a 119-byte file j available here that contains the lengths of the 474 Morse codewords. According ...


2

JavaScript (Node.js),  270  269 bytes Takes input as (string)(lookup), where lookup is in the 3rd format. s=>t=>(B=Buffer)("SNB6>B5>V]@a5U)McAQ>@a/;3bRD7;2?R:1P_Sb7K@22MHO5V?O:AWZPATRV4A/VBW[0K:1PJ`Q?Fg=-ZD46TRRgC=]:1P-ZLYRgN<Z@9?H^RfCdRQPC6BTR1U;6>64UZ0MHc`=ZTSH2.cHRg4JQP<*VfRB]1b").map(n=>[0,2,4].map(i=>o+=B([97+t....


3

Perl 5, 283 244 bytes $s=<>;$s=~s/..{$_}//+print$s=~/(.) \Q$& / for map{vec unpack('u',q{MJZDYEM98;HWE31N4>Y9:6'Y,BZYRSZ1<JI2@]ZH_(Z8H)7@V[G5*V2NC&:NZM3':XVCLCHY2@(IY>WE\5,L<XK*K^6U5+"5K(9*S^)B5CT07:JK_Q:HINCL:J=23LYEL.T,E*".U[)[`HJQ@ZJ/R.F*"6XOJK5B0X`}),$_,2}0..473 Try it online! This corresponds to: $L = <<''; ...


5

Python, 487 bytes lambda a,b:'...


Top 50 recent answers are included