Created
September 20, 2024 13:17
-
-
Save fhuszar/888f378da59d24109af547cc105ab438 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Sorts 0s and 1s in a sequence. | |
#to be used at turingmachine.io | |
input: '0010110100001' | |
blank: ' ' | |
start state: valid0 | |
table: | |
# Valid string ending in zero | |
valid0: | |
0 : R | |
1 : {R: valid1} | |
' ' : {R: done} | |
valid1: | |
1: {R} | |
0 : {write: 1, L: carryback} | |
' ': {L: done} | |
carryback: | |
1: {L} | |
[0,' '] : {R: placezero} | |
placezero: | |
[0, 1] : {write: 0, R: valid0} | |
done: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment