Skip to content

Instantly share code, notes, and snippets.

@Chubek
Created December 30, 2023 22:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Chubek/2cdacf1124b5d419f2c8ff137df1bbbd to your computer and use it in GitHub Desktop.
Save Chubek/2cdacf1124b5d419f2c8ff137df1bbbd to your computer and use it in GitHub Desktop.
EchoFuck by ChatGPT (faulty)
def text_to_echo_brainfuck(text):
brainfuck_code = ""
# Brainfuck initialization
brainfuck_code += "[-]>[-<+>]<"
# Loop through each character in the input text
for char in text:
# Convert the character to its ASCII value
ascii_value = ord(char)
# Add the ASCII value to the current cell
brainfuck_code += "+" * ascii_value
# Move to the next cell
brainfuck_code += ">"
# Move back to the first cell
brainfuck_code += "<"
# Loop through each cell and print its value as a character
brainfuck_code += "[.>]"
return brainfuck_code
import sys
def main():
# Get input text from the user
input_text = sys.stdin.read()
# Convert the input text to Brainfuck code
brainfuck_code = text_to_echo_brainfuck(input_text)
# Print the generated Brainfuck code
print("Generated Brainfuck code:")
print(brainfuck_code)
if __name__ == "__main__":
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment