Updating "101 Basic Computer Games" for 2022 and beyond

I’ve found an online BASIC interpreter that appears to work as expected for the handful of games I have tested so far:
Applesoft BASIC in JavaScript (calormen.com)

This is useful as sometimes it is difficult to follow BASIC without running the code.

I’m going to port MATH DICE to C# next

2 Likes

Yeah, what I did was to download the source, and the vintage-basic binaries and then copy/paste the basic parts I wanted to see in action into a .BAS file and run that. Very primitive debugging :smiley:

Do you mean for another port? Yeah, I will maybe do that next time :slight_smile: I don’t think we need more than one implementation of the super simple ones, especially when the existing one is fine.

Oh well, there goes my attempt to contribute for now :)))

2 Likes

I don’t know enough golang to port these games, but I was under the impression that it is designed to be memory safe. It does not offer pointers and performs garbage collection of objects on the programmer’s behalf. Looking now, I see that there is a package for Unsafe access, but ostensibly Java did not wall off its own Unsafe until version 9 and was nonetheless considered a safe language at the time.

I understand cutting it for other reasons (ex Atwood expressed an intention to donate for each ported program, each extra language compromises fulfilling that intention). If it has been tarred with the right brush, I’d like to know, so I can remove ‘learning it’ from my bucket list.

3 Likes

I’m taking a purist stance on this, per Wikipedia:

Go isn’t memory-safe when there are data races, though slightly unclear just how unsafe (like, does the whole show segfault?)

Yes, it can. There are demo programs and exploit code which exploit timing windows in slice descriptor updates. There’s some denial about this in the Go community. “Effective Go” paints an unrealistically rosy picture of the language. In contrast, Google’s own AppEngine locks Go programs down to one thread to protect the cloud-based execution environment.

Philosophically, we want scripting languages here, not anything that’s close to the metal. But I do agree that Go and Rust are very important steps in the right direction, for sure!

2 Likes

We were just discussing this book in a FB group. I had brought up the topic because I have been looking for a while for the book that really inspired me as a teenager (and we’re talking mid-1970s here). The 101 BASIC Computer Games came after that book, but was the closest thing I could remember, until I had the idea today of searching the Library of Congress catalog for books on computer games published in the 1970s, and found not only the book I have been searching for, but a great online version. Thought I would share that here; if the project on Github ends up with a Wiki this might be an interesting addition. I actually think I was lucky to have been inspired by this book, because for the most part it wasn’t just programs to type in, but often just descriptions of algorithms, and I had to do the heavy lifting myself (at that stage on a Sperry-Univac/1100 that my high school connected to with a teletype, punch paper tape reader, and 150 baud acoustic coupler - AKA “the good old days”). http://www.chilton-computing.org.uk/acl/literature/books/gamesplaying/overview.htm

3 Likes

I’ve been thinking about how to solve this and another issue is that each language has its own PRNG algorithm. This becomes an issue with games like 47 Hi-Lo. It’s easy enough to script the interactions with the games, but how to override the PRNG to generate numbers in the same sequence?

2 Likes

One way would be to create a game lib for each of the chosen languages (with a shared API). There might be other things than random numbers to align on, like how to print to the console with centred text and line lengths etc.

Then you just have the problem of how to control random numbers in BASIC :slight_smile: But since we control the interpreter, it should be possible. One way is to record the (actually random) random numbers from a game play of the BASIC source and then use those as output for the mock PRNGs?

1 Like

If you are generating numbers in the same sequence, that’s not random… perhaps I am misunderstanding you?

1 Like

I meant the same sequence of numbers masquerading as ‘random’ numbers. My idea would be to have vintage-basic always return the same sequence of ‘random’ numbers by hardcoding a seed value in the interpreter. Then you could record the output and input of the basic program and always get the same result.

The problem however comes in when you try playback that input onto a Ruby/Python/etc app and try get the same output. They will have their own PRNG so even if you give the same seed value, you’ll get different numbers coming out of the PRNG.

