On Fri, Dec 08, 2000 at 04:15:21AM -0500, Mark Rogaski wrote: > In a fit of insomnia, I worked up a simulation of a simple one head, one > R/W tape, deterministic Turing machine. The rules for it are as such: Coolness! I was inspired to write my own version, which differs mainly in the syntax of the input file. Each rule is five characters, in the same order as Mark's. The state is an ascii character not a number, and the halt state is "!". Initial state is "A". So Mark's example program would be A1A1R A0A0R A B L B1B0L B0C1L B C1L C1C1L C0C0L C ! R I was aiming for brevity, and it *is* 58 characters shorter than Mark's version. I'm sure it could be compressed more, with some thought. .robin. #!/usr/local/bin/perl -p0777 y= =\0=;s=(.)(.)(.)(.)(.)="s/(.)\Q$1\E\b\Q$2\E/".($5eq"R"?"\${1}$4$3\b": "$3\b\${1}$4")."/&¨"=eg;$t=$_;$_="A\b".shift;{$_="\0$_\0";eval$t; $@||die;/!\ch/&&last;redo} ==== Want to unsubscribe from Fun With Perl? Well, if you insist... ==== Send email to <fwp-request@technofile.org> with message _body_ ==== unsubscribe