📜 ⬆️ ⬇️

We use habrakommentariy as the Turing machine

How did it even get into my head?



Each habrakomkommentya has the address. Comment address structure:
habrahabr.ru/blogs/gtd/135090/#comment_4486120
The fact that before "#" is a link to the topic, and after that - an anchor, indicating the position of the comment on the page.
If the comments indicate links to other comments, and then click on them, the page will scroll to the desired place. Even the comments themselves have a pair of arrows ↑ ↓ allowing you to move between responses to comments.
“Hey!” I thought, “there’s something in it.” At first I pondered over the limit of comments confusion, if you put links to each other in them. But then I realized that here lies in general something of elementary programming, much like a Turing machine. But some details were not enough, and links in the content of the comments did not want to use. Adding to favorites has come to the rescue!

Implementation of the algorithm for the addition of unary numbers on a Turing machine


For a start, I trained on the Javascript version of the Turing machine http://matinf.igpu.ru/simulator/tm.html , summed up 2 and 3.
 01101110 -> 01111100 

Wrote a small algorithm for this purpose:
 0q1->0q2R 1q2->1q2R 0q2->1q3R 1q3->1q3R 0q3->0q4H 0q4->0q4L 1q4->0q5L 1q5->1q5L 0q5->0STOP 

Select tree comments and add two posts to favorites and then 3 more posts:


And now briefly the steps themselves (not all):

As a result, we get what we wanted: 2 + 3 = 5.

It is so simple and easy to make arithmetic operations using just the comments of the masters.
')

List of sources used


Source: https://habr.com/ru/post/135207/


All Articles