• Home
  • Our Books
  • Our Film
  • Games
  • About Us
  • Contact Us
  • Login

Perspectives on all eras of videogames, computers, technology, and pop culture since 2003

Login

Login
Armchair ArcadeArmchair Arcade
Armchair ArcadeArmchair Arcade
  • Home
  • Our Books
  • Our Film
  • Games
  • About Us
  • Contact Us
  • Login

ChatGPT – Using AI to Make a version of Star Trek in BASIC

Starship over an alien landscape with a space backdrop
ChatGPT - Using AI to Make a version of Star Trek in BASIC

ChatGPT – Using AI to Make a version of Star Trek in BASIC

December 29, 2022 Posted by Bill Loguidice Editorial No Comments

Star Trek-type strategy games, where you’re in command of the Enterprise, battle Klingons, and defend starbases on a map with limited resources, have been a staple of computers since the early 1970s, when all that was around were mainframes at universities and large businesses. There have been countless interpretations and variations ever since on every conceivable platform. It’s fun stuff, and as part of my own collection, I have quite a few boxed variations of such games, and certainly played with various BASIC language interpretations over the years.

In any case, what’s fascinating is that ChatGPT, an AI-like language model that produces text, is able to produce usable code for all types of programming languages, including classic BASIC, which was a staple of personal computers from the mid-1970s to mid-1990s. What’s most impressive is that not only can it generate one iteration of a program, but also keep iterating. For instance, here’s my first request, “Can you write a Star Trek game in BASIC?”:

10 REM Star Trek Game
20 REM by OpenAI Assistant
30 REM
40 REM Initialize variables
50 LET ship_energy = 1000
60 LET Klingons = 10
70 LET starbases = 5
80 REM
90 PRINT "Welcome to the Star Trek game!"
110 PRINT "You are in command of the USS Enterprise."
120 PRINT "Your mission is to destroy all Klingons in the galaxy."
130 PRINT "You have 1000 units of energy and 5 starbases to help you."
140 PRINT "Good luck, captain!"
150 PRINT
160 REM Main game loop
170 DO
180 PRINT "Enterprise status:"
190 PRINT "Energy: ";ship_energy
200 PRINT "Klingons remaining: ";Klingons
210 PRINT "Starbases remaining: ";starbases
220 PRINT
230 PRINT "What do you want to do?"
240 PRINT "1. Attack Klingons"
250 PRINT "2. Repair at a starbase"
260 INPUT "Enter your choice: ", choice
270 SELECT choice
280 CASE 1
290 PRINT "Enterprise attacks Klingons!"
300 LET ship_energy = ship_energy - 100
310 LET Klingons = Klingons - 1
320 PRINT "Energy remaining: ";ship_energy
330 PRINT "Klingons remaining: ";Klingons
340 CASE 2
350 PRINT "Enterprise docks at a starbase for repair."
360 LET ship_energy = 1000
370 LET starbases = starbases - 1
380 PRINT "Energy restored to 1000 units."
390 PRINT "Starbases remaining: ";starbases
400 END SELECT
410 LOOP UNTIL Klingons = 0
420 PRINT "Congratulations, captain! You have destroyed all Klingons in the galaxy."
430 END

ChatGPT describes the result:

This game uses a simple loop to allow the player to make choices and update the game state. The player can either attack Klingons or repair at a starbase, and the game will update the energy and remaining Klingons and starbases accordingly. The game ends when the player destroys all Klingons.

ChatGPT
Star Trek (Commodore PET, 1978) screenshot
An unrelated example image of a Star Trek game from circa 1978 running on a Commodore PET

Good stuff, but rather simpler than a typical Star Trek-like game. My follow-up prompt, which ChatGPT ran with, was, “Can you make the game more complex?”:

