intfiction.org

The Interactive Fiction Community Forum
It is currently Tue Jan 15, 2019 10:09 pm

All times are UTC - 6 hours [ DST ]




Post new topic Reply to topic  [ 10 posts ] 
Author Message
PostPosted: Tue Nov 27, 2018 10:00 am 
Offline

Joined: Mon Nov 26, 2018 10:41 am
Posts: 4
I wanted to share the Scott Adams interpreter I've been making: PerlScott

Prerequisites: A computer with Perl 5 installed, with the "Readonly" and "Carp" modules installed

The interpreter should be complete, even though some more testing (especially on Brian Howarth games) is probably needed. Big thanks to auraes for his sharp eyes and help in improving it by logging issues on things that needed doing. Glaringly obvious bugs, problems and omissions probably remain, and I'm happy for any feedback. :lol:

The PerlScott interpreter wasn't created because the world really needs another Scott Adams interpreter, but rather as an intellectual exercise in translating 8 bit Basic code to a more modern, structured code format. The version 4.6 TRS-80 Level II Basic source code, which was published in the December 1980 issue of Byte Magazine (page 192), was painstakingly converted to Perl. The choice of Perl as the language to use, was down to it having most variation in possible syntax (TMTOWTDI), allowing you to write both "basic style" code initially and more structured code as the code was gradually refactored. Even though Perl is infamous for poor readability, the interpreter, in its' current state, is written with as much regard as possible for Perl Best Practices, to have as much readability and maintainability as possible. Hopefully, this will not only allow people to use it for playing games, but to easily be able to read the code and understand the underlying concepts of the ingenious game engine that Scott Adams created, 40 years ago.


Top
 Profile Send private message  
Reply with quote  
PostPosted: Thu Dec 13, 2018 7:11 pm 
Offline
User avatar

Joined: Sun Oct 30, 2011 11:39 pm
Posts: 13
I've been playing through the games in order, and so far no issues have come up.

One thing I do appreciate, though, is the inclusion of the original basic code in your git repo. It was quite fascinating to do a comparison. =)


Top
 Profile Send private message  
Reply with quote  
PostPosted: Sat Dec 15, 2018 4:04 pm 
Offline
User avatar

Joined: Sat Jun 25, 2016 12:13 pm
Posts: 256
There are several errors in that basic listing!

do you have a scan of the original?

some obvious bad lines are; 140,470,1260,1300. Probably a lot more too!


Top
 Profile Send private message  
Reply with quote  
PostPosted: Sun Dec 16, 2018 10:02 pm 
Offline
User avatar

Joined: Sun May 06, 2012 7:23 pm
Posts: 66
Location: Sydney, Australia
jkj yuio wrote:
There are several errors in that basic listing!

do you have a scan of the original?

some obvious bad lines are; 140,470,1260,1300. Probably a lot more too!


I agree with that as I have compared it to the original listing in Byte magazine, which I still have after all these years.
It looks like some of the : have been replace with = and , replaced with . to mention 2 of the errors I can see among others.
Possibly the OCR didn't interpret the scan as well as it should.


Top
 Profile Send private message  
Reply with quote  
PostPosted: Mon Dec 17, 2018 2:55 am 
Offline

Joined: Mon Nov 26, 2018 10:41 am
Posts: 4
Thanks for the valuable comments, and for taking a look! Honestly, i never thought anybody had any sort of interest in something like this. The Scott Adams system and all the various things around it developed into a bit of a personal obsession at some point.

I've added the scanned image version of the code to the repository, for comparison. Corrections have been made to the basic listing on lines 80, 120, 140, 250, 470, 590, 720, 1170, 1260, 1300, so far. Probably some more errors remain, and i'll need to go through it in more detail in the future. OCR has been anything but perfect so the basic listing is a combination of OCR with corrections for more obvious things and manually typed in bits. It proved to be enough at the time, for automatic translation into skeleton Perl code to work.

Pull requests are always welcome, as well, if somebody doesn't want to wait for me to make the required changes :)

I also converted and reformatted two old sources of information to Markdown, for easy reference:
The ADVENTURE Data Base Format (1980) by Alan Moluf
Adventure Editor Manual (1981) by Bruce Hansen


Top
 Profile Send private message  
Reply with quote  
PostPosted: Mon Dec 17, 2018 11:12 am 
Offline
User avatar

Joined: Sat Jun 25, 2016 12:13 pm
Posts: 256
Thanks for the updates!

I'm looking at line 1290 in the listing,

Code:
1290 FORX=0TONLSTEP10:FORY=0TO1:INPUT#D,NV$(X,Y),NV$(X+1,Y),NV$(X+2,Y),NV$(X+3,Y),NV$(X+4,Y),NV$(X+5,Y),NV$(X+6,Y),NV$(X+7,Y),NV$(X+8,Y),NV$(X+9,Y):NEXTY,X


