Zeroji

[Turing] reverse binary word

May 16th, 2017
82
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // https://turingmachinesimulator.com/
  2.  
  3. //LOAD AN EXAMPLE TO TRY
  4. //then load an input and click play
  5.  
  6. //Syntax:
  7.  
  8. //-------CONFIGURATION
  9. name: Rev
  10. init: M1
  11. accept: E,AD,F
  12.  
  13. //-------DELTA FUNCTION:
  14. //[current_state],[read_symbol]
  15. //[new_state],[write_symbol],[>|<|-]
  16. M1,_
  17. E,_,-
  18. M1,0
  19. M2,0,>
  20. M1,1
  21. M2,1,>
  22. M2,_
  23. AD,_,-
  24. M2,0
  25. 0,0,<
  26. M2,1
  27. 0,1,<
  28. // start
  29. 0,0
  30. S0,_,>
  31. 0,1
  32. S1,_,>
  33. S0,0
  34. S0,0,>
  35. S0,1
  36. S1,0,>
  37. S1,1
  38. S1,1,>
  39. S1,0
  40. S0,1,>
  41. S0,_
  42. 11,0,>
  43. S1,_
  44. 11,1,>
  45. // shift
  46. 11,_
  47. 12,1,>
  48. 12,_
  49. 13,_,>
  50. 13,_
  51. 2,0,<
  52. // reverse
  53. 2,_
  54. 2,_,<
  55. 2,1
  56. 2C,_,<
  57. 2C,_
  58. 4B,0,>
  59. 2C,0
  60. 2B0,1,>
  61. 2C,1
  62. 2B1,1,>
  63. 2B0,_
  64. 2B0,_,>
  65. 2B0,0
  66. 2N0,0,>
  67. 2B0,1
  68. 2N0,1,>
  69. 2N0,0
  70. 2N0,0,>
  71. 2N0,1
  72. 2N0,1,>
  73. 2N0,_
  74. 2B,0,<
  75. 2B1,_
  76. 2B1,_,>
  77. 2B1,0
  78. 2N1,0,>
  79. 2B1,1
  80. 2N1,1,>
  81. 2N1,0
  82. 2N1,0,>
  83. 2N1,1
  84. 2N1,1,>
  85. 2N1,_
  86. 2B,1,<
  87. 2B,1
  88. 2B,1,<
  89. 2B,0
  90. 2B,0,<
  91. 2B,_
  92. 2,_,<
  93. // shift back
  94. 4B,_
  95. 4B,_,>
  96. 4B,0
  97. 4BB,_,>
  98. 4BB,1
  99. 4B1,_,<
  100. 4BB,0
  101. 4B0,_,<
  102. 4B1,_
  103. 4B1,_,<
  104. 4B1,0
  105. 5N,1,>
  106. 4B0,_
  107. 4B0,_,<
  108. 4B0,0
  109. 5N,0,>
  110. 5N,_
  111. 5N,_,>
  112. 5N,1
  113. 5C,1,>
  114. 5N,0
  115. 5C,0,>
  116. 5C,_
  117. 6,_,<
  118. // actual shift
  119. 5C,1
  120. 5NN,1,<
  121. 5C,0
  122. 5NN,0,<
  123. 5NN,0
  124. 5W0,_,<
  125. 5W0,_
  126. 5W0,_,<
  127. 5W0,1
  128. 5W0N,1,>
  129. 5W0,0
  130. 5W0N,0,>
  131. 5W0N,_
  132. 5N,0,>
  133. 5NN,1
  134. 5W1,_,<
  135. 5W1,_
  136. 5W1,_,<
  137. 5W1,1
  138. 5W1N,1,>
  139. 5W1,0
  140. 5W1N,0,>
  141. 5W1N,_
  142. 5N,1,>
  143. // end
  144. 6,1
  145. 6W1,_,<
  146. 6W1,_
  147. 6W1,_,<
  148. 6W1,1
  149. 6N1,1,>
  150. 6W1,0
  151. 6N1,0,>
  152. 6N1,_
  153. F,1,>
  154. 6,0
  155. 6W0,_,<
  156. 6W0,_
  157. 6W0,_,<
  158. 6W0,1
  159. 6N0,1,>
  160. 6W0,0
  161. 6N0,0,>
  162. 6N0,_
  163. F,0,>
  164.  
  165. // < = left
  166. // > = right
  167. // - = hold
  168. // use underscore for blank cells
  169.  
  170. //States and symbols are case-sensitive
  171.  
  172. //Load your code and click COMPILE.
  173. //or load an example (top-right).
RAW Paste Data