TuringMachine simulation in C++