bf: fix order of operations

This commit is contained in:
Ryan Hitchman 2014-05-06 19:19:42 -07:00
parent 0a84f84e57
commit ab2a36260e
1 changed files with 2 additions and 2 deletions

View File

@ -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: