Re: Perl Quiz of the Week #24 (Turing Machine simulation)

"John J. Trammell" <[email protected]>
Newsgroups gmane.comp.lang.perl.qotw.discuss
Message-ID <[email protected]>
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.
> 
> By default, the third argument is 0, which is the first character of
> the initial value.

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,
e.g.:

  perl turing.pl --start-pos 42 myprog.tm 123456_abc
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.