Live data from Hacker News

David Ahl's Basic Computer Games Ported to C

github.com

31–33 of 33 posts

Re: David Ahl's Basic Computer Games Ported to C

#31
post #28

Earlier quoted context omitted.

Got it, thanks. I believe that the version I have might be a later printing of the 1978 version, but actually the book I'm remembering most clearly was a later 1986 book by Ahl with a similar title of "Basic Computer Adventures" which has 10 longer adventure games… including an early version of Oregon trail. https://archive.org/details/basic_computer_adventures

There was this sequel too https://archive.org/details/More_BASIC_Computer_Games I don't think I ever saw source code for Oregon Trail As for text adventures those require fairly exotic programming techniques to pull off. Infocom had the Z machine interpreter written in assembly for many machines but Scott Adams made an interpreter which could be implemented in either BASIC or assembly.

A simple adventure with a rudimentary VERB NOUN grammar can be done as a modest BASIC program, as for example in the Usborne Adventure Programs book https://usborne.com/gb/books/computer-and-coding-books https://drive.google.com/file/d/0Bxv0SsvibDMTYkFJbUswOHFQclE... .

Re: David Ahl's Basic Computer Games Ported to C

#32
post #10

> " These haven't been tested, validated, debugged, or verified! ... I used Google Anti-Gravity to convert the programs from GW-BASIC to 'C' " Doesn't seem like there's anything of interest here. It's just tossing existing code into a LLM.

Which then gets tossed into a compiler and who knows what kind of code that thing spits out. That's why I only support projects written in assembly by real programmers.

Dude they didn't even run it themselves

Re: David Ahl's Basic Computer Games Ported to C

#33
post #31

Earlier quoted context omitted.

There was this sequel too https://archive.org/details/More_BASIC_Computer_Games I don't think I ever saw source code for Oregon Trail As for text adventures those require fairly exotic programming techniques to pull off. Infocom had the Z machine interpreter written in assembly for many machines but Scott Adams made an interpreter which could be implemented in either BASIC or assembly.

A simple adventure with a rudimentary VERB NOUN grammar can be done as a modest BASIC program, as for example in the Usborne Adventure Programs book https://usborne.com/gb/books/computer-and-coding-books https://drive.google.com/file/d/0Bxv0SsvibDMTYkFJbUswOHFQclE... .

That's a good example of what I'm talking about!

You can't write out a "script" for how the game works out the way most of those BASIC games are written. Rather that kind of game is table-driven and complicated by the fact that BASIC doesn't support structures so you can't write those tables in the "array-of-structures" system but rather have to write in the slightly awkward "structures-of-array". In a normal language you would have pointers, in BASIC everything has to be an index into an array.

A game like that is "object oriented" in the sense that there are rooms and items that share a lot of common attributes that could fit into an ontology. For the most part these things behave the same (pick something up and it goes into your inventory) with a few exceptions (you need to be holding the cage and not holding the rod to pick up the bird) A game like that can have a few if-then-else ladders in it there are keyed by magic numbers. It is maintenance hell (in a world without unit tests!) though you can take the cope that it is hard for somebody to look at the source code to cheat.

Scott Adams put the exceptions entirely into the tables with a very simple and specialized interpreter which was easy to implement in BASIC and also in assembly -- then he went on to make a huge number of games

https://en.wikipedia.org/wiki/List_of_Scott_Adams_Adventure_...

where the interpreter is the same and the table is different. BTW, the "orginal adventure" was written in an old version of FORTRAN with awkward string handling and arrays but no pointers and uses similar techniques

https://en.wikipedia.org/wiki/Colossal_Cave_Adventure

Post reply on HN