Browse Source

correct bug in brainfuck.py (in function 'interpret') and add full debug support

master
miggazElquez 2 years ago
parent
commit
61b4c2cc9c
  1. 11
      brainfuck.py

11
brainfuck.py

@ -61,7 +61,18 @@ def interpret(prog):
if ar[ptr]:
index = blocks.pop()
continue
else:
blocks.pop()
elif instr == '#':
try:
if prog[index+1] == '(':
index = index+2
while prog[index] != ')':
print(prog[index],end='',flush=True)
index += 1
print(' ',end='')
except IndexError:
pass
print(ar, ptr, ar[ptr])
index += 1

Loading…
Cancel
Save