// add.tm add unary strings of zeros // input tape 000...00 000..00 blank separated, blank at end // output tape 000...000 sum of zeros on input tape // #b used as a blank, ## epsilon, empty string, do not write start s0 halt s9 // use halt rather than 'final' when computing a result limit 20 trace all s0 0 s0 ## R skip over initial 0's s0 #b s1 0 R write 0 over blank s1 0 s1 ## R keep moving s1 #b s2 ## L detect at end s2 0 s9 #b R blank extra 0 enddef // test cases tape 000#b00#b should end with five zeros on tape tape 00#b0000#b