Skip to content

Instantly share code, notes, and snippets.

@VIVelev
Last active November 1, 2023 22:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save VIVelev/0a5c5145e8a8495b051b87f6c083165c to your computer and use it in GitHub Desktop.
Save VIVelev/0a5c5145e8a8495b051b87f6c083165c to your computer and use it in GitHub Desktop.
Turing Machine Recognizing 0^n 1^n 2^n
name: 0n1n2n
source code: |-
input: '000011112222'
blank: ' '
start state: q0
table:
q0:
0: {write: ' ', R: q1}
q1:
[0, 'x']: {R: q1}
1: {write: 'x', R: q2}
q2:
[1, 'x']: {R: q2}
2: {write: 'x', L: q3}
q3:
[1, 'x']: {L: q3}
0: {write: 'x', R: q1}
' ': {R: q4}
q4:
'x': {R: q4}
' ': {R: accept}
accept:
positions:
q0: {x: 172.58, y: 103.49}
q1: {x: 331.7, y: 103.8}
q2: {x: 512.59, y: 106.57}
q3: {x: 511.48, y: 243.72}
q4: {x: 513.59, y: 378.62}
accept: {x: 363.09, y: 377.56}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment