a simulation of the turing machine in lua
there are some slight variations from the theoretical model and that mainly consists with the the way it halts and movement. these are listed below.
if recalled correctly, the theoretical model has 2 ways of halting, the first way is through explicit states (such as q_accept or a q_reject) or through natural halting, where a transition isn't described. this follows mostly that, but also checks for a defined transition, where the transition state is the current state, and the symbol is not being overwritten, in which case it would halt instead of infinitely loop.
the machine also allows for no movement during a transition, which again if i recall correctly is not explicitly mentioned as being allowed in the original turing machine model - but seems to be common place to allow no movement in many accepted variations after by others (i think?)
purely for educational purposes (my a levels + further)
run with:
lua src/main.lua
and follow the on screen instructions
any lua version > 5 should be fine
or if you want the turing_machine itself for use in a program of sorts, you can just do require(src.turing-machine) to access its methods.
Licensed under MIT