File: add_one.stm

package info (click to toggle)
ruby-tins 1.32.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,248 kB
  • sloc: ruby: 6,659; makefile: 3
file content (13 lines) | stat: -rw-r--r-- 385 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
# vim: ts=2 sw=2 et ft=ruby
# Call with a binary number on the tape:
# $ turing.rb add_one.stm 1111010101

0. right :goto   => 1
1. cond  :if => 'B', :then => 2, :else => 0
2. left  :goto   => 3
3. cond  :if => '1', :then => 4, :else => 5
4. write :symbol => '0', :goto => 2
5. write :symbol => '1', :goto => 6
6. right :goto   => 7
7. cond  :if => 'B', :then => 8, :else => 6
8. halt