Back to General discussions forum
I actually asked about it earlier but nobody answer it so...
Hello, I'm trying to write this BF interpreter, but probably I can't see something. Everytime when I'm testing my interpreter it returns 3 numbers, not as many as it's expected. So I've counted those '<' and '>' marks in test data to check if pointer can be bigger than 2 and I see that is impossible. This function helped me to count marks and max data pointer:
def checkPointerMovers():
data = input()
[left, right] = [0,0]
max_pointer = 0
for mark in data:
if mark == '<':
left += 1
elif mark == '>':
right += 1
if right - left > max_pointer:
max_pointer = right - left
print(left,right, max_pointer)
Except that I'm missing something what is increasing data pointer too. Could anybody help, please?
I'm not very familiar with python, but your code seems to generate correct answer except that it's not separeted with spaces. I.e for answer: 12 17 1 28 3 13 0 21 21 9 0 9 your code output is: 1217128313021219090 9 24
For loop checks each char in input() and increasing left or right if current char is < or >. Nevermind, I got the problem. My interpreter forgets to print value everytime when it meets ':' and print only final values of all cells.
its no running, for example print("hola")
Hi Friend! Sorry, but I don't understand - what not running?