A text adventure game from 1982 ported to many different programming languages.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


<h1>Basements and Beasties</h1>
<p>My first computer was a TRS-80 Color Computer II, well, technically it was my dad's computer, but that's not the point. This was a typical computer of the time, and it had a BASIC interpreter in ROM. When you turned it on, it displayed a prompt saying:
At this point, you could type in a program in BASIC. Or just watch the cursor blink. Those were pretty much the only options. So as a child, I learned to program in BASIC. But the BASIC of this time involved line numbers, abbreviations to save on memory (after all, the computer only 16KB of RAM, expandable 32KB if you were willing to solder chips on to the main board...), and other things that would now charitably be termed "quirky".</p>

<p>As a kid, I loved games, and text adventure games thrived in this era. They all mostly descended from Crowther's original <a href="https://en.wikipedia.org/wiki/Colossal_Cave_Adventure">Colossal Cave/Adventure</a> game from the late 1970's. So one day, in late elementary school or possibly early middle school, I was in a Radio Shack, and I saw the book <a href="http://www.trs-80.org/writing-basic-adventure-programs-for-the-trs-80/"><em>Writing BASIC Adventure Programs for the TRS-80</em></a> was on the shelf, and as books on programming were quite rare for me to find... well... anywhere at the time, I had to own it, and begged my mom to pay for it. (Details are a bit fuzzy at this point, but that's roughly how it went down.) That book is still one of my prized posessions in my library.</p>

<p>So let's fast forward to late 2015. I was needing some down time, and I love educational projects that can help teach others to code, and I thought back to that book, and so as we were packing for a vacation, I pulled it off the shelf and packed it in my laptop bag. The BASIC code from that era would be quite a pain for someone to sort out, but the content of the book itself is still great, so I decided I would transliterate it into something more modern and accessible as a first step toward working on an update on the material for today's audience. Naturally, Javascript and the web are a great fit: it's accessible and runs everywhere. So I did the most straightforward copy of the code possible (partially because I wanted to avoid the impulse to improve it and ruin the pedagogy... one aspect of which is that the game provided by the book does have some intentional shortcomings... how else can you inspire the would-be-adventure-game-author to explore improvements beyond a slightly different map?). I did a couple of straightforward refactorings and then, my vacation ended and I put the project on the shelf for a bit.</p>

<p>About a third of the way through 2016, I was talking to a potential employer about a job, and they mentioned that the interview would involve C and Python. It has been a decade since I have written anything substantial in C, and I never really wanted to do anything in Python so I have never bothered to learn it, so I needed to do something little but real enough to force myself to learn Python and review C for this interview, and I remembered my translation of the Basements and Beasties game from the book... so I decided to port the JS port to Python and C. So, at the end of the weekend, I had two working copies of the game in Python and C respectively.</p>

<p>So at this point, it has dawned on me that this is also a fun little "Rosetta stone" project in a way too. So I started on a SQL port (in progress), and have plans to also do Haskell, Erlang, Elm, Elixir, and Java ports as time permits. They are generally quick for me to knock out but of course, while I want to keep the structure and names the same as much as possible (Even down to the anachronisms from the book), the different languges encourage one to surface some interesting variations in approach. For instance, using VIEWS for the pure functions in SQL and stored procedures for state changing functions (And the fact that the game is by nature "persistent" in SQL, and thus, every game state is saved by the database), or the Erlang version which encourages one to treat things like monsters, objects, and even rooms as processes.</p>