Adafruit Playground is a wonderful place to share what you find interesting. Have a cool project you are working on? Have a bit of code that you think others will find useful? Want to show off your electronics workbench? You have come to the right place.
Adafruit Playground is a safe place to share with the wonderful Adafruit community of makers and doers.
Click here to learn more about Adafruit Playground and how to get started.
-
Space War - A game for the MagTag
# Space War - Magtag
This started out as Star Trek in BASIC written by Mike Mayfield in 1972. It was completely text based, designed to run a teletype for input and output. As did any number of computer programmers at the time, I grabbed a copy and changed and enhanced it. Eventually renaming it to Space War so I didn't have to keep all the Star War references. I don't have any of the original listings. There very well may have never been a complete hardcopy listing. A listing at 10 characters per second on roll paper wasn't something you did often.Eventually, I converted a version to Fortran to run on an IBM mainframe on a CRT that had an addressable cursor. A while ago, I did find a listing of that version (data 1977). And I had an extra MagTag that I wanted to try doing something more interactive than display the weather, or motivational quotes. My first thoughts were that it should be pretty easy to port the Fortran over to Python.
I make no claims that this is a 'port', or 'conversion' of that Fortran program. That program was a convoluted mess of GOTOs and GOSUBs and clever Fortran hacks (and a serious lack of comments). About all I actually
saved were the instructions and the program flow.The MagTag is actually much more powerful than that GE265 or the IBM so I wasn't worried about the program size. There are two issues that I had to spend most of my time on.
1) There is no keyboard on the MagTag. Just 4 buttons. So "typing in" a command was out of the question. And if one button is used for "Next" and one for "Cancel" that meant only two left for commands.
2) The second issue was the eInk display. More specifically, the refresh rate is approximately 3 seconds between changes. So you really can't give feedback whena button is pressed. This was a real challenge when the commander needed to enter a four digit coordinate to warp to.
There are addon's that could easily attach to the Magtag to address these. But I wanted to be able to play it on a "stock" Magtag with no additional components.
And I added some comments.
I think it turned out pretty good. Though there are still some things left to implement.
https://github.com/vrtisworks/Space-War---Magtag