Recently a programming book called BASIC Computer Games (pdf) took my interest. An earlier variation of the book called 101 BASIC Computer Games (download) came out in 1973, which is a period before I was born. What has taken my interest has been the programming techniques used back then versus now.

basic-computer-games

My main interest was to try and experience the games using the modern programming language of JavaScript. In order to achieve that, I would need to also experience them as close as possible to an original experience on my modern computer.

My first challenge was to find a way to run the BASIC programming language on my modern computer. After typing up some of the code from the book I found that someone else has already typed in the code and made it available from the archive of BASIC Computer Games. So far as actually running the code, after exploring several options I went with PC-BASIC which provides an extremely faithful GW-BASIC emulator.

pcbasic

PC-BASIC – a faithful GW-BASIC emulator.

After placing the games in C:\Users\Paul\BCG\ (short for basic computer games), I was able to load and run them with

LOAD”BCG\AMAZING.BAS”
Ok
RUN

One minor problem I found is that some of the games wouldn’t run. Sometimes it was because the GW-BASIC interpreter didn’t understand a technique used in a different variation of the BASIC language. Other times it was as simple as that we no longer output the result directly to a printer, so we cannot refer back to content that appeared earlier. The greatest extent of the changes I made to the code as presented in the book has been to first get the code working, fix obvious spelling mistakes, and add a “Press any key to continue…” message to make up for the lack of direct-to-printer output.

Even though I’ve been keeping changes minimal, there have still been 24 changes required to the BASIC code, just to get everything working. Once all 101 games were working and play-tested, the real work began in finding a way to convert them over to the JavaScript programming language.

Someone else had made a start on a JavaScript conversion of three BASIC Games to JavaScript in 2015, but seems to have given up. He had done the first three of the games, but seems to have stopped when the next one got too difficult to convert.

That’s when I became struck with an the following epiphany:

It’s my turn to pick up the baton.

The next game that he stopped at is Awari, also known of as Mancala and Kalah. My attempts to convert this game taught me a lot, and gave me insight as to why the previous person had stopped here.

Advertisements