bf: fix order of operations
This commit is contained in:
parent
0a84f84e57
commit
ab2a36260e
|
@ -45,9 +45,9 @@ def bf(inp):
|
||||||
while ip < len(program):
|
while ip < len(program):
|
||||||
c = program[ip]
|
c = program[ip]
|
||||||
if c == '+':
|
if c == '+':
|
||||||
memory[mp] = memory[mp] + 1 % 256
|
memory[mp] = (memory[mp] + 1) % 256
|
||||||
elif c == '-':
|
elif c == '-':
|
||||||
memory[mp] = memory[mp] - 1 % 256
|
memory[mp] = (memory[mp] - 1) % 256
|
||||||
elif c == '>':
|
elif c == '>':
|
||||||
mp += 1
|
mp += 1
|
||||||
if mp > rightmost:
|
if mp > rightmost:
|
||||||
|
|
Loading…
Reference in New Issue