5 ms·
David Ahl's Basic Computer Games Ported to C
- PaulHoule 4mo agoThe version of that book I remember came out long before there was GW-BASIC, in fact, it came out just before there were microcomputers and you might type them into a PDP-8/10/11. I bought a copy at the DEC store in the Mall of New Hampshire circa 1980. Some of the games used features that were not supported on most microcomputer BASICs but you could type most of them into a TRS-80 or Apple ][ without changes and you could run all of them with minor modifications. Fun times!
- sbuttgereit 4mo agoYep. Ahl's book was first released in 1973... about 10 years before GW-BASIC.
- dlenski 4mo agoMy copy is at my parents’ house so I can't check the exact date now, but it's from the mid-to-late '80s and targets 8-bit home computer BASIC (e.g. Commodore 64) and IBM/Microsoft BASIC. So I presume there were several revisions or additions.
- leoc 4mo agoYes. As mentioned in https://github.com/maurymarkowitz/101-BASIC-Computer-Games https://github.com/maurymarkowitz/101-BASIC-Computer-Games the first, 1973 version targeting various minicomputer or large-system BASICs was entitled 101 BASIC Computer Games. The 1978 edition https://archive.org/details/basic-computer-games-microcomputer-edition_202211 https://archive.org/details/basic-computer-games-microcomput... , claiming compatibility with "Microsoft BASIC Version 3.0 or higher" and having various other chainges, is named BASIC Computer Games Microcomputer Edition. (One difference is that the game names in the old 1973 version all obey the classic six-letters-at-most, all-caps filename convention familiar from (non-BASIC) titles like EMACS, SHRDLU, ADVENT, and SCHEME.)
- PaulHoule 4mo agoThe PDP-11 under RSTS/E gave users a 64kb address space for code and another for data. Systems like the TRS-80 and the Apple ][ gave a "learn to code" experience that was similar and certainly inspired by the minicomputer experience: you didn't get as much RAM and some of the fancy features but you could so some graphics even if you had to PEEK and POKE. Very early microcomputer BASICs would fit in machines with 4k of RAM but as RAM became affordable almost all the machines evolved so you could fill out the whole address space. The IBM PC had a way user applications could address more than 64k that was half-baked because you were still stuck with 16 bit pointers, but practically I thought it was was really fun to write assembly programs that used the segments. I was thinking the other day how DEC's VAX died because the addressing modes (especially indirection) couldn't be implemented in a modern high-performance CPU and how the 64-bit Alpha came too late to stop VAX customers from leaving but way too early to attract general interest because hardly anyone could afford to fill out a 32-bit address space. Like Windows 95, NT and Linux were competing in 1995 and 32MB of RAM seemed like a lot then, it wasn't until the early 2000's that you could really afford more than 4GB...
- dlenski 4mo agoGot it, thanks. I believe that the version I have might be a later printing of the 1978 version, but actually the book I'm remembering most clearly was a later 1986 book by Ahl with a similar title of "Basic Computer Adventures" which has 10 longer adventure games… including an early version of Oregon trail. https://archive.org/details/basic_computer_adventures https://archive.org/details/basic_computer_adventures
- PaulHoule 4mo agoThere was this sequel too https://archive.org/details/More_BASIC_Computer_Games https://archive.org/details/More_BASIC_Computer_Games I don't think I ever saw source code for Oregon Trail As for text adventures those require fairly exotic programming techniques to pull off. Infocom had the Z machine interpreter written in assembly for many machines but Scott Adams made an interpreter which could be implemented in either BASIC or assembly.
- sbuttgereit 4mo agoThere were several editions. My copy (sitting on my bookshelf as I speak) was the '73 edition (though I think a later printing), but they did revise it including releasing it for the then prevalent home microcomputers. I first learned programming converting these things to run on my VIC-20 (and later C64). That earliest effort was prior to those later editions... and I'm kinda glad... I had to learn what different things actually meant and judge what was important and not.
- WillAdams 4mo agoOf all the books which I've thought need to be re-written as Literate Programs: http://literateprogramming.com/ http://literateprogramming.com/ These are at the top of the list.
- firesteelrain 4mo agoJeff Atwood (of Stack Overflow) started a similar effort a few years ago albeit in multiple programming languages. It was pre AI. I am sure AI would make short order of many of the conversions with very little tokens however that was never the point. https://github.com/coding-horror/basic-computer-games https://github.com/coding-horror/basic-computer-games
- 9NRtKyP4 4mo agoAnyone remember GORILLA.BAS and NIBBLES.BAS? I learnt to program by fiddling with these. https://en.wikipedia.org/wiki/Gorillas_(video_game) https://en.wikipedia.org/wiki/Gorillas_(video_game) https://en.wikipedia.org/wiki/Nibbles_(video_game) https://en.wikipedia.org/wiki/Nibbles_(video_game)
- HocusLocus 4mo agoI liked maze games with sprites and CHASE.bas (like later PAC-MAN) was a first glimpse of coded transactional survival, though you usually didn't survive long. Great terminal game as was GORILLAS.bas. For printers/fanfold paper BANNER.bas was a functional matrix font generator. They were the days of SNOOPY calendars on various RPG/COBOL/DartmothBASIC/FortranIV/77 platforms. This treasured Volume and the whole series https://archive.org/details/bestofcreativeco00ahld https://archive.org/details/bestofcreativeco00ahld was where a lot or it came together. Fun book and a Merry Prankster vibe from the Furry Freak Bros cover art, fun times for 13 year olds!
- ThrowawayR2 4mo ago> "These haven't been tested, validated, debugged, or verified! ... I used Google Anti-Gravity to convert the programs from GW-BASIC to 'C'" Doesn't seem like there's anything of interest here. It's just tossing existing code into a LLM.
- iamflimflam1 4mo agoShame really as it would have been relatively straightforward forward to build in an agent loop that actually tests the games.
- jhack 4mo agoWhich then gets tossed into a compiler and who knows what kind of code that thing spits out. That's why I only support projects written in assembly by real programmers.
- tuveson 4mo agoIf we accept the “LLM == compiler” cliche (which I don’t, but whatever), then isn’t posting a repo of LLM-produced code equivalent to posting a repo of compiler-produced assembly? Why not just post the prompts and leave it at that? I have about as much interest in reviewing the output of someone’s compiled program as I do looking at the results of their prompt.
- queenkjuul 4mo agoDude they didn't even run it themselves
- CrociDB 4mo ago> "These haven't been tested, validated, debugged, or verified!" I really don't understand what the point of it is, then. It's not anymore "I put a lot of effort into something because I have the knowledge, experience and time to do so, hope you enjoy", it's like "I paid AI tokens to to that. Everyone could've done, but I paid with my own pocket. And it's untested.". That's it? > "Yes, I used Google Anti-Gravity to convert the programs from GW-BASIC to 'C', but what a better learning tool than to debug a program?" Debugging a program is an excellent learning tool. It's just not better than another learning tool: coding the program yourself. :)
- nosioptar 4mo agoPeople who want to show off their mindless slop ought to be shamed for wasting other peoples' time. I was really hoping to see something interesting as I learned to code from a similar book of basic games.
- ThrowawayR2 4mo agoWell, let's be careful about that. The owner of the repository probably didn't ask for it to be submitted to HN and probably wasn't looking for public attention; perhaps they were merely playing around. The onus is strictly on the submitter here.
- nosioptar 4mo agoGood point. The OP should definitely be subject to some kind of punishment. Maybe force them to listen to Ace of Base's second album on repeat a few times?
- vessenes 4mo agoBoy that is some ugly C89. Like truly terrible. Lots of ways to ‘port’ something like this, but I think if you miss the instructional / simplicity angle, you have not created a good translation.
- devilrider 4mo agoIt's not ported to C. Bad autotranslated. Has a lot of goto and other stuff not ued in C. Its pointless, just saw other also post this point.
- dlenski 4mo agoWhat is the point of this? I had this book when I was ten years old. I learned a lot from typing and trying to modify the BASIC games in it. I went on to learn C and many other programming languages, and to use them professionally and otherwise for decades. How would I learn anything at all from untested, machine-generated C translations of them? This is practically the definition of AI slop, to me.
- deleted 4mo ago[deleted]
- msla 4mo agoNote that this isn't written in C but in 'C'. /s
- beej71 4mo agoI've done a bit of porting BASIC code to other languages. My first step is to reverse engineer it to a spec, then I write a new version from that. I know some people start with a straight port with goto and everything, then try to fix the structure later. That always sounded harder to me.
- nohillside 4mo agoIf the code is as bad as the Makefile, it will be very ugly.