Skip to content

Instantly share code, notes, and snippets.

@tzdanows
Created May 9, 2021 23:32
Show Gist options
  • Save tzdanows/545657fc1e6376bce86984c6e8009265 to your computer and use it in GitHub Desktop.
Save tzdanows/545657fc1e6376bce86984c6e8009265 to your computer and use it in GitHub Desktop.
TM1 from turingmachine.io
input: '00111010'
blank: ' '
# Problem TM1. Using the Turing machine simulator at turingmachine.io, write a TM program
# that accepts the language L = {w | w is a binary string with an even number of zeroes and
# an even number of ones}.
start state: state0
table:
state0:
0: {R: state1}
1: {R: state2}
# Base case: empty string.
' ': {R: accept}
state1:
0: {R: state0}
1: {R: state3}
state2:
0: {R: state3}
1: {R: state0}
state3:
0: {R: state2}
1: {R: state1}
accept:
### Inputs tried: ###
# '00111010' ACCEPTED
# ' ' ACCEPTED
# '00001111' ACCEPTED
# '000111' REJECTED
# '1100' ACCEPTED
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment