From: Matthew Moss Date: 2008-05-14T02:03:32+09:00 Subject: Re: The Turing Machine (#162) > > 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.) Ah, well played, sir. I concede the point. :)