But it seems that the noun/verb list is interleaved. From your perl version, you have;

Code:
    # Words
    {
        my $word = 0;
        while ( $word < ( ( $number_of_words + 1 ) * 2 ) ) {
            my $input = read_string($handle);
            $list_of_verbs_and_nouns[ int( $word / 2 ) ][ $word % 2 ] = $input;
            $word++;
        }
    }


How does line 1290 do that? I was expecting something like:

Code:
1290 FORX=0TONL:INPUT#D,NV$(X,0),NV$(X,1):NEXTX


Was the basic listing for an earlier version of the data format?


Top
 Profile Send private message  
Reply with quote  
PostPosted: Mon Dec 17, 2018 12:48 pm 
Offline
User avatar

Joined: Sun Oct 30, 2011 11:39 pm
Posts: 13
pdxiv wrote:
Thanks for the valuable comments, and for taking a look! Honestly, i never thought anybody had any sort of interest in something like this. The Scott Adams system and all the various things around it developed into a bit of a personal obsession at some point.


Your little translation arrived at the perfect time for me, and testing it certainly opened doors for my own personal obsession with the system, though as an archivist instead of as a programmer.

=)


Top
 Profile Send private message  
Reply with quote  
PostPosted: Mon Dec 17, 2018 1:41 pm 
Offline

Joined: Mon Nov 26, 2018 10:41 am
Posts: 4
jkj yuio wrote:
I'm looking at line 1290 in the listing,

Code:
1290 FORX=0TONLSTEP10:FORY=0TO1:INPUT#D,NV$(X,Y),NV$(X+1,Y),NV$(X+2,Y),NV$(X+3,Y),NV$(X+4,Y),NV$(X+5,Y),NV$(X+6,Y),NV$(X+7,Y),NV$(X+8,Y),NV$(X+9,Y):NEXTY,X


This is an interesting line that i had forgotten about. The best way i can describe it, is that it's a "loop unrolling" optimization. It has the slightly unfortunate side-effect of only allowing you to define words in the data files in groups of 10. You may notice in some game data files, that there are empty words in the end of the word list. It's because of this. If you were to write an editor this would be a very good thing to keep in mind, for the sake of backward compatibility.

For the Perl version, just in case, i didn't want to adhere to this limitation for the sake of robustness. My thinking was that some newer game data files may not adhere to this arbitrary convention and cause breakage.

Quote:
Was the basic listing for an earlier version of the data format?

The Basic listing *was* for an earlier version of the data format, which was basically Basic DATA statements. The underlying data structure wasn't too different though. I haven't bothered to transcribe the two games available in the original format, since it's a bit too much of a time-consuming and error-prone activity at the moment. (It would be a fun project, at some point.)

Not sure if this answers the questions properly :)


Top
 Profile Send private message  
Reply with quote  
PostPosted: Mon Dec 17, 2018 2:15 pm 
Offline

Joined: Mon Nov 26, 2018 10:41 am
Posts: 4
Gio wrote:
Your little translation arrived at the perfect time for me, and testing it certainly opened doors for my own personal obsession with the system, though as an archivist instead of as a programmer.

=)

That's fun to hear. I think there are probably a lot of undiscovered and obscure games that use the Scott Adams format still out there. It's a simple system to get your head around, and given the availability of authoring systems and documentation, I find it hard to believe that we've seen all there is already.

I've been toying with a user friendly authoring system for Scott Adams format games for what seems like forever. Perhaps, it'll be done one day. The basic structure of a Scott Adams interpreter could also lend itself quite well to non-typing user interfaces on smartphones or a voice recognition assistant. Perhaps there could be an interesting future for the format as a whole. I'd like to think so :)


Top
 Profile Send private message  
Reply with quote  
PostPosted: Tue Dec 18, 2018 12:08 pm 
Offline

Joined: Mon Dec 30, 2013 4:55 am
Posts: 122
pdxiv wrote:
I think there are probably a lot of undiscovered and obscure games that use the Scott Adams format still out there.
CASA - The Classic Adventures Solution Archive, is the right place for that.
http://www.solutionarchive.com/list/system%2C11/

Some game databases would need to be cleaned and completed: some header and trailer are incomplete. There is a data structure problem in recent games, they cannot be played with the Adams interpreter 8.5 for TRS-80.
pdxiv wrote:
It's a simple system to get your head around
I agree with you. But what the Adams system may lack is the ability to intercept the player's movements.

I had decompiled adv05 "The Count", and other games, with The Adventure System instruction set. It's simple and readable and very useful to solve and fixe game.
In my post in SPOILER:SHOW
viewtopic.php?f=38&t=24902&start=10#p139498


Top
 Profile Send private message  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 posts ] 

All times are UTC - 6 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group