Turing Machine in Ruby