10 REM Star Trek Game
20 REM by OpenAI Assistant
30 REM
40 REM Initialize variables
50 LET ship_energy = 1000
60 LET Klingons = 10
70 LET starbases = 5
80 LET galaxy_map = 5
90 REM
100 PRINT "Welcome to the Star Trek game!"
110 PRINT "You are in command of the USS Enterprise."
120 PRINT "Your mission is to destroy all Klingons in the galaxy."
130 PRINT "You have 1000 units of energy and 5 starbases to help you."
140 PRINT "Good luck, captain!"
150 PRINT
160 REM Main game loop
170 DO
180 PRINT "Enterprise status:"
190 PRINT "Energy: ";ship_energy
200 PRINT "Klingons remaining: ";Klingons
210 PRINT "Starbases remaining: ";starbases
220 PRINT "Galaxy map pieces: ";galaxy_map
230 PRINT
240 PRINT "What do you want to do?"
250 PRINT "1. Attack Klingons"
260 PRINT "2. Repair at a starbase"
270 PRINT "3. Search for galaxy map pieces"
280 INPUT "Enter your choice: ", choice
290 SELECT choice
300 CASE 1
310 PRINT "Enterprise attacks Klingons!"
320 LET attack_success = INT(RND(1)*2)
330 IF attack_success = 1 THEN
340 LET ship_energy = ship_energy - 100
350 LET Klingons = Klingons - 1
360 PRINT "Attack successful! Klingons remaining: ";Klingons
370 ELSE
380 PRINT "Attack failed!"
390 END IF
400 CASE 2
410 PRINT "Enterprise docks at a starbase for repair."
420 IF starbases = 0 THEN
430 PRINT "No starbases remaining. Cannot repair."
440 ELSE
450 LET ship_energy = 1000
460 LET starbases = starbases - 1
470 PRINT "Energy restored to 1000 units."
480 PRINT "Starbases remaining: ";starbases
490 END IF
500 CASE 3
510 PRINT "Enterprise searches for galaxy map pieces."
520 LET search_success = INT(RND(1)*2)
530 IF search_success = 1 THEN
540 LET galaxy_map = galaxy_map + 1
550 PRINT "Map piece found! Map pieces remaining: ";galaxy_map
560 ELSE
570 PRINT "Search unsuccessful."
580 END IF
590 END SELECT
600 LOOP UNTIL Klingons = 0 OR galaxy_map = 0
610 PRINT "Congratulations, captain! You have completed your mission."
620 END

ChatGPT again described the result:

This version of the game includes several new features:

  • The player can choose to search for galaxy map pieces in addition to attacking Klingons or repairing at a starbase.
  • The player has a chance of success when attacking Klingons or searching for map pieces, determined by a random number generator.
  • The player can only repair at a starbase if there are any remaining.
  • The game ends either when the player destroys all Klingons or runs out of galaxy map pieces.

I hope this more complex version of the game is to your liking! Let me know if you have any questions or if you’d like to see any further modifications.

– ChatGPT

Impressive stuff indeed. I haven’t tested it yet and suspect that at least a few modifications would be needed to run on nearly any version of BASIC, but as a time-saver, educational tool, or merely as inspiration, this is good stuff.

For clarification, I asked ChatGPT what version of BASIC this is based on:

The version of BASIC used in the examples I provided is a general-purpose dialect of BASIC that is commonly used on a variety of platforms. It includes common BASIC commands and features such as PRINT, INPUT, IF-THEN statements, and looping constructs.

BASIC (Beginners’ All-purpose Symbolic Instruction Code) is a high-level programming language that was developed in the mid-1960s and has since been widely used for a variety of purposes, including education, game development, and general-purpose programming. There have been many different versions and dialects of BASIC over the years, each with its own set of features and capabilities.

The examples I provided should be compatible with most versions of BASIC, although there may be some minor variations depending on the specific dialect being used. If you are using a specific version of BASIC and encounter any issues with the code, please let me know and I’ll be happy to help you troubleshoot the problem.

– ChatGPT

Related

Tags: aiartificial intelligencebasicmainframeprogrammingstar trek
No Comments
Share

About Bill Loguidice

Bill Loguidice is a Founder and Managing Director for Armchair Arcade, as well as a critically acclaimed technology author and journalist.  He is also the co-founder of creative services firm, Armchair Creative Services, and a noted videogame and computer historian and subject matter expert. See full bio

You also might be interested in

Severance Season 2 main cast image
Severance Season 2 (Apple TV+)

How Streaming Platforms Are Changing the Way We Experience New Films

Mar 14, 2025

The rise of streaming services like Netflix and HBO Max is reshaping entertainment, challenging traditional cable TV with popular streaming platforms and advanced recommendation engines.

How AI Is Set To Change Online Casino Gaming
How AI Is Set To Change Online Casino Gaming

How AI Is Set To Change Online Casino Gaming

Jun 12, 2018

In the latest entry in our continuing series on gambling[...]

Pay what you want for the Humble Book Bundle: Python by Packt!
Pay what you want for the Humble Book Bundle: Python by Packt!

Pay what you want for the Humble Book Bundle: Python by Packt!

