Blane187 commited on
Commit
4b1580c
Β·
verified Β·
1 Parent(s): 7fc9433
Files changed (1) hide show
  1. app.py +4 -1
app.py CHANGED
@@ -4,7 +4,10 @@ def text_to_brainfck(text):
4
  brainfuck_code = ""
5
  for char in text:
6
  ascii_value = ord(char)
7
- brainfuck_code += "+" * ascii_value + "."
 
 
 
8
  return brainfuck_code
9
 
10
  with gr.Blocks() as demo:
 
4
  brainfuck_code = ""
5
  for char in text:
6
  ascii_value = ord(char)
7
+ # Add '[' and ']' for loops
8
+ if ascii_value > 0:
9
+ brainfuck_code += "[" + "+" * ascii_value + "]"
10
+ brainfuck_code += "."
11
  return brainfuck_code
12
 
13
  with gr.Blocks() as demo: