New Scott Adams format interpreter "PerlScott"


#1

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. :laughing:

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.


#2

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. =)


(jkj yuio) #3

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!


#4

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.


#5

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 :slight_smile:

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


(jkj yuio) #6

Thanks for the updates!

I’m looking at line 1290 in the listing,

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;

# 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:

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

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


#7

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.

=)


#8

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.

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 :slight_smile:


#9

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 :slight_smile:


#10

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.

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
https://intfiction.org/t/if-archive-hugo-downloads/59/1