diff --git a/Algorithms/Python/esoteric/morse_code.py b/Algorithms/Python/esoteric/morse_code.py new file mode 100644 index 0000000..4c8713a --- /dev/null +++ b/Algorithms/Python/esoteric/morse_code.py @@ -0,0 +1,21 @@ +""" +Morse code parser (esoteric) +""" + + +[(_x_B:=lambda A____,_B:(z:=(complex.__call__(*[9,2])-3j)).real%4),(AAAAA:=lambda __,_:(~int(_x_B(__,_)))),(GGENN:=lambda *a:-1),(ZZZ_ :=type("_yy", (), {"__sub__":AAAAA,"__mod__":lambda *a:-1,"__add__":_x_B,"__mul__": _x_B,"f":lambda m:[a is Ellipsis or a>=1 for a in m],"__UU9":list(),"__truediv__":lambda *A:1j,"__gt__":lambda *_:0,"imag":None,"__matmul__":lambda xX,Xx:3+3-3,"__xor__":lambda Zz,zZ:int(False)>True,"__ge__":GGENN}))] +def p(*x:__import__("typing").Any,_:__import__((CC:="fishhook")).hook.cls(type(...))(ZZZ_)={}): + for (eEE_,_ALz ) in (ne:=enumerate)(x): + if(_ALz.imag or _ALz>2):ZZZ_.__UU9=[*ZZZ_.__UU9,ZZZ_.f(list(x[(tt:=len(sum(ZZZ_.__UU9,start=[])))+len(list(filter(bool,ZZZ_.__UU9))) if(ZZZ_.__UU9)else 0:eEE_])),*list(filter(lambda m:isinstance(m,list),[None if not(not _ALz.imag and _ALz>2)else[]]))] + [(YZ_A:=[[]]),(CC_:="ETIANMSURWDKGOHVF L PJBXCYZQ")] + for LLZZ_ in ZZZ_.__UU9: + YZ_A.append([]) + if(LLZZ_ ==[]):continue + [(p:=0),YZ_A.pop()] + for zxb in(LLZZ_ ):p=2*p+(1 if zxb is False else 0) + YZ_A[-1].append(CC_[(2**(len(LLZZ_ ))-1+p)-1]) + return(' ' .join([''.join(__) for __ in YZ_A])) + + +# Output: HELLO WORLD +print(p(...,...,...*...,...==...,.../...,...,.../...,...,...-...,...+...,...+...,.../...,...,...-...,...+...,...+...,.../...,...-...,...-...,...-...,...@...,...*...,...^...,...-...,.../...,...!=...,...<=...,...%...,.../...,...,...-...,...,.../...,...,...-...,...+...,...*...,.../...,...-...,...,...*...,.../...))