Last active
April 2, 2019 18:36
-
-
Save prayansh/f178efe88f5e64dd431c596b3a69bd39 to your computer and use it in GitHub Desktop.
Turing Machine to double a string containing the alphabet [A,B,0] accessible via http://turingmachine.ioturingmachine.io/?import-gist=f178efe88f5e64dd431c596b3a69bd39
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: StringDoubler | |
source code: | | |
# Adds 1 to a binary number. | |
input: 'ABBA00000000000000' | |
blank: ' ' | |
start state: q0 | |
table: | |
# scan to the rightmost digit | |
q0: | |
A : {write: 0, R: q1} | |
B : {write: 0, R: qB} | |
q1: | |
[B, A] : R | |
0 : {R: q2} | |
q2: | |
B : R | |
A : R | |
0 : {write: A, L: q4} | |
q4: | |
B : L | |
A : L | |
0 : {L: q5} | |
q5: | |
B : L | |
A : L | |
0 : {write: A, R: q0} | |
qB: | |
[B, A] : R | |
0 : {R: qC} | |
qC: | |
B : R | |
A : R | |
0 : {write: B, L: qE} | |
qE: | |
B : L | |
A : L | |
0 : {L: qF} | |
qF: | |
B : L | |
A : L | |
0 : {write: B, R: q0} | |
done: | |
positions: | |
q0: {x: 379.4, y: 256, fixed: false} | |
q1: {x: 247.77, y: 332.31, fixed: false} | |
q2: {x: 391.88, y: 357.34, fixed: false} | |
q4: {x: 278.5, y: 258.08, fixed: false} | |
q5: {x: 320.47, y: 397.26, fixed: false} | |
qB: {x: 319.6, y: 118.72, fixed: false} | |
qC: {x: 423.38, y: 21.03, fixed: false} | |
qE: {x: 550.76, y: 89.01, fixed: false} | |
qF: {x: 527.74, y: 230.14, fixed: false} | |
done: {x: 568.91, y: 441.08, fixed: false} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment