Skip to content

Instantly share code, notes, and snippets.

@diseraluca
Created February 21, 2019 19:28
Show Gist options
  • Save diseraluca/33b5238e524cb715b9191b0dddbe141e to your computer and use it in GitHub Desktop.
Save diseraluca/33b5238e524cb715b9191b0dddbe141e to your computer and use it in GitHub Desktop.
name: divisibleBy10
source code: |-
input: '2451'
blank: ' '
start state: start
table:
start:
1 : R
2 : R
3 : R
4 : R
5 : R
6 : R
7 : R
8 : R
9 : R
0 : R
' ' : {R : temp}
temp:
' ' : {L : delegatedTemp}
delegatedTemp:
' ' : {L : one}
one:
1 : {R : rej}
2 : {R : rej}
3 : {R : rej}
4 : {R : rej}
5 : {R : rej}
6 : {R : rej}
7 : {R : rej}
8 : {R : rej}
9 : {R : rej}
0 : {R : acc}
rej:
acc:
positions:
start: {x: 297.5, y: 376.14, fixed: false}
temp: {x: 266.07, y: 236.3, fixed: false}
delegatedTemp: {x: 352.74, y: 121.84, fixed: false}
one: {x: 492.85, y: 150.07, fixed: false}
rej: {x: 441.54, y: 284.97, fixed: false}
acc: {x: 564.29, y: 274.69, fixed: false}
name: shiftRight
source code: |-
input: '10101100'
blank: ' '
start state: start
table:
start:
0 : { R : start }
1 : { R : start }
' ': { L : one }
one:
0 : {R : stay10 }
1 : {R : stay11 }
' ' : {R : stay1Blank }
stay10:
0 : {L : holdS0 }
1 : {L : holdS0 }
' ' : {L : holdS0 }
holdS0:
0 : {R : stayHoldS0 }
stayHoldS0:
0 : {L : composeS0 }
1 : {L : composeS0 }
' ' : {L : composeS0 }
composeS0:
0 : { R : stayComposeS0 }
1 : { R : stayComposeS0 }
' ' : { R : stayComposeS0 }
stayComposeS0:
0 : {L : writeS0}
1 : {L : writeS0}
' ' : {L : writeS0}
writeS0:
0 : { write : ' ', R : stayWriteS0 }
1 : { write : ' ', R : stayWriteS0 }
' ' : { write : ' ', R : stayWriteS0 }
stayWriteS0:
0 : {L : writeIntermediate0}
1 : {L : writeIntermediate0}
' ' : {L : writeIntermediate0}
writeIntermediate0:
0 : {R : stayWriteIntermediate0}
1 : {R : stayWriteIntermediate0}
' ' : {R : stayWriteIntermediate0}
stayWriteIntermediate0:
0 : {L : compose01 }
1 : {L : compose01 }
' ' : {L : compose01 }
compose01:
0 : {R : stayCompose01 }
1 : {R : stayCompose01 }
' ' : {R : stayCompose01 }
stayCompose01:
0 : {L : moveRightS0}
1 : {L : moveRightS0}
' ' : {L : moveRightS0}
moveRightS0:
0 : {R : moveRightIntermediate0 }
1 : {R : moveRightIntermediate0 }
' ' : {R : moveRightIntermediate0 }
moveRightIntermediate0:
0 : {write : 0, R : stayMoveRightIntermediate0}
1 : {write : 0, R : stayMoveRightIntermediate0}
' ' : {write : 0, R : stayMoveRightIntermediate0}
stayMoveRightIntermediate0:
0 : {L : composeIntermediate0 }
1 : {L : composeIntermediate0 }
' ' : {L : composeIntermediate0 }
composeIntermediate0:
0 : { R : stayComposeIntermediate0 }
1 : { R : stayComposeIntermediate0 }
' ' : { R : stayComposeIntermediate0 }
stayComposeIntermediate0:
0 : { L : holdIntermediate0 }
1 : { L : holdIntermediate0 }
' ' : { L : holdIntermediate0 }
holdIntermediate0:
0 : {L : two }
1 : {L : two }
' ' : {L : two }
stay11:
0 : {L : holdS1 }
1 : {L : holdS1 }
' ' : {L : holdS1 }
holdS1:
1 : {R : stayHoldS1 }
stayHoldS1:
0 : {L : composeS1 }
1 : {L : composeS1 }
' ' : {L : composeS1 }
composeS1:
0 : { R : stayComposeS1 }
1 : { R : stayComposeS1 }
' ' : { R : stayComposeS1 }
stayComposeS1:
0 : {L : writeS1}
1 : {L : writeS1}
' ' : {L : writeS1}
writeS1:
0 : { write : ' ', R : stayWriteS1 }
1 : { write : ' ', R : stayWriteS1 }
' ' : { write : ' ', R : stayWriteS1 }
stayWriteS1:
0 : {L : writeIntermediate1}
1 : {L : writeIntermediate1}
' ' : {L : writeIntermediate1}
writeIntermediate1:
0 : {R : stayWriteIntermediate1}
1 : {R : stayWriteIntermediate1}
' ' : {R : stayWriteIntermediate1}
stayWriteIntermediate1:
0 : {L : compose11 }
1 : {L : compose11 }
' ' : {L : compose11 }
compose11:
0 : {R : stayCompose11 }
1 : {R : stayCompose11 }
' ' : {R : stayCompose11 }
stayCompose11:
0 : {L : moveRightS1}
1 : {L : moveRightS1}
' ' : {L : moveRightS1}
moveRightS1:
0 : {R : moveRightIntermediate1 }
1 : {R : moveRightIntermediate1 }
' ' : {R : moveRightIntermediate1 }
moveRightIntermediate1:
0 : {write : 1, R : stayMoveRightIntermediate1}
1 : {write : 1, R : stayMoveRightIntermediate1}
' ' : {write : 1, R : stayMoveRightIntermediate1}
stayMoveRightIntermediate1:
0 : {L : composeIntermediate1 }
1 : {L : composeIntermediate1 }
' ' : {L : composeIntermediate1 }
composeIntermediate1:
0 : { R : stayComposeIntermediate1 }
1 : { R : stayComposeIntermediate1 }
' ' : { R : stayComposeIntermediate1 }
stayComposeIntermediate1:
0 : { L : holdIntermediate1 }
1 : { L : holdIntermediate1 }
' ' : { L : holdIntermediate1 }
holdIntermediate1:
0 : {L : two }
1 : {L : two }
' ' : {L : two }
stay1Blank:
0 : {L : ACC}
1 : {L : ACC}
' ' : {L : ACC}
two:
' ' : {L : one}
ACC:
positions:
start: {x: 92.82, y: 480, fixed: false}
one: {x: 247.71, y: 480, fixed: false}
stay10: {x: 107.45, y: 431.79, fixed: false}
holdS0: {x: 20, y: 318.02, fixed: false}
stayHoldS0: {x: 20, y: 441, fixed: false}
composeS0: {x: 20, y: 270.6, fixed: false}
stayComposeS0: {x: 132.26, y: 156.81, fixed: false}
writeS0: {x: 292.57, y: 94.22, fixed: false}
stayWriteS0: {x: 451.64, y: 136.28, fixed: false}
writeIntermediate0: {x: 579.91, y: 251.42, fixed: false}
stayWriteIntermediate0: {x: 669.09, y: 381.77, fixed: false}
compose01: {x: 780, y: 480, fixed: false}
stayCompose01: {x: 780, y: 333.88, fixed: false}
moveRightS0: {x: 780, y: 170.27, fixed: false}
moveRightIntermediate0: {x: 780, y: 293.49, fixed: false}
stayMoveRightIntermediate0: {x: 780, y: 437.63, fixed: false}
composeIntermediate0: {x: 645.15, y: 480, fixed: false}
stayComposeIntermediate0: {x: 500.64, y: 480, fixed: false}
holdIntermediate0: {x: 337.27, y: 480, fixed: false}
stay11: {x: 411.18, y: 480, fixed: false}
holdS1: {x: 440.59, y: 344.82, fixed: false}
stayHoldS1: {x: 321.5, y: 246.56, fixed: false}
composeS1: {x: 216.71, y: 146.36, fixed: false}
stayComposeS1: {x: 161.19, y: 20, fixed: false}
writeS1: {x: 20, y: 20, fixed: false}
stayWriteS1: {x: 20, y: 144.34, fixed: false}
writeIntermediate1: {x: 104.68, y: 20, fixed: false}
stayWriteIntermediate1: {x: 270.86, y: 20, fixed: false}
compose11: {x: 436.06, y: 20, fixed: false}
stayCompose11: {x: 607.72, y: 20, fixed: false}
moveRightS1: {x: 780, y: 20, fixed: false}
moveRightIntermediate1: {x: 667.18, y: 20, fixed: false}
stayMoveRightIntermediate1: {x: 537.71, y: 20, fixed: false}
composeIntermediate1: {x: 689.4, y: 65.19, fixed: false}
stayComposeIntermediate1: {x: 571.8, y: 156.96, fixed: false}
holdIntermediate1: {x: 439.71, y: 251.3, fixed: false}
stay1Blank: {x: 376.3, y: 480, fixed: false}
two: {x: 306.3, y: 345.5, fixed: false}
ACC: {x: 211.95, y: 480, fixed: false}
name: toEnd
source code: |-
input: '123456789'
blank: ' '
start state: start
table:
start:
1 : R
2 : R
3 : R
4 : R
5 : R
6 : R
7 : R
8 : R
9 : R
0 : R
' ' : {R : temp}
temp:
' ' : {L : done}
done:
positions:
start: {x: 352.06, y: 169.87, fixed: false}
temp: {x: 351.85, y: 311.67, fixed: false}
done: {x: 485.65, y: 265.2, fixed: false}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment