Skip to content

Instantly share code, notes, and snippets.

@arlyon
Last active April 27, 2019 15:08
Show Gist options
  • Save arlyon/bc994ed7508bd1952c7499f9cf283c34 to your computer and use it in GitHub Desktop.
Save arlyon/bc994ed7508bd1952c7499f9cf283c34 to your computer and use it in GitHub Desktop.
TM™
input: '11111'
blank: ' '
start state: mark1
table:
mark1:
1 : {write: ' ', R: fork}
' ' : {L: q5}
fork:
# if there is a one, mark it, if not fork
1 : {write: ' ', R: moveR1}
' ' : {R: moveR2}
moveR2:
1 : {R}
' ' : {write: 1, L: moveL2}
moveL2:
1 : {L}
' ' : {L: join}
moveR1:
1 : {R}
' ' : {R: write1}
write1:
1 : {R}
' ' : {write: 1, R: write2}
write2:
' ' : {write: 1, L: moveL1}
moveL1:
1 : {L}
' ' : {L: unmark}
unmark:
1 : {L}
' ' : {write: 1, L: join}
join:
' ' : {write: 1, R: q4}
q4:
1 : {R: mark1}
' ' : {L: q7}
q7:
1 : {L: q5}
q5:
1: {L}
' ': {R: q6}
q6:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment