HALP.

Last edited on
-What is a Turing machine?
-What is your question?
-What does "perform a program mean"?
-"Machine gets filename as a parameter" Parameter for what?
Last edited on
You need to make a start on this task and then we can help with the specifics,

see "Informal description" in the wiki page. this will give you the basics of what you need. read the wiki page and try to create some c++ types that suit the data you need to store. this will make you think about the problem in a bit more detail.

2. reading the program file.
You can either read one line at a time and process it before moving on to the next, or read the lot and store it. this step is straight forward and a quick search of these forums will show you many examples from previous similar questions. I suggest you store as a std::vector<> of std::tuple<> so your terminology matches internet reference material (less headache)

3. process an instruction
Pick a single instruction, and try to code a function to perform its action. this will be the most difficult part for you as you are coding the "microcode" of the turing "cpu", this is where you will need to implement a state machine, there are also many examples of a state machine on this site.

@hoogo, read this, every single programmer in the universe should know what a turing machine is :) https://en.wikipedia.org/wiki/Turing_machine

@hoogo, read this, every single programmer in the universe should know what a turing machine is :)

Damn thanks, gee I feel stupid, I couldn't find anything with a google search at first...
Last edited on
Guys plz help with the program we have strict deadlines here.
Nobody here will do your homework for you. People are more than happy to help but on the basis of what you've already tried to do or accomplished. You haven't shown us any code that you've produced so far. I suggest you try that :)
how does a guy with 1 post ask for help on someone else's topic? That was weird.
@jonnin
I think it might me OP's classmate or the person he's supposed to work on this task with
Topic archived. No new replies allowed.