DEV Community

JoeStrout
JoeStrout

Posted on

100 BASIC Computer Games, Ported to MiniScript

Jeff Atwood started a project in 2021 to update and convert about 100 BASIC computer programs from the classic book, BASIC Computer Games. A team of volunteers began porting these programs to a variety of more modern computer languages. The goal is to preserve these important artifacts of computing history, and make them accessible in modern times as living programs you can play with, hands-on.

We in the MiniScript community joined the fun earlier this year. I am proud to say that that project is finished: every BASIC computer program in the archive has been ported to MiniScript! You'll find our ports in the official repo in each subfolder under the 00_Alternate_Languages folder.

But to make it even easier to try out these old classics, I've gathered them together in a Mini Micro virtual machine, with a handy little menu!

screen shot of BASIC Computer Games menu

How to Play the Games

Just point your desktop web browser to:

https://joestrout.itch.io/basic-computer-games

...and you should see the menu pictured above. Enter the number of any program on the list, and you'll see the contents of the README file for that project (which generally mirrors what appeared in the original Creative Computing magazine along with the program).

Screen shot of README info for program 83, Stock Market

At that point, you can press R to run the program, or any other key to return to the main menu.

When a program completes, you should be prompted to press any key to go back to the menu. But if something breaks, and you find yourself staring at a blinking rectangular cursor next to a square-bracket prompt character, then just type menu to return to the list of games. Similarly, if you decide to bail out in the middle of a game, press Control-C to break out of it, and then type menu.

Peeking Under the Hood

Curious what the code looks like for any of these programs? That's great! Run the program, and then break out of it with Control-C. Then simply type edit to open the code editor. Examine the code all you like — maybe even dare to change something! — and then click the round "Close & Run" button to run it again.

When done poking at the code, either let it run to the end, or use the menu command to go back to the menu.

Building on These Foundations

The entertainment value of these old programs varies greatly — some are quite fun, while others, not so much. In many cases, though, the chief obstacle to fun is not the concept or code, but the limitations of a text-based interface that was all they had available back in the day.

This presents a great opportunity for some coding fun! You could start with the current port, and improve the UI using the mouse and graphics support available in Mini Micro.

For example, take program 26, "Chomp". This is a fun little puzzle, like the classic take-away matchsticks game but in two dimensions. However, on every move you've got to enter your coordinates numerically; wouldn't it be better if you could just click where you want to go?

screen shot of game 26, "Chomp"

Many of the other games are even worse; in some cases the game board scrolls off the top of the screen, but you are still expected to enter coordinates based on it, which is a real pain. Any of these could be dramatically improved with a little Mini Micro TLC.

If you do improve any of these games, let me know! I'd love to see what you do.

Top comments (4)

Collapse
 
sebnozzi profile image
Sebastian Nozzi

For those looking for the source code, it's here:

github.com/JoeStrout/basic-games-i...

(taken from the itch.io page)

Collapse
 
sebnozzi profile image
Sebastian Nozzi

Wow, congrats! Was it a lot of working porting from BASIC to MiniScript? 100 games look like a lot of code!

Collapse
 
joestrout profile image
JoeStrout

Yes, it took months! The biggest challenge in most cases was untangling the original spaghetti code. BASIC, by the very nature of its flow control (direct jumps to a line number via GOTO or IF-THEN), tends to encourage spaghetti. Some programs were more tangled than others. On a few, I confess I cheated and relied heavily on previous ports to JavaScript, C#, or Python, whose authors had already untangled the mess.

Other than that, though, it was pretty simple — MiniScript has very similar support for text-based input and output, lists (for arrays), numeric operations like ^, and so on. So apart from flow control, the line-by-line translation was quite straightforward.

Collapse
 
sebnozzi profile image
Sebastian Nozzi

Making modern UI versions of some of these games ... seems like interesting fun projects ...