Skip to content

Instantly share code, notes, and snippets.

@lparolari
Last active April 17, 2021 14:10
Show Gist options
  • Save lparolari/2b39f61946ae1311b43b6470cc295661 to your computer and use it in GitHub Desktop.
Save lparolari/2b39f61946ae1311b43b6470cc295661 to your computer and use it in GitHub Desktop.
A Turing machine implementation of the greater (or equal) algorithm. Powered by https://turingmachine.io/.
input: '00S00'
blank: ' '
start state: init
table:
# we want to start with the tape centered in the separator symbol
init:
0: { R }
S: { L: start }
start:
0: { L }
' ': { R: find }
find:
0: { write: X, R: found }
S: { R: right }
found:
0: { R }
S: { R: write }
write:
0: { write: Y, L: back }
Y: { R }
' ': { L: left }
back:
S: { L }
0: { L }
X: { write: X, R: find }
Y: { L }
right:
Y: { R }
0: { R: done }
' ': { L: center }
done:
0: { R }
center:
Y: { L }
left:
T: { L }
S: { L }
X: { L }
Y: { L }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment