Turing Machine But Way Worse

From Esolang
Jump to navigation Jump to search

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)"

    1. 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 seperate the tape into seperate 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)

    1. 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

Cat program

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
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 0 0
0 51 0 1 52 0 0
0 52 0 1 53 0 0
0 53 0 1 54 0 0
0 54 0 1 55 0 0
0 55 0 1 56 1 0
0 56 0 1 57 0 0
0 57 1 1 58 0 0
0 58 0 1 59 0 0
0 59 1 1 60 0 0
0 60 0 1 61 0 0
0 61 1 1 62 0 0
0 62 1 1 63 0 0
0 63 1 1 64 1 0
0 64 0 1 65 0 0
0 65 1 1 66 0 0
0 66 1 1 67 0 0
0 67 0 1 68 0 0
0 68 1 1 69 0 0
0 69 1 1 70 0 0
0 70 1 1 71 0 0
0 71 1 1 72 1 0
0 72 0 1 73 0 0
0 73 1 1 74 0 0
0 74 1 1 75 0 0
0 75 1 1 76 0 0
0 76 0 1 77 0 0
0 77 0 1 78 0 0
0 78 1 1 79 0 0
0 79 0 1 80 1 0
0 80 0 1 81 0 0
0 81 1 1 82 0 0
0 82 1 1 83 0 0
0 83 0 1 84 0 0
0 84 1 1 85 0 0
0 85 1 1 86 0 0
0 86 0 1 87 0 0
0 87 0 1 88 1 0
0 88 0 1 89 0 0
0 89 1 1 90 0 0
0 90 1 1 91 0 0
0 91 0 1 92 0 0
0 92 0 1 93 0 0
0 93 1 1 94 0 0
0 94 0 1 95 0 0
0 95 0 1 96 1 0
0 96 0 1 97 0 0
0 97 0 1 98 0 0
0 98 1 1 99 0 0
0 99 0 1 100 0 0
0 100 0 1 101 0 0
0 101 0 1 102 0 0
0 102 0 1 103 0 0
0 103 1 1 104 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 orignal 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.)

External resources