prokls / turingmachine.js

A turingmachine for educational purposes (HTML5-webapp)
4 stars 1 forks source link

Initial state is already undefined #1

Open prokls opened 10 years ago

prokls commented 10 years ago

If you import the following program, it is immediately identified as undefined.

{"program":[["a","Start",["a","Right","Z1"]],["a","Z1",["a","Stop","NoAba"]],["a","Z2",["a","Right","Z3"]],["a","Z3",["a","Stop","NoAba"]],["a","NoAba",["a","Stop","NoAba"]],["b","Start",["b","Stop","NoAba"]],["b","Z1",["b","Right","Z2"]],["b","Z2",["b","Stop","NoAba"]],["b","Z3",["b","Stop","NoAba"]],["b","NoAba",["b","Stop","NoAba"]],[" ","Start",[" ","Right","Start"]],[" ","Z1",[" ","Stop","NoAba"]],[" ","Z2",[" ","Stop","NoAba"]],[" ","Z3",[" ","Stop","IsAba"]],[" ","IsAba",[" ","Stop","IsAba"]],[" "," ",[" ","Stop",""]]],"tape":{"default_value":"0","offset":47,"cursor":0,"data":["0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"," "," "," ","a","b","c"," "," "," ","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"],"history":[[["LEFT",3],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["LEFT",3],["LEFT",3],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["LEFT",3],["LEFT",3],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["LEFT",3],["LEFT",3],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["LEFT",3],["LEFT",11],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["LEFT",12],["LEFT",23],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["LEFT",24],["LEFT",47],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["LEFT",48]]],"history_size":null,"halted":false},"final_states":["IsAba","NoAba"],"initial_state":"Start","initial_tape":{"data":["1"],"cursor":-1,"default_value":"0"},"inf_loop_check":100,"state_history":["Start"],"name":"machine 6149","step":0}

Reported by Thorsten via skype

prokls commented 10 years ago

For this program, the following app.toJSON dump was provided:

{"program":[["a","Start",["a","Right","Z1"]],["a","Z1",["a","Stop","NoAba"]],["a","Z2",["a","Right","Z3"]],["a","Z3",["a","Stop","NoAba"]],["a","NoAba",["a","Stop","NoAba"]],["b","Start",["b","Stop","NoAba"]],["b","Z1",["b","Right","Z2"]],["b","Z2",["b","Stop","NoAba"]],["b","Z3",["b","Stop","NoAba"]],["b","NoAba",["b","Stop","NoAba"]],[" ","Start",[" ","Right","Start"]],[" ","Z1",[" ","Stop","NoAba"]],[" ","Z2",[" ","Stop","NoAba"]],[" ","Z3",[" ","Stop","IsAba"]],[" ","IsAba",[" ","Stop","IsAba"]],[" "," ",[" ","Stop",""]]],"tape":{"default_value":"0","offset":3,"cursor":0,"data":["0","0","0"," "," "," ","a","b","c"," "," "," "],"history":[[["LEFT",3],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["LEFT",3],["LEFT",3],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["LEFT",3],["LEFT",3],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["LEFT",3],["LEFT",3],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["LEFT",3],["LEFT",3],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["RIGHT",1],["LEFT",3]]],"history_size":null,"halted":false},"final_states":["IsAba","NoAba"],"initial_state":"Start","initial_tape":{"data":["1"],"cursor":-1,"default_value":"0"},"inf_loop_check":100,"state_history":["Start"],"name":"machine 6149","step":0}
prokls commented 10 years ago

Furthermore the tape input for "Set tape content" is broken.