The idea I had (which I’m not convinced will work) was to try to reimplement a simple PRNG and then inject that into the runtime somehow. It might be possible with C# using something like Harmony and possible easy in Ruby/Python/Perl but I’m not sure about the others. Also, I don’t know Haskell which vintage basic is coded in.

2 Likes

I get that a lot of education curriculums still teach it because of how common it is in business settings, but in what world do I have “a task I need accomplished at the command line” and decide to knock out a little script in Java? What does a “Java one-liner” look like? At least C# and VB.NET can be trivially wired up to PowerShell, but Java is shockingly unlike the other 7 languages in your list of 8.

2 Likes

Yep, I plan to blog this soon. Apologies for the delay.

1 Like

I’m sorry I found this so late.

I actually have a collection of these basic books, including David H Ahl’s classics.


And a while back I started a similar project called “Cymon’s Games” where my ultimate goal was to make a book with programs inspired by these programs, as well as examples from the IOCCC and others. In the end it was a fun way to kickstarter what ended up being 10 years in software development.

The repository for Cymons Games is on GitHub, if you’re interested;

3 Likes

It has been blogged! Thank you so much for all those early contributions, you really helped flesh out the goals of the project. Now let’s keep going! 🏃‍♂️💨

3 Likes

I feel that Kotlin is getting no love. I would much rather contribute a Kotlin version than a Java version.

Is Kotlin acceptable?

3 Likes

I’d prefer if we stuck with native Java for now… can you submit a version that works on both Kotlin and regular standard Java? Is it that compatible? I’m not super familiar with Kotlin.

1 Like

Second the Kotlin suggestion. Kotlin is a JVM language, like Java and Scala. As such, Java and Kotlin are “compatible”, but Kotlin does use a different compiler.
Frankly, many of these programs will look much more natural in Kotlin, as it supports top level functions instead of requiring classes.
I would say we would want both a Java AND a Kotlin version, though. Kotlin is growing pretty fast (DoorDash uses it as their primary backend language, for example), and is much more concise and clear than Java, but Java is still massively popular.

4 Likes

OK! I support adding it as another subfolder, if any Kotlin fans want to take that on, be my guest. However, the $5/program donation will only reflect the original 8 languages we decided on based on earlier discussion in this topic.

3 Likes

Greetings! Great project! I’m happy to jump in, probably mainly Ruby.

Was just wondering if there’s any place where it says if someone is already working on an implementation. I can’t find any. I don’t think it is strictly necessary, but if enough of you finds it helpful am happy to put some effort in that. We can either use GH projects on the main repo or a seprate public trello board or anything like that.

Off to some ruby coding for now :slight_smile:

2 Likes

There was some discussion of this above, consensus was there’s no “calling dibs”, just submit a pull request with the partial implementation or a stub if you feel really strongly about claiming one.

1 Like

I’m happy to announce that Tim Buchalka (journich) is now a co-owner of the GitHub repo for the project! He contributed many of the Java ports to the project, and said:

My focus is Java. I’ve been in the programming business more or less since my teens. I started out in the 1980’s with a Microbee with a Zilog Z80 and 16K and progressed to Commodore 64’s and so on. My first language was Basic, of course. Been a gamer since then as well and to this day.

I actually remember typing a lot of these games into my first computer and getting them to work and saving them to cassette tape.

I have both books. I had the original yellow Basic Computer Games book, but lost it over the years, but bought both last year on Ebay (cost me a damn fortune as well) lol. But man opening up the books and reading them really does bring back great memories.

So this is all about fun for me. I’ve had some decent success in my life, and have created a pile of courses to teach people how to program.

This is me on Udemy.

https://www.udemy.com/user/timbuchalka/

So I have no desire and don’t need to “make” anything out of this. In fact at 57 I am starting to wind down my commercial career so I can focus 100% on fun stuff. If you know anyone who wants to buy my programming course business let me know. :slight_smile:

Thank you sir and welcome to the project! :raised_hands:

3 Likes