Created
February 27, 2018 19:13
-
-
Save arifsuhan/52c547336198a198b35ea605889790e6 to your computer and use it in GitHub Desktop.
BrainF*ck
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
def loopRunner(loop,endChar): | |
s="" | |
for i in loop: | |
s+=">" | |
for j in range(0,i): | |
s+="+" | |
s+=endChar+"\n" | |
return s | |
def backToHead(stack): | |
s="" | |
for i in range(0,len(stack)): | |
s+="<" | |
s+="-\n]\n" | |
return s | |
print("") | |
print("---------------------------") | |
print("Print any Text in BrainF*ck") | |
print("---------------------------") | |
print("Type text and Get the Code") | |
text=input(":") | |
loop="++++++++++\n[\n" | |
innerLoop=[] | |
outerLoop=[] | |
for i in text: | |
innerLoop.append(int(ord(i)/10)) | |
outerLoop.append(ord(i)%10) | |
fullCode="" | |
fullCode=loop+loopRunner(innerLoop,"")+backToHead(innerLoop)+loopRunner(outerLoop,".") | |
file=open("a.txt","w") | |
print(fullCode) | |
file.write(fullCode) | |
file.close() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment