Updating "101 Basic Computer Games" for 2022 and beyond

For what it’s worth, I’ve gotten a decent way toward translating Super Star Trek into JavaScript via the most stupidly literal means possible. Could have started from scratch but I kind of wanted to soak my head in the old code a bit.

A neat thing is that just tonight I managed to get it running in a browser-based terminal, albeit with some bugs to fix:

https://lmorchard.github.io/basic-computer-games/84%20Super%20Star%20Trek/javascript/index.html

2 Likes

A couple of different covers:

2 Likes

Ahh those are lovely! The other one from the first run is this:

image

1 Like

First thought when seeing the red and white was some spin-off from The Cat in the Hat.

1 Like

Kind of disservice to Basic don’t you think. Why not translate the code to actual Basic languages in use today. Such as:

Freebasic
Oyxgen
PureBasic
Thinbasic
PowerBasic

All of the above are in active use and fully supported. Powerbasic today is as good a any C compiler of today.

Just to add another thought. BASIC in the old days was a procedural language. While most today use Object oriented languages, procedural coding is still in use and not obsolete. They are two totally two different styles. Translations to other languages if you must, will be much easier if one uses a procedural style of coding.

2 Likes

I would argue VB.NET covers this, and it is a classic Microsoft BASIC to boot.

I think to have a ruleset everyone can agree on, we’re going to narrow this to the top 20 TIOBE languages that are memory safe and scripting appropriate, right now by my reading…

Languages in TIOBE top 20 as of February 2021:

  1. C :x:
  2. Java
  3. Python
  4. C++ :x:
  5. C#
  6. Visual Basic
  7. JavaScript
  8. PHP :-1:
  9. SQL :-1:
  10. Assembly :x:
  11. R :-1:
  12. Groovy :question:
  13. Go :x:
  14. Ruby
  15. Swift :-1:
  16. Matlab :-1:
  17. Delphi / Object Pascal
  18. Classic VB :-1:
  19. Perl
  20. Objective-C :x:

The ones with red X are not memory safe and therefore not applicable:

:x: C, C++, Assembly, Go, Objective-C

By scripting appropriate I mean languages meant for classic BASIC style I want to run a generalized, all purpose script at the command line style programming:

:-1: PHP, SQL, R, Swift, Matlab, Classic VB

That leaves us with 8 languages:

Java, Python, C#, VB.NET, JavaScript, Ruby, Delphi / Object Pascal, Perl

Groovy is a superset of Java, based on my research, so I’m consolidating that one into just Java. This also applies to other “clone” languages, we’re going with the language that is in the TIOBE top 20, even if the clone (or superset) language is compatible.

:loudspeaker: March 2022 – After some discussion, we’ve replaced Pascal (which we can’t guarantee memory safety for, and that’s an explicit goal of this project) with Rust, and added Lua since it cracked the top 20 in TIOBE.

2 Likes

Hey Jeff,

When you say that PHP isn’t scripting appropriate, I don’t really see how it can’t run a generalized, all purpose script at the command line.
Mind you I don’t want to have PHP included, I’m just a bit thrown by your claim.
PHP CLI is as powerful as Python and has been used to do some async programming, even if I haven’t looked at the code to see how hacky it is :wink:
But again, disclaimer: I’m not pushing for it to be included!!! I REPEAT, not pushing for it to be included!

Cheers,
Gus

3 Likes

Well, we gotta draw the line somewhere, and the idea that someone would say

  • I have a task I need accomplished at the command line
  • I shall use PHP to accomplish this command line task

… is pretty unlikely to me … compared to say, every other scripting language on the list :wink:

If someone wants to start a PHP fork and link it from README.MD they are free to do so!

2 Likes

Hi Jeff,

Ok, I’ll agree on the basis that it’s not the first tool you get out of your toolbox to solve a problem.
And again, I was not pushing for it to be present :stuck_out_tongue:

Cheers,
Gus

2 Likes

The copy of “BASIC Computer Games: Microcomputer Edition” (Workman Publishing, 1978) says “101 great games…”

The repo seems to have 96 games.

The TRS-80 Edition claims an incredible 102 games.

I’m curious where the differences are.

2 Likes

So, I looked through the table of contents of my book, and it seems to line up with the GitHub repo.

One thing that’s probably a source of difference is that “Lunar LEM Rocket” is actually 3 different (very similar) programs in the book. I see that “59 Lunar LEM Rocket” has lunar.bas, lem.bas, and rocket.bas.

