QB / QB64 Discussion Forum      Other Subforums, Links and Downloads
 Return to Index  

Beat me to it you did

September 17 2005 at 4:17 PM
GreenMan  (no login)


Response to Whew! I think I have the program for the Turing Machine

>(Made use of the forum downtime yesterday)

I was working on it too. Too bad you and I are the only ones here who are able to appreciate the value of this important work.

I didn't get past about rule 9, and I already had a QB interpreter. You must have been implementing it somehow, but I can't imagine what it could be that would be better than QB for this (don't tell me you were doing it on paper). I'd offer you mine, but I figure you'll probably have your own working before I even finish typing this post anyway.

I hate your notation system, btw. I started trying to convert your rules to the system I use, but couldn't follow them. I don't know if we are using the same set of what I guess you'd call 'meta-rules' for a Turing machine; if I interpret your rules correctly, you are allowing moves of more than one bit position in a single move? (for example, your rule 9: "0+28" means: "if the bit on the tape is a zero, don't flip it (or maybe it's "output a 0"), move right 2 and switch to state 8". Is that right? I always thought that was cheating. IF not then... well, no wonder I was having so much trouble.

The way I do it is to make the rules a 2-D array of 3-char strings, with the first subscript representing the rule number, and the second subscript the value of the bit just read from the tape. The string values stored in each array location are: new state, output bit, and direction, repectively.

So:
---------------
rule(3,0)="20>"
rule(3,1)="30<"
---------------
means:

While in internal state "3":

If "0" is read from the tape, switch to state 2, output a "0" to the tape (not a change in this case) and move (ONE) to the right.

If "1" is read from the tape, stay in state "3", output a "0" and move (ONE) to the left.


 
 Respond to this message   
Responses