Re: Perl Quiz of the Week #24 (Turing Machine simulation)
colin.rafferty-/PgpppG8B+R7qynMiXIxWgC/[email protected]
| Newsgroups | gmane.comp.lang.perl.qotw.discuss |
|---|---|
| Message-ID | <[email protected]> |
John J. Trammell wrote: > On Wed, Sep 15, 2004 at 10:41:14AM -0400, colin.rafferty-/PgpppG8B+R7qynMiXIxWgC/[email protected] wrote: >> Zed Lopez wrote: >>> Your program should take two parameters: the filename of a file >>> containing the state transition instructions, and the tape's initial >>> contents. The filename is required. >>> If an initial value for the tape is specified, the read/write head >>> begins over the first character of that initial value. >> I would change the specification of the program to allow for a third >> argument which is the head's initial location on the tape. >> It's value is any number, positive or negative, which specifies the >> head's position relative to the first character of the second >> argument. > I'd say this is a perfect example of a customization that a user may > wish to apply, but this should be implemented via command-line options, I disagree. I think that without it, you cannot specify any finite initial state of a turing machine. And since it is a defaulted third parameter, it follows perfectly. Anyway, that's how I'm going to implement it, but it's a minor detail. The interesting part is trying to model an infinite tape. -- Colin