Execute Brain****/Python: Difference between revisions

Content added Content deleted
No edit summary
No edit summary
Line 33: Line 33:
elif opcode == ',': tape[cell] = ord(sys.stdin.read(1))
elif opcode == ',': tape[cell] = ord(sys.stdin.read(1))
elif opcode == '.': sys.stdout.write(chr(tape[cell]))
elif opcode == '.': sys.stdout.write(chr(tape[cell]))
elif (opcode == '[' and tape[cell]) or \
elif (opcode == '[' and not tape[cell]) or \
(opcode == ']' and not tape[cell]): ptr = loop_ptrs[ptr]
(opcode == ']' and tape[cell]): ptr = loop_ptrs[ptr]
ptr += 1
ptr += 1