11 ms·
“BASIC Computer Games” code in modern languages
- mmastrac 3y agoWhat I'd really like to see are the multiplayer games from the original 101 BASIC Computer Games ported to the web. I was too young to understand how those worked as a kid, and my dad's copy had some printing issues (occasional pages have white streaks across it). EDIT: To clarify BASIC Computer Games != 101 BASIC Computer Games (the original has more than the microcomputer version including CANAM and DOGS) This is a later printing than what I have -- http://www.bitsavers.org/pdf/dec/_Books/101_BASIC_Computer_Games_Mar75.pdf http://www.bitsavers.org/pdf/dec/_Books/101_BASIC_Computer_G...
- dspillett 3y agoThere are copies of the book on eBay, so it is available if you want a better copy to work from yourself. A quick search finds copies on archive.org too, though you might have to check a few to find a good one (the one I just opened wasn't a very clear scan, the code was not particularly easy to read due to being a low-res scan of already low-quality text). -- EDIT: having looked at the repository, it is reimplementing the games from that book in various languages, including javascript hosted in a web page, so for a direct translation it is exactly what you are looking for. If you want the multi-player ones to be playable between remote players, you still have some work to do!
- sbuttgereit 3y agoThere's actually a PDF copy of the book linked in the readme of the GitHub repo that the post is about. https://annarchive.com/files/Basic_Computer_Games_Microcomputer_Edition.pdf https://annarchive.com/files/Basic_Computer_Games_Microcompu... also there's a link that has web based running versions of the game: https://troypress.com/wp-content/uploads/user/js-basic/index.html https://troypress.com/wp-content/uploads/user/js-basic/index...
- eesmith 3y agoThis is exactly that. % git clone https://github.com/coding-horror/basic-computer-games.git Cloning into 'basic-computer-games'... remote: Enumerating objects: 23002, done. remote: Counting objects: 100% (1191/1191), done. remote: Compressing objects: 100% (542/542), done. remote: Total 23002 (delta 645), reused 1083 (delta 633), pack-reused 21811 Receiving objects: 100% (23002/23002), 76.04 MiB | 5.75 MiB/s, done. Resolving deltas: 100% (11501/11501), done. % cd basic-computer-games then open "index.html" in your browser. This lets you browse the games and play them. Or, for a web server experience, in that directory: % python -m http.server then go to http://localhost:8000/ http://localhost:8000/ .
- mmastrac 3y agoBASIC Computer Games != 101 BASIC Computer Games, the latter of which had some programs that were designed to work on time-sharing/mainframes. https://en.wikipedia.org/wiki/BASIC_Computer_Games https://en.wikipedia.org/wiki/BASIC_Computer_Games
- eesmith 3y agoThank you for the correction!
- mmastrac 3y agoThanks for the heads up on the web-capable versions of the other games. That's pretty cool indeed. I hope someone takes on the few missing multiplayer games from the DEC version at some point but figuring out how to port them is going to be a lot of work!
- dspillett 3y agoI wasn't aware there was a difference, I mainly just remember the copy of the book I had all those years ago and incorrectly assumed all the content was ported from the original. Maybe you could cheat: there are a fair few emulators of that era of machines that you can SSH into, drop the code into one of those and run as originally intended! Or access via the web by hooking shellinabox up to connect to the emulator's console. You'd need to add some layer of authentication if making this available on the public internet for friends to access though. Might be easier to setup than actually porting that old “minified” code (with single-character variable names, GOTO-a-plenty, & minimal comments) and implementing something to manage multi-user access to the same game instance.
- jj999 3y agoIf I translate a copyrighted work into another language is the translated work under copyright?
- ptspts 3y agoI am not a lawyer. I think the translation is considered derivative work under copyright.
- voakbasda 3y agoIANAL, but my understanding is "yes, that would be considered a derived work". Of course, it really only matters if you expect to end up in court over it. Translating ancient programs like this are unlikely to trigger a legal case, but I would not rule it out entirely in this day and age.
- dragonwriter 3y agoYes. If it is sufficiently original to be a distinct work (most human translations will be), it is a derivative work with its own copyright; if it is, e.g., a purely mechanical translation, it is covered by the copyright on the original. In either case, without permission or a copyright exception (e.g., fair use) it is also a violation of the original copyright, either as a derivative work or a copy.
- dcminter 3y agoIn this case, however, the original author is not enforcing their copyright: https://blog.adafruit.com/2022/06/16/david-ahl-places-all-his-classic-computing-publications-into-the-public-domain/ https://blog.adafruit.com/2022/06/16/david-ahl-places-all-hi...
- sbuttgereit 3y agoAh yes. One of the things I'll do when I'm learning a new computer language is pull out my now ancient copy of the 1973 edition of the book and just convert one of these games to the new language. The conversion might not look very much like the original when I'm done, but it is functionally equivalent. What I like about the approach is that the games in the book are small enough problems to solve as not really to be a major undertaking while being complex enough to be interesting.... and, of course, nostalgia. Way back when copying these games from the book into a VIC-20 and C-64, along with a healthy dose of the 80's era computer magazine programs, were my introduction to programming. Having to convert between BASIC versions was part of the learning experience.
- swayvil 3y agoI'll bet the new code is bigger than the old code.
- jnellis 3y agoFor the most part it is! I contributed to this project last year or so. The goal was to make the ports as one file runnable equivalents and not get all enterprisey but you can see (mainly C#) that some people can't shake the habit. There was also a lot of "we need a framework for running the programs", "we need a framework for testing", and "we need a linting and style compliance" efforts. If you don't know BASIC then you'll have a hard time following the spaghetti code that the original book has. Probably half of the BASIC programs from the original book are either actually broken, have bugs or don't work as intended. Of the people that contributed, they either included the bugs and bad logic, ported from someone else's port in another language (that included new bugs and kept the old ones) or wrote a different game entirely. To create a truly verbatim port in as many lines as the original while fixing the original bugs (and making it readable) is quite time consuming.
- kwertyoowiyop 3y agoInteresting point that replicating all the logic of spaghetti code can take a lot more lines than the original. Still, some of the op-ified code I just read seems unnecessary.
- firesteelrain 3y agoYour Lua implementations are pretty decent. I was just learning Lua last year while reviewing your implementations.
- jnellis 3y agoMe too! Those were my first and only Lua programs actually.
- jboy55 3y agoLooking at the C# poker, it amuses me that you end up closer to Enterprise FizzBuzz(1) than the basic game. (1) https://github.com/EnterpriseQualityCoding/FizzBuzzEnterpriseEdition https://github.com/EnterpriseQualityCoding/FizzBuzzEnterpris...
- russnewcomer 3y agoThe library in the city near where I grew up had some variant of this book in it. Unfortunately, the variant of BASIC was something that didn't compile on the 286 my parents had purchased and either I didn't ask or they couldn't help me at age ~5/6 to get around the compiler errors, and I thought I wasn't smart enough to be a programmer for about 8 years. Then I got into the mid-wave mod scene in 1998, and I realized I had the wrong compiler, but man, I just thought I couldn't follow directions right.
- n6h6 3y agothat's sad :(
- daneel_w 3y agoSomewhat related trivia: Sid Meier's Pirates! for the Commodore 64 is written mostly in BASIC, coupled with assembly for parts requiring snappier performance (for example the full-screen scrolling while sailing).
- the_af 3y agoI still cannot wrap my head around this. I was schooled about this fact by one of the C64 experts who frequent HN, and I'm still amazed. C64 BASIC was terrible even for its time. Due to licensing issues, its capabilities lagged behind those of other BASICs from home computers of the same era. Everything cool you could do with it was basically cheating: PEEK and POKE. As a child, this frustrated me to no end. Even my friend with his Speccy had access to a better BASIC. And still... Pirates! was made with Commodore BASIC.
- daneel_w 3y agoC-64 BASIC V2 has all of the same important fundamentals that other BASICs of that era had. What mainly set it aside was the lack of dedicated graphical functions. What was available on the other home computers was on one hand too slow (or too limited) to be useful for pretty much any type of game development - forcing those platforms, too, to "cheat" by interacting with the hardware by POKEing around - but on the other hand fun and educational to explore graphics programming with. The exception would be the very capable BASIC of the Sharp MZ-700 which was of an entirely different class. For the C-64 there were plenty of third-party options.
- the_af 3y agoWell, the C64 itself was a capable machine, so it's no surprise extensions to BASIC had cool capabilities. The issue is that the provided BASIC sucked, no if or buts about it. I remember missing a simple LOCATE statement for placing text (text! not even graphics) that the Speccy's BASIC had, if I remember correctly. To me, missing dedicated graphical functions (or cool text functions like LOCATE) was a big miss precisely because the C64 was a multimedia computer. As a kid I wanted to do cool stuff with my C64 and had to resort to obscure (to me) POKE commands. "POKE" is not really BASIC, it's a cheat. I remember when I finally got my PC-XT clone, loaded with GW-BASIC. It had a DRAW statement! I could draw pixels with easy to understand commands, no POKE! My mind was blown. I could even forget I was using a monochrome CRT... I wouldn't get my colors back until a few years later.
- davidrupp 3y agoI learned a lot about programming by taking a book like this that was written specifically for the TRS-80 (which I did not own), and translating the programs to what I owned instead, which was a Sinclair ZX80. This primarily involved translating between different flavors of BASIC, but also deciding what I could arrange to leave out and still have an interesting game, due to the relatively constrained resources of my machine. Excellent experience.
- martincmartin 3y agoI learned a lot about programming by taking this book and, since I didn't own a computer, figuring out how the code could produce the example listing. That's where I learned things like, to swap the values of two variables, you copy one to a third variable temporarily. I learned a ton of patterns like that. Eventually I got my VIC-20, then an Apple ][, then an Amiga.
- firesteelrain 3y agoI contributed to a few of these last year because I wanted to learn a new language. These programs are hard to translate if they are sufficiently large. One way to cheat is to look at someone else's translation to a familiar language like Python then make your translation from there. The problem like that, as someone mentioned elsewhere, is that if you are not careful then you are copying over their bugs blindly (in addition to the original program bugs). We were encouraged as part of the project to try to stay true to the original design. I did add in some error handling. I also found bugs in the python decomposition of a few of them (I don't remember which one's and didn't have the time to fix them).
- kgr 3y agoI wrote a BASIC to JS compiler/transpiler that includes all of the programs from "BASIC Computer Games" as examples. You can try it out in your browser at: https://codepen.io/kgr/full/yLQyLjR https://codepen.io/kgr/full/yLQyLjR Just select the game you want to to run from the top-left list box, then press the "Compile" button and you'll see the translated JS source in the right text-area. Then press the "Run" button to run it. The source code for the compiler is available at: https://github.com/kgrgreer/foam3/tree/429f2fd2b4cef0e37996a4c4ad35cdf5f83a8b97/src/foam/demos/basic https://github.com/kgrgreer/foam3/tree/429f2fd2b4cef0e37996a...
- baudaux 3y agoYou can play Basic games using exaequos.com: bwbasic /usr/games/basic/animal.bas for example
- dang 3y agoRelated. (I thought I saw another one recently but couldn't find it...) Play Basic Computer Games in the Browser - https://news.ycombinator.com/item?id=34377776 https://news.ycombinator.com/item?id=34377776 - Jan 2023 (1 comment) Basic Computer Games (1978) - https://news.ycombinator.com/item?id=28572761 https://news.ycombinator.com/item?id=28572761 - Sept 2021 (12 comments) Updating “101 Basic Computer Games” for 2021 - https://news.ycombinator.com/item?id=26273866 https://news.ycombinator.com/item?id=26273866 - Feb 2021 (65 comments) Basic Computer Games (ported to C#, Java, JavaScript, Python, Ruby, VB.NET) - https://news.ycombinator.com/item?id=26188324 https://news.ycombinator.com/item?id=26188324 - Feb 2021 (3 comments) BASIC Computer Games - https://news.ycombinator.com/item?id=19604142 https://news.ycombinator.com/item?id=19604142 - April 2019 (120 comments) BASIC Computer Games (1978) - https://news.ycombinator.com/item?id=9026063 https://news.ycombinator.com/item?id=9026063 - Feb 2015 (31 comments) Atari Archives: BASIC Computer Games - https://news.ycombinator.com/item?id=3200133 https://news.ycombinator.com/item?id=3200133 - Nov 2011 (23 comments) BASIC Computer Games Book, published in 1978 - https://news.ycombinator.com/item?id=1866103 https://news.ycombinator.com/item?id=1866103 - Nov 2010 (36 comments)
- JohnFen 3y agoI love the idea of the programs in that book being used as the basis for a kind of Rosetta Stone.
- progmetaldev 3y agoI remember "graduating" from Atari 8-bit BASIC to QBasic on an i386, and being blown away at how much more you could do, including switching graphics modes. I know a lot of people like to say that BASIC teaches you bad coding habits, but I think it also got young minds hooked into programming. If you had a deep interest, you unlearned those bad habits, but still kept that love of writing software. I still wish I could go back in time and feel what it was like to first gain a grasp of seeing your code perform some task, right in front of you.
- martincmartin 3y ago"It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration." -- Edsger W. Dijkstra As someone who got their start with BASIC -- mainly from "BASIC Computer Games" no less -- I was always kind of offended at that quote.
- ianbicking 3y agoIt's a very Sapir-Whorf sentiment, that somehow we are infected by what we learn, unable to imagine outside of those formative experiences. And like Sapir-Whorf, also false!
- contingencies 3y agoSapir-Whorf in the conventionally conceived sense of language-as-local-limitation is clearly false, partly as it invalidates itself as an origin story. (How would you invent a language if you can't think outside of it?) Sapir-Whorf in the sense of language-as-influence however is clearly true, even if academics occasionally state otherwise, because at their core all languages used by communities of a size greater than one individual rely upon semantics that are socially dictated. Personally, perl screwed me up a lot more than BASIC - but who can argue with the expressive power of regex for text extraction and matching problems? Wikipedia has a fun excerpt featuring PG (and Ruby) on just this question https://en.wikipedia.org/wiki/Linguistic_relativity#Programming_languages https://en.wikipedia.org/wiki/Linguistic_relativity#Programm...
- jquast 3y agoI wrote a small script to load Hamurrabi.bas onto my Apple-1 replica over serial and to play against it interactively, as a sort of screensaver. Though I played this as a kid, I learned some interesting anti-mechanics by writing an "automatic player", that I can still get the highest rating by systemically starving 3% of the population each year, and that there is no need to leave any food in store for the successor after your final turn, and that losing half of the population to plague is actually in your favor.
- xen2xen1 3y agoWent to look on eBay for a copy, had one in my youth. Immediately crossed my mind to show it to my dad, who passed in 2020. Sad. That many memories. Oh my.
- DennisP 3y agoMy dad passed in late 2019. Not long after, I had a vivid dream in which I showed him a programming book I thought he'd like, then we browsed the computer section of a bookstore for what felt like a pleasant hour or so.
- JKCalhoun 3y agoThat is cool. I hope to wander bookstores with my daughters when I die.
- behringer 3y agoI'd just like to point out, there are modern BASIC compilers out there so you can still enjoy these books on a modern PC with modern tooling! Decimal BASIC is one such BASIC compiler that should be perfectly compatible with these types of books! http://hp.vector.co.jp/authors/VA008683/english/ http://hp.vector.co.jp/authors/VA008683/english/ If you love BASIC of all variations, come join us on discord at https://discord.gg/HQaDgJvbbJ https://discord.gg/HQaDgJvbbJ
- deleted 3y ago[deleted]
- markstos 3y agoI had a book like at that at age 10. I would spend what seemed liked hours typing them in to play the games… and usually there was a syntax error and they wouldn’t work, and often I couldn’t fix them. But I was fascinated and kept trying. The games I got to work were that much more rewarding!
- tkb 3y agoJeff Atwood had a piece in his "Coding Horror" blog about this project: https://blog.codinghorror.com/updating-the-single-most-influential-book-of-the-basic-era/ https://blog.codinghorror.com/updating-the-single-most-influ... (Personally I grew up on the British early 1980s Usborne BASIC programming books, now wonderfully available at https://usborne.com/gb/books/computer-and-coding-books https://usborne.com/gb/books/computer-and-coding-books . My copy of "Computer Battlegames" - which I'd arbitrarily picked in the bookshop over "Computer Spacegames" - was the closest to the classic "BASIC Computer Games", which I never came across - not sure if it was more a US thing.)
- bitwize 3y agoAhl's collection is more diverse: it has battle games, board games, sports simulations, economic simulations, even rudimentary demoeffects ("Sine Wave"). One of the variants of the Football (American football) game called "FTBALL" is particularly intriguing; you will notice that the playable team is Dartmouth. This game is traceable back to Dartmouth College, where and when BASIC was first developed by Kemeny and Kurtz. It was, as I recall, originally written by members of the Dartmouth football team as a way to have a bit of fun. The idea that someone who wasn't a scientist, engineer, or professional programmer could program a computer to some non-tech, non-business purpose was a huge mind blow at the time, and a major contributor to BASIC's enduring popularity.
- codeguppy 3y agoI love the old Usborne BASIC books... and the old type-in BASIC program books. I have in my collection a few of those. I love the work of Jeff on converting those old games to JavaScript. As I mentioned, I'm also impressed by the old Usborne books, therefore I also tried recently to create an illustrated JavaScript course in that style ... See here the first 30%: https://codeguppy.com/site/download/coding_course.pdf https://codeguppy.com/site/download/coding_course.pdf
- 7thaccount 3y agoIt is weird to see Java listed as a "scripting language". Although these are all very loose definitions, I'd assume Python, Lua, Tcl, Perl, Ruby, Basic...etc as scripting languages.
- deleted 3y ago[deleted]
- chinabot 3y agoJust thought I would add that Modern != Better. You can still write shite in 'modern' languages and a well written program is that regardless of its language
- schemescape 3y agoAny recommendations for games to play from the list? Edit: The game titled "Word" is very similar to Wordle.
- vunderba 3y agoI'm always happy to see more BASIC promotion. I just love the nostalgia from being able to make my old 386 make a sound by just typing BEEP. When Sean Astin used a variant of BASIC to crack a security door in the second season of Stranger Things, I even wrote a blog post about it. I was just so excited to see BASIC again "in the wild."
- shagie 3y agohttps://github.com/timdetering/BaconBytes.StarTrek https://github.com/timdetering/BaconBytes.StarTrek takes it in a different direction. 2950 PRINT "TORPEDO TRACK:" 2960 LET X=X+X[1] 2970 LET Y=Y+X[2] 2980 IF X<.5 OR X >= 8.5 OR Y<.5 OR Y >= 8.5 THEN 3420 2990 LET V[4]=X 2991 LET V[5]=Y 2992 GOSUB 9000 Becomes... _2950: Console.WriteLine("TORPEDO TRACK:"); _2960: X = X + _X[1]; _2970: Y = Y + _X[2]; _2980: if (X < .5 || X >= 8.5 || Y < .5 || Y >= 8.5) goto _3420; _2990: _V[4] = X; _2991: _V[5] = Y; _2992: _9000();
- hnthrowaway0315 3y agoAh, this is really good. I'm thinking about teaching Python with a focus on game programming for my friend's son and my own son (in perhaps 6-8 years). I think it could be pretty fun to dump a Raspberry Pi 8GB (with all software installed) and a keyboard in front of him and start programming small games. I'm sure there is a way to use game programming to teach from scratch. I just need to find an introduction book and adapt it with game programming examples. But one issue is that kids today are getting used to things like Roblox so I'm not sure whether they would enjoy programming simpler games. I think a "graduating" project could be an Ultima-I spinoff, or some 2.5d engine such as Wolf3D's, but simpler.
- deleted 3y ago[deleted]
- anta40 3y agoFor the sake of fun, I setup a Debian VM and installed the latest FreeBASIC. Testing a few files, and it choked. E.g when compiling http://www.vintage-basic.net/bcg/amazing.bas http://www.vintage-basic.net/bcg/amazing.bas, I got these errors: - Duplicated definition - Array not dimensioned Not versed with older BASICs which predated QB, so probably I'll try the modern implementations instead.
- pjmlp 3y agoThe tragic irony that Visual Basic is the language with less conversions from those BASIC games.
- drallison 3y agoThe People's Computer Company published many BASIC games in its publications (PCC Newspaper, People's Computers, Dr. Dobbs Journal, Recreational Computing) and in the book, What to Do After You Hit Return: Or, P.C.C.'s First Book of Computer Games. Many of the games were reprinted elsewhere, often without attribution.
- wduquette 3y ago101 BASIC Computer Games (the original book, published by DEC) is literally how I learned to program back in the mid-70's, on a small PDP-11 sold as a kit by HeathKit that my dad built. (Paper tape! Woohoo!)