Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>In my own Turing pseudocode:</p> <ol> <li>copy input A0B to Tape 2</li> <li>write 000010000 to Tape 3 <ul> <li>multiply the number on Tape 3 by A from Tape 2 by <ol> <li>starting at the beginning of A </li> <li>writing 0 to Tape 4 <ul> <li>copying number 3 => 4</li> <li>moving forward once on Tape 3 (3++)</li> <li>going to step 3 unless A ends</li> <li>moving answer from Tape 4 to tape 3 </li> </ul></li> </ol></li> <li>decrement the number B on Tape 2 </li> </ul></li> <li>If B on Tape 2 isn't 0, go to step 2</li> <li>Copy the answer from Tape 3 to Tape 1</li> </ol> <p>Here's the turing code that should work (tapes are like pointers, lowercase letters, input tape is <code>i</code>):</p> <pre><code> # At the start for 2^3 # i: 000111011110000 # ^ _start_ -> *a = 0, start2 start2 [*i==0] -> i++, *a++ = 0, *b++ = 0, start4 start2 [*i==1] -> i++, *a++ = 1, start2 start4 [*i==0] -> *b-- = 0, b--, initc start4 [*i==1] -> i++, *b++ = 1, start4 initc -> *c++ = 0, *c++ = 1, *c++ = 1, *c-- = 0, mult # example # i: 00011101111000 # ^ # a: 001110000 # ^ # b: 001111000 # ^ # c: 00011000 # ^ mult[*b==0]: lastcpy mult[*b==1]: b--, *d++ = 0, *d++ = 1, rewa rewa[*a==0]: a++, a++, multcpy rewa[*a==1]: a--, rewa multcpy[*c==1]: c++, multcpy2 multcpy[*c==0]: multcpy3 multcpy2[*a==0]: multcpy multcpy2[*a==1]: *d++ = 1, multcpy2 multcpy3: *d-- = 0, *c = 0, cpydtoc cpydtoc[*d==1]: d--, *c++ = 1, cpydtoc cpydtoc[*d==0]: *c-- = 0, mult lastcpy[*c==1]: *i++ = 1, c--, lastcpy lastcpy[*c==0]: *i = 0, _finish_ # Should end with # i: 00011101111011111111100 # ^ </code></pre> <p>Please check for errors :)</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload