Skip to content

Commit

Permalink
feat(esoteric-python): Add morse code parser
Browse files Browse the repository at this point in the history
  • Loading branch information
CaedenPH committed Jan 8, 2024
1 parent a3df95f commit c30b578
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions Algorithms/Python/esoteric/morse_code.py
Original file line number Diff line number Diff line change
@@ -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(...,...,...*...,...==...,.../...,...,.../...,...,...-...,...+...,...+...,.../...,...,...-...,...+...,...+...,.../...,...-...,...-...,...-...,...@...,...*...,...^...,...-...,.../...,...!=...,...<=...,...%...,.../...,...,...-...,...,.../...,...,...-...,...+...,...*...,.../...,...-...,...,...*...,.../...))

0 comments on commit c30b578

Please sign in to comment.