Programming Super Star Trek in SwiftUI — A progress report . . .

David Ahl’s “Super Star Trek” program, originally written in BASIC, was one of the first major programs that many converted to run on the range of personal computers in the 1980s and then in other languages. The history is amply summarised on Wikipedia.

The challenge, alongside teaching myself to program apps to run on iOS in the Swift language, was to convert the original BASIC program, flaws and bugs included to run in iOS using the Swift language and, in particular, SwiftUI.

One of the more recent conversions is Emanuele Bolognesi’s program in the Perl language which is true, as far as it can be, to the original BASIC program. He subsequently reprogrammed it in the Lua language and improved some of the logic. Both implementations provide some insight into the problems in the original program in part due to the limitations of the BASIC language and the memory limitations of early personal computers where 16k bytes or less was often the main restriction. His analysis of the logic of the original BASIC program had been a great help in converting the BASIC into Swift.

There are a couple of “bugs” in the original BASIC listing in David Ahl’s “BASIC Computer Games” book. There are two lines in the program where a “0″ looks like a “2″ due to the poor definition of the original printed listing. These errors have been carried through to many of the published versions of the original BASIC listing (including the often used listing on Vintage BASIC website) but they have been corrected in my conversion.

To take advantage of the iOS interface, I have based the design on another iOS implementation. This is Dennis Nederlof’s “iVoyages” available from the Apple AppStore.

This is the main screen from my implementation in iOS and Swift on the iPad.

The buttons on the top row provide, on the left, identification of the program version and help, and on the right, game restart and engage buttons.

The middle part of the screen show the game’s progress in a scrolling display meant to mimic the teletype output of the original program.

The bottom row of buttons provide the game’s main controls. Left to right these are Navigation to route the Enterprise through the galaxy, a Short Range Scan of the quadrant in which the Enterprise is located, a Long Range Scan showing the contents of each immediately adjacent quadrant, two buttons controlling the ship’s weapons (Phasers and Photon Torpedoes), Damage Control to manage the inevitable failure of the ship’s components due to attack and travelling at warp speed, Shield Control to provide defence against attacking Klingons, a Computer to provide direction assistance and a map of the explored galaxy, and finally an option to Resign the current mission.

The implementation is not yet complete but the main screen display is working and good progress is being made with the ship’s main functions.

Leave a Reply

Your email address will not be published. Required fields are marked *