# Add two numbers, according the the Boolos, et al., conventions. # Erase a one and move to the right (state 0). If the first square is # blank, move to the right and halt (state 1). Else, keep moving to # the right until you find a blank (state 2). Write 1 there (state # 2), move to the left until you find a blank (state 3). When you do, # move back right (state 3) and erase a 1 and move right again (state # 4). Halt. # St R W M New 0 1 _ r 1 # In state 0, if I see a 1, # write a blank and move right and goto state 1. # State 0: start state -- erase a one 1 _ _ r 99 # The first number was 0, so I'm okay. 1 1 1 r 2 # State 1: 2 _ 1 l 3 # Put a 1 in the first blank. 2 1 1 r 2 3 _ _ r 4 # Look for first blank 3 1 1 l 3 4 1 _ r 99 # Erase first 1 and halt 4 _ _ r 1000 # Former halt state. 3 1 1 r 1000 # Former halt state. 2 1 1 r 1000 # Former halt state. 99 _ _ r 1000 # Former halt state. 99 1 1 r 1000 # Former halt state. 0 _ _ r 1000 # Former halt state. # Change 1111 to 4. 100 _ 0 r 200 100 1 1 r 140 101 _ * l 104 102 _ 1 r 103 103 _ _ r 103 103 1 _ l 106 103 * _ l 107 104 _ 1 r 105 104 0 1 r 105 104 1 2 r 105 104 2 3 r 105 104 3 4 r 105 104 4 5 r 105 104 5 6 r 105 104 6 7 r 105 104 7 8 r 105 104 8 9 r 105 104 9 0 l 104 105 * * r 103 105 0 0 r 105 105 1 1 r 105 105 2 2 r 105 105 3 3 r 105 105 4 4 r 105 105 5 5 r 105 105 6 6 r 105 105 7 7 r 105 105 8 8 r 105 105 9 9 r 105 106 _ _ l 106 106 * * l 104 107 _ _ l 107 107 * _ l 107 140 1 1 r 140 #Put an end of string marker 140 _ * l 141 141 1 1 l 141 #Goto lefthand 1 141 _ _ r 142 142 1 _ l 101 1000 _ _ l 100 #Goto start state, machine u2d 1000 1 1 l 100 #Goto start state, machine u2d