2 Likes

In one of my pull request, I created a visual studio solution for the .NET projects in the repo. In one of the last 85 commits, it was deleted. Was that a deliberate change, or did it just inadvertent?

1 Like

We can’t have stuff at the root – sorry! It needs to stay in the subfolders.

1 Like

This is great. I remember when these books were new and I didn’t yet have a computer so I bought books and learned BASIC before I could afford a computer. I actually have a copy of the More book that is in excellent condition. Not sure if I have the first book or not. These books really were exciting at the time.

2 Likes

I’ve been thinking about doing something similar for the 1980s Usborne computer books, especially the longer programs like Write Your Own Fantasy Games’ “Dungeon of Doom” roguelike and the text adventures in Write Your Own Adventure Programs, The Mystery of Silver Mountain and Island of Secrets. The Usborne programs are less constrained, sometimes taking advantage of '80s-micro sound and graphics where the original Ahl collection seems to be limited to tty interface, and sometimes using more memory or even cassette-tape multiloads. (Which obviously brings both advantages and disadvantages.) The visual presentation and storytelling in the original Usborne books is very engaging.

2 Likes

It should be added, though, that the book and the programs weren’t originally for microcomputers. (Which is why there was a later Microcomputer Edition, after all.) The programs were written for, and on, timesharing systems with teletype UIs like the original Dartmouth BASIC machine and the many other microcomputers which ended up running a BASIC port. In fact my hunch is that it was this already-existing library of fun, understandable and reasonably short programs which made BASIC support a must for the Altair 8800 and its early imitators.

2 Likes

So the plan is to create at least 8x96 implementations of the original games, written by possibly as many people in as many styles? And one of the goals is to stay as true as possible to the original input, output and gameplay?

I’d say that this calls for an official test harness. Given that these are terminal games it should be possible to hook stdin and stdout up to a game runner. The verification could be generated by actually playing the original game.

Just an idea.

2 Likes

That’s right, and it is covered in the wikipedia entry for the book!

The timeline was truly a pivotal moment in computing history:

  • 1971 – Ahl ports the programs from FOCAL to BASIC
  • 1973 – 101 BASIC Computer Games :notebook_with_decorative_cover: is first published by DEC
  • 1974 – Ahl founds Creative Computing magazine and acquires the rights to the book from DEC
  • 1977 – the “trinity” of Apple II :desktop_computer:, PET :desktop_computer:, and TRS-80 :desktop_computer: microcomputers are released to the public, all with BASIC built in, at prices regular people could mostly afford :raised_hands:
  • 1978 – second edition of BASIC Computer Games is released, this time published by Ahl himself.

As you can see, there’s no way average people in 1973-1976 were doing a whole lot with BASIC programs, as they had no microcomputers capable of running BASIC to buy!

2 Likes

I thought about that but whoo boy that’s a big chunk of effort. I think we have to figure this out as we go, and refactor along the way.

Example: the JavaScript ports need a standardized way to provide console output per the GitHub issue.

(I’m also pretty sure there are bugs in these programs, so that’s another question, do we fix the bugs or preserve them?)

1 Like

Hi, I’m Al Sweigart, the author of Automate the Boring Stuff. My next book is The Big Book of Small Python Projects from No Starch Press, and it covers exactly this concept: small, text-based games that offer examples of complete programs (not code snippets) for beginner programmers. I have a collection of over 100 games/animations/science demos in this repo: GitHub - asweigart/gamesbyexample: A collection of text-based games in Python and other languages.

You can play them by running pip install gamesbyexample and python -m gamesbyexample to run the launcher program.

I started on this three years ago, and the style of the programs are 1) short (under 256 lines, as an arbitrary limit) s2) text only (so that readers can link cause-effect between the print() calls and the text that appears on the screen 3) requires no additional libraries outside the standard library 4) fits in one source code file for easy copy-pasting, along with some other guidelines.

My main fear is that I’m just old, and I’m mistaking the nostalgia of how I learned to program for good pedagogy in modern times (this is a mistake the One Laptop Per Child project made). But I figure this might be a good start for beginners who want to see what programs “look like”. I already have JavaScript, Java, C#, Kotlin, and Go versions also planned. The books, like all of mine, will be released under Creative Commons licenses. The first book should be out in a few months.

Also, the book Tiny Python Projects also follows the same pattern as Basic Computer Games and is out right now.

4 Likes