Skip to content

Instantly share code, notes, and snippets.

@OfekYa
Last active February 21, 2024 11:57
Show Gist options
  • Save OfekYa/bef40ec8e62908701076afd27c8d670a to your computer and use it in GitHub Desktop.
Save OfekYa/bef40ec8e62908701076afd27c8d670a to your computer and use it in GitHub Desktop.
name: '#1=#0'
source code: |
input: '00101110'
blank: ' '
start state: Q0
synonyms:
accept: {R: accept}
reject: {R: reject}
# A palindrome is either the empty string, a single symbol,
# or a (shorter) palindrome with the same symbol added to both ends.
table:
Q0:
0: {write: ' ', R: Q1}
1: {write: ' ', R: Q2}
x: R
' ': accept # empty string
Q1:
[0,x]: R
1: {write: x, L: Q3}
# x: R
' ': reject
Q2:
0: {write: x, L: Q3}
[1,x]: R
' ': {write: ' ', R: reject}
Q3:
[0,1,x]: L
' ': {write: ' ', R: Q0}
accept:
reject:
positions:
Q0: {x: 89.93, y: 229.5}
Q1: {x: 408.23, y: 80.02}
Q2: {x: 398.73, y: 439.04}
Q3: {x: 405.33, y: 234.75}
accept: {x: 97.73, y: 438.6}
reject: {x: 706.89, y: 236.28}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment