eric.foxx has asked for the wisdom of the Perl Monks concerning the following question:
I am creating a quite complex format that will show the tape contents of a Turing Machine. I want to be able to show the user where on the tape we are, in a cleanly formatted area above the tape itself. Here is an 80-column example (truncated to save other monks' weary eyes):
5-state machine, theoretical max steps: >47,176,870 Step: 630 Current delta: 54 ---------------------------------------------------------------------- +------------ 1 2 + 2 8 9 0 1 2 3 4 5 + 6 6 4567890123456789012345678901234567890123456789001234567890123456789012 +345678901234 ----------------------------------------v----------------------------- +------------ 1 11 1 1 1 11 111 1 + 11
I have looked at many of the usual subjects on this topic, including perlform and Sage's Perl Practicum, but it may just be possible that I'm the first weirdo to need something like this!
Right now, I'm taking the log(10) of the largest number (264 in this example) to determine how many lines the numbers will take up vertically. After that, I have to compose the format dynamically and eval it later. Is this the best way? Any better ideas or refinements?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Vertical number representation for Turing Machine tape display?
by BrowserUk (Patriarch) on Sep 20, 2008 at 23:55 UTC | |
|
Re: Vertical number representation for Turing Machine tape display?
by blokhead (Monsignor) on Sep 20, 2008 at 23:53 UTC | |
|
Re: Vertical number representation for Turing Machine tape display?
by GrandFather (Saint) on Sep 20, 2008 at 23:52 UTC | |
|
Re: Vertical number representation for Turing Machine tape display?
by eric.foxx (Novice) on Sep 21, 2008 at 00:42 UTC |