Implementation of the ant (turing machine) in python