Advertisement
Gottox

Untitled

May 23rd, 2012
43
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. ; Write your Turing machine program here!
  2. ; Syntax: <current state> <current symbol> <new symbol> <direction> <new state>
  3. ; ';' starts a comment.
  4. ; '*' is a wildcard: it matches any symbol/state when used in the current symbol/state field;
  5. ; it means 'same as current' when used in new symbol/new state field.
  6. ; '_' represents the blank (space) symbol.
  7. ; Symbols must be a single non-whitespace character except ';'.
  8. ; States can be any word, not only numbers.
  9. ;
  10. ; This example program concatenates the first string of '1's to the end of the second.
  11.  
  12. 0 * * * zstart
  13.  
  14. zstart 0 0 r z0
  15. zstart 1 1 r z1
  16. z0 0 0 * z0
  17. z0 1 1 * z0
  18. z0 _ _ l halt
  19. z1 0 0 r z1
  20. z1 1 1 r z1
  21. z1 _ _ l z2
  22.  
  23. z2 0 _ l z3
  24. z2 1 1 * z2
  25. z3 0 _ l zreset
  26. z3 1 1 * z3
  27.  
  28. zreset 0 0 l zreset
  29. zreset 1 1 l zreset
  30. zreset _ _ r halt
  31.  
  32. ; This is a hack to load an appropriate initial tape. $INITIAL_TAPE: 11110011111
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement