Turing Machine But Way Worse
Turing Machine But Way Worse (abbreviated TMBWW) is a programming language made in December 2018, by a code golf user MilkyWay90. It is based on Turing machines that support I/O.
Tutorial
A tutorial can be found here. Here is the tutorial:
A tutorial on Turing Machines can be found here
Syntax
0/1 <any char> 0/1 if the robot sees the number 0/1 and state is <any char> replace the number with 0/1 0/1 <any char> 0/1 move left/right, respectively go to state <any char> print (will be explained in more detail) 0/1 Stop/halt the program if this is 1
For example,
0 0 1 1 a 0 1
Would be "if the number the robot is seeing is 0 and the robot is in state 0, replace the number with 1, move right, go to state a, don't print, and halt the program (stop the program)"
Printing
Let's say that the tape is
<... infinite zeros ...> 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 <... infinite zeros ...> ^
and you decide to print.
First, the program would separate the tape into separate pieces of length 8:
<... infinite zeros ...>|0 1 0 1 0 1 0 1|0 1 0 1 0 1 0 1|0 1 0 1 0 1 0 1|<... infinite zeros ...> ^
The eight bits that the robot is in is `0 1 0 1 0 1 0 1`
Converting that to base-10, we get "85", and that in ASCII is "U".
Congratulations, you have printed the character "U".
Note: Turing Machine But Way Worse doesn't append a trailing newline to the output (printing A and then B would result in AB, not A\nB)
- Input
Let's say that the input is "hi".
Taking the ASCII values of these gives us "['01101000', '01101001']".
Concatenating the list gives us "0110100001101001".
Therefore, the tape is
<... infinite zeros ...>0 1 1 0 1 0 0 0 0 1 1 0 1 0 0 1<... infinite zeros ...>`.
If there is no input, the tape is
<... infinite zeros ...>0 0 0 0 0 0 0 0<... infinite zeros ...>`.
Programs
Take first input char and print it
0 0 0 1 0 1 1 1 0 1 1 0 1 1
0 0 0 1 1 0 0 1 0 1 1 1 0 0 0 1 0 1 2 0 0 1 1 1 1 a 0 0 0 2 0 1 3 0 0 1 2 1 1 b 0 0 0 3 0 1 4 0 0 1 3 1 1 c 0 0 0 4 0 1 5 0 0 1 4 1 1 d 0 0 0 5 0 1 6 0 0 1 5 1 1 e 0 0 0 6 0 1 7 0 0 1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 0 1 57 0 0 1 57 0 1 58 0 0 0 58 0 1 59 0 0 0 59 1 1 0 1 1
Computational class
The only difference between a 2-symbol Turing machine, and a Turing Machine But Way Worse program that does not produce output, is that the latter starts with a tape that's organised based on user input, rather than having a known initial tape. However, it is possible to modify any Turing machine (even with 2 symbols) to be capable of running from an arbitrary initial tape, via using pairs of adjacent tape locations (one which holds the value of the original Turing machine, one which records whether or not that cell has been initialized yet), and lazily initializing the tape as the Turing machine runs. (Although it is impossible to mark every tape cell as uninitialized in advance, you do not have to; as long as, beyond initial startup, you always maintain one cell marked as uninitialized at each end of the initialized portion of the tape, you can do the marking-as-uninitialized lazily too. Alternatively, you can use the marker cells to indicate cells which have already been initialized, which does allow marking every cell as uninitialized.)