Implement a simple turing machine