{"id":20828796,"url":"https://github.com/perty/supertrek","last_synced_at":"2026-04-24T10:33:34.138Z","repository":{"id":59015957,"uuid":"524620287","full_name":"perty/supertrek","owner":"perty","description":"Straight off translating by typing from a printed book. Microsoft Basic to Java.","archived":false,"fork":false,"pushed_at":"2022-09-23T15:34:39.000Z","size":144,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-12-26T21:52:52.134Z","etag":null,"topics":["basic","retrogaming"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/perty.png","metadata":{"files":{"readme":"ReadMe.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-08-14T08:59:37.000Z","updated_at":"2022-08-25T14:25:46.000Z","dependencies_parsed_at":"2023-01-18T20:46:00.036Z","dependency_job_id":null,"html_url":"https://github.com/perty/supertrek","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/perty/supertrek","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/perty%2Fsupertrek","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/perty%2Fsupertrek/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/perty%2Fsupertrek/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/perty%2Fsupertrek/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/perty","download_url":"https://codeload.github.com/perty/supertrek/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/perty%2Fsupertrek/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32219105,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-24T10:26:35.452Z","status":"ssl_error","status_checked_at":"2026-04-24T10:25:27.643Z","response_time":64,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["basic","retrogaming"],"created_at":"2024-11-17T23:18:27.868Z","updated_at":"2026-04-24T10:33:34.108Z","avatar_url":"https://github.com/perty.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Super Trek\n\n## Background\n\nDuring the 70's computer did not have much memory and there were typically no other user interface than a TTY or CRT with 24 lines of 80 characters.\n\nStill, games where made. \n\nThe programs were, as the way things were before diskettes accompanied books, printed listings of Basic code. So to play the game, you simply typed the program on your home computer and saved it to a cassette tape. It was open source but more than a click away.\n\nWhen I found a book \"Basic computer games\" containing \"101 great games to play on your home computer\", nostalgia kicked in.\n\nThis game was inspired by the TV-series Star Trek and crossed my path in the early 80's. This version is from 1978.\n\n## Project\n\nMy idea was to do the same as back in the days and type it in but translate it to Java. I do not have a Basic interpreter and even if I had one, it would probably be of a different dialect.\n\n### Basic language\n\nBasic was the language of the home computers. It is an interpreted language that was designed to be easy to learn. It was also designed to be used on TTY. To edit a statement, you entered its line number and typed the statement. That is why a typically Basic program has line numbers that are 10, 20 and then 30 since you\nwanted to be able to insert lines between 10 and 20. (There was often a renumber function to use when you had inserted too many lines).\n\nVariables in Basic are a letter and an optional number. Yes, two characters! They are also global even if there is a subroutine concept. The type is either a number or a string, the latter is indicated by a dollar sign after the name.\n\nThe global variables has an effect on subroutines. Whenever a subroutine is called, it may change global variabels. In fact, since there is no parameter concept, so to pass values to a subroutine, a number of variabels need to be set.\n\nFor example, to see if a specific position has some value, the string variable A$ is set to the value while Z1 and Z2 describe the position.\n\nArrays are also possible in most dialects. Although a number may not necessarily be integer, it can be used to index an array.\n\nArray indexes starts at 1, more human but everywhere else it is 0.\n\nA common pattern with conditional statement is using a goto statement to skip the next few statements. Which becomes a challenge when writing in a modern language where instead you say that during the condition, execute the next few statements.\n\n### Challenges\n\nThe code was printed using some printer terminal and then somehow put in the book. So the reading was not straight forward. It was hard to see the difference between an \"1\" and a \"I\", for example.\nThe \"Q\" character I have mistaken for \"O\" sometimes.\n\nI have tried using OCR, it helps for messages but not for code.\n\nVariable names can not be more than two characters so descriptive names are not possible. Added to that, the author did not write comments on what they are used for, in most cases. \n\nThe flow of the program can be hard to follow at times. There are no boundaries between parts of the program other than the sparse comments the author provided. Sometimes the flow jumps back to a line earlier in the program. Is it a loop? \n\nMany calculations are hard to understand partly to naming of variables and partly lack of documentation. It is also core of the game logic, so it is essential to get right.\n\nSince there is no way to express complex values in other ways than arrays, workarounds has to be used. For example, the state of the quadrant is represented as a string where three characters represents content in a position. Content being empty space, a star, starbase, the Enterprise or a Klingon.\n\nThere are functions that takes parameters, like `MID$` which extracts a substring but those are all system defined. It is not always clear what they do, exactly. Does `INT` do the same as `Math.round` in Java?\n\nCorrectness will also be a challenge, if I have the stamina to type it all in. If it seems to work, is it as intended?\n\nUpdate: I had the stamina, it turned out, but there are of course issues. It is interesting to see how different programming has become. Today, nobody would put the number of enemies in a variable and all the enemies positions in another place. As of now, when ironed out enough to play the game, the number of enemies left to kill is more than the number of existing enemies. An impossible task. Turned out to be a bug when loosing and volunteering for a new mission.\n\n### Bugs and like\n\nThe Basic code is well tested by playing and I believe no true bugs are there.\n\nHowever, bugs are created in the translation so that takes extensive testing to find out. Since I don't remember much about how to play and never known the inner workings, it is a challenge.\n\nI have discovered some minor things when using subroutines that will probably not cause any errors. \n\nDiscovered however code that is weird. The damage repair is not available unless the damage control itself is damaged. There is also a check that at least one device is damaged, which will always be true. So that has to change.\n\n### Testing\n\nNow that I have got it to work somewhat, I need to start testing more extensively. I am thinking that the random number generator could get a seed so that the same game is played each time. Also, a feature that would be nice is a log of events. Can be used in verifying but perhaps also entertaining. \n\n### Ultimate goal\n\nThe ultimate goal would be to put this online for others to enjoy and get a glimpse of what playing a game would be like back then.\n\n## A new beginning\n\nI discovered that there are other people out there who has this sentiment for these retro games. Actually, the whole book I mentioned has been ported to Vintage Basic. All the programs run in the browser and have been translated to different languages. This game, Super trek, is no exception and has a Java implementation. The author even made a video about the process. He did however, not take it the whole way to well styled Java program, in my opinion. I suspect that there are bugs, I have not verified it fully.\n\nThe last thing led to an idea, let's define the game in Gherkin (BDD) and use Cucumber to execute the specification. \n\nThe repository for all games : [https://github.com/coding-horror/basic-computer-games](https://github.com/coding-horror/basic-computer-games)\n\nAnother thing, I started is a port to Elm. The challenge is that original program picks up a random number whenever it is needed. In Elm, getting a random number is a side effect which must be requested in a callback fashion. It takes a while to get used to. \n\nSo given that there is a Gherkin specification for the game, I would like to use that with Elm, but I need to find a tool for that. Maybe create one myself.\n\nChecking out [elm-spec](https://package.elm-lang.org/packages/brian-watkins/elm-spec/latest/) which claims to support BDD. It has a different philosophy, though, the specification is written in Elm with the fixture code in the same file. A possible solution would be to translate Gherkin to elm-spec.\n\nChecking out [elm-test-bdd-style](https://package.elm-lang.org/packages/rogeriochaves/elm-test-bdd-style/latest/) which is more of syntactic sugar on top of elm-test. \n\nHow does elm-test really work? It manages to run elm code at least. If I could rely on elm-test, that would feel stable. So an approach could be to do a manual translation of Gherkin -\u003e elm-test and then take it from there.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fperty%2Fsupertrek","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fperty%2Fsupertrek","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fperty%2Fsupertrek/lists"}