
154
|
第 5 章
# state 4: scan right looking for end of string
TMRule.new(4, 'c', 4, 'c', :right), # skip c
TMRule.new(4, '_', 5, '_', :left), # find blank, go to state 5
# state 5: scan left looking for beginning of string
TMRule.new(5, 'a', 5, 'a', :left), # skip a
TMRule.new(5, 'b', 5, 'b', :left), # skip b
TMRule.new(5, 'c', 5, 'c', :left), # skip c
TMRule.new(5, 'X', 5, 'X', :left), # skip X
TMRule.new(5, '_', 1, '_', :right) # find blank, go to state 1
])
=> #<struct DTMRulebook rules=[…]>
>> tape = Tape.new([], 'a', ['a', 'a', 'b', 'b', 'b', 'c', 'c', 'c'], '_')
=> #<Tape (a)aabbbccc>
>> dtm = DTM.new(TMConfiguration.new(1, tape), [6], ...