From: Alpha Chen Date: 2008-05-14T01:35:03+09:00 Subject: Re: The Turing Machine (#162) On May 12, 6:54 pm, Matthew Moss wrote: > Looks like a pretty nice solution, except I think (but didn't confirm) > there is one problem: > > >       @head += (dir == 'R') ? 1 : -1 > > Doing this could cause the head to wrap around, since array[-1] in > Ruby is the last element of the array. It's likely the examples won't > exercise this constraint, but the tape should not loop... That could be a problem, but I cheated: @tape is actually a hash. (I was lazy and didn't want to make a Tape class or add extra logic to deal with going past the front of the tape.)