Jan 2, 2018

The Humble Book Bundle: Python by Packt Here’s the link.[...]

Leave a CommentCancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Recent Posts

  • How has gaming evolved across the last decade and what is next?
  • Polymega Collections Volumes 9 and 10 now available – Strikers 1945, Bases Loaded, and more!
  • How The Legacy Of League Of Legends Paved The Way For eSports Betting
  • Tech Meets Design: What Is a Flexible Monitor and Why Gamers Should Care
  • Application of Strategic Thinking in Nomini Casino Games
  • DXRACER Partners with CS2 MESA Nomadic Masters Spring 2025 to Elevate Esports Comfort and Performance
  • Playing the Long Game: A Simple Guide to Casino Money Sense
  • Best Games to Bet on This Season
  • Retro Gamers, Modern Thrills: Why Instant Withdrawal Casinos Resonate with Arcade Fans
  • Pixels and Progress: How Retro Gaming Continues to Shape Modern Technology

Recent Comments

  • Aiodensghost on Official Game List for My Arcade Atari Gamestation Pro
  • keyboredom on Quick guide on how to play on the Internet Arcade
  • Bill Loguidice on Official Game List for My Arcade Atari Gamestation Pro
  • Melanie Levenstein on Official Game List for My Arcade Atari Gamestation Pro
  • George on How to Predict CS:GO/CS2 Skins Prices?
  • Bill Loguidice on Retro Games Ltd to release The Spectrum, fully working ZX Spectrum, and here’s the game list!
  • Derek on Retro Games Ltd to release The Spectrum, fully working ZX Spectrum, and here’s the game list!
  • Bill Loguidice on Retro Games Ltd to release The Spectrum, fully working ZX Spectrum, and here’s the game list!
  • Simon on Retro Games Ltd to release The Spectrum, fully working ZX Spectrum, and here’s the game list!
  • Viktor Špička on Retro Games Ltd to release The Spectrum, fully working ZX Spectrum, and here’s the game list!

Archives

Categories

Explore

android (46) apple (37) ar (37) Arcade (165) Atari (73) atgames (173) book (99) books (98) casino (496) esports (46) firmware (43) Flashback (45) gambling (520) Gaming (40) home arcade (114) htc vive (42) humble bundle (282) humble store (67) ios (37) led (35) legends (40) legends arcade family (46) legends gamer (33) legends pinball (39) legends ultimate (71) Microsoft (40) Nintendo (70) pc gamer (65) pc gaming (52) pinball (43) playstation (55) PS4 (36) retro (34) Sega (38) slots (82) sony (51) steam (145) switch (33) technology (35) update (42) virtual pinball (36) virtual reality (116) vive (34) viveport (42) vr (121)

Affiliates

+ Amazon

The everything store

+ Humble Bundle

Game deals, including name your price bundles

+ Playasia (Play-Asia.com)

Import games and collectibles

+ DJI Store

Amazing drones and related technology

+ Razer

Amazing PC gamer products!

fullSTEAMahead365 Your total news and information resource for all things Science, Technology, Engineering / Mathematics, Art, and Medicine / Health.

Human Advancement Never Stops.

Key Site Statistics

Posts published: 2,533
Latest publish date: May 6, 2025 @ 3:42 pm
Registered user count: 99,026

Contact Us

If you have a question, would like to provide feedback, or otherwise wish to get in touch with us, use this form.

Send Message

Blog Posts by Date

December 2022
M T W T F S S
 1234
567891011
12131415161718
19202122232425
262728293031  
« Nov   Jan »

Social Media and RSS

Support Armchair Arcade

All editorial content © 2003 - 2025 Armchair Arcade, Inc., an Armchair Creative Services, LLC, property. All rights reserved unless otherwise indicated. All trademarks and copyrights are retained by their respective owners. No content is to be removed or reused from the Armchair Arcade Website for commercial purposes without explicit permission from the principal Armchair Arcade staff, or the original trademark or copyright holders. Armchair Arcade, Inc., is not responsible for the content of any external sources or links. Further, endorsement of any external sources or links is neither implied nor suggested.

We thank you for your support and encourage you to contact us for any reason, including, but not limited to, questions, concerns, business endeavors, or praise. Especially praise.

Armchair Creative Services, LLC, may earn compensation for sales from links on posts through affiliate and other programs. Editorial rigor and objectivity standards are strictly adhered to and any compensation has no effect on coverage or opinions.

Prev Next