# bin2dec.tur: converts a binary number in decimal notation. # # This program in fact sums the binary number on the right to the decimal # number on the left # # Tape format: " " where n1 is the decimal number and n2 is the # binary one. # 0 0 0 r 0 Moverse hacia la derecha hasta llegar al extremo derecho del segundo 0 1 1 r 0 numero. 0 2 2 r 0 0 3 3 r 0 0 4 4 r 0 0 5 5 r 0 0 6 6 r 0 0 7 7 r 0 0 8 8 r 0 0 9 9 r 0 0 _ _ r 1 1 1 1 r 1 1 0 0 r 1 1 _ _ l 2 2 1 0 l 4 Restarle uno al numero binario y pasar al estado 4. 2 0 1 l 2 2 _ _ r 3 Si ya no se le puede restar, borrar el numero y terminar. 3 1 _ r 3 4 1 1 l 4 Moverse a la izquierda hasta encontrar el extremo derecho del 4 0 0 l 4 decimal. 4 _ _ l 5 5 _ 1 r 0 Sumarle uno al numero decimal y volver al estado 0. 5 0 1 r 0 5 1 2 r 0 5 2 3 r 0 5 3 4 r 0 5 4 5 r 0 5 5 6 r 0 5 6 7 r 0 5 7 8 r 0 5 8 9 r 0 5 9 0 l 5