#include #include #include "turing.cpp" #include "utils/operators.cpp" #include "utils/print.cpp" int main() { auto def = new Turing::Definition { .defaultState = '0', .defaultValue = '#', .instructions = { // Palindrome checker // if the last state is R or 0, then it is a palindrome // otherwise it is not "00a0r"_i, "01b1r"_i, "a0a0r"_i, "a1a1r"_i, "b0b0r"_i, "b1b1r"_i, "a#A#l"_i, "b#B#l"_i, "A0r#l"_i, "B1r#l"_i, "r0r0l"_i, "r1r1l"_i, "r#R#r"_i, "R00#r"_i, "R10#r"_i, }, }; auto turing = new Turing::Machine(def); turing->setTape("0010110100"_v); print(turing); int i = 0; while (i++ < 100) { if (!turing->tick()) break; print(turing); } print(turing); return 0; }