Skip to content

Instantly share code, notes, and snippets.

@Bruntaz
Bruntaz / BrainfuckInterpreter.py
Created November 13, 2016 18:16
A first pass at a brainfuck implementation written in Python. It could easily be made more efficient (by removing unnecessary characters before executing etc.) but the code is pretty clean.
def executeBrainfuck(brainfuckCode):
valueList = [0]
listPointer = 0
programCounter = 0
programStack = []
while programCounter < len(brainfuckCode):
instruction = brainfuckCode[programCounter]
if instruction == ">": # Increment pointer