Turing machine implementation on c++