Created
December 30, 2023 22:40
-
-
Save Chubek/2cdacf1124b5d419f2c8ff137df1bbbd to your computer and use it in GitHub Desktop.
EchoFuck by ChatGPT (faulty)
This file contains 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 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