Created
September 2, 2022 22:23
-
-
Save qexat/abc1a1d6a10a01245a022f31fdb6ea1a to your computer and use it in GitHub Desktop.
One-liner hello world program written in Brainfuck but in a Python f-string
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
f'{(hw:="++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>.")}{(bf:=lambda prgm:print(((pc:=0),(ti:=0),(t:=[0]*30000),(rs:=[]),(o:=""),(*(((char:=prgm[pc]),(((ti:=ti+1),(pc:=pc+1))if char==">"else(((ti:=ti-1),(pc:=pc+1))if char=="<"else(((t.__setitem__(ti,(t[ti]+1)&0xFF)),(pc:=pc+1))if char=="+"else(((t.__setitem__(ti,(t[ti]-1)&0xFF)),(pc:=pc+1))if char=="-"else(((o:=o+chr(t[ti])),(pc:=pc+1))if char=="."else(((t.__setitem__(ti,ord(input())%0xFF)),(pc:=pc+1))if char==","else(((rs.append(pc),(pc:=pc+1))if t[ti]!=0 else((bc:=1),(*(((pc:=pc+1),((bc:=bc+1)if prgm[pc]=="["else(bc:=bc-1)if prgm[pc]=="]"else...),(pc:=pc+1))for _ in iter(lambda:bool(bc),False)),)))if char=="["else((pc:=rs.pop())if char=="]"else...)))))))))for _ in iter(lambda:pc<len(prgm),False)),))[-1][-1][-1][0]))}{(bf(hw))}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment