A tiny version of Numbertron


I have added a tiny, new implementation of Numbertron to the game files. It's called Numbertron S, and it's my contribution to this year's 10liner programming competition. You can find all the contributions at the competition's own Itch.io-site (there are two other games for the Sharp MZ-80A, and one for the MZ-80K – plus a ton of games for more popular platforms, such as the Commodore 64).

The point of the competition is to create working games in ten "lines" of BASIC code. On the MZ-80A, and a lot of other retro computing platforms, a line of BASIC code may contain 80 characters (actually 78 on the MZ-80A), so a full line will occupy two actual lines on the screen. Some BASIC variations allow for more characters per line, like 120 or even 256. To make the competition somewhat fair, there are different categories. My Numbertron-game is in the PUR-80 category.

Creating a tenliner implementation of Numbertron actually wasn't as hard as I'd expected, though making it feel like a "proper" game was a bit more of a challenge. Since the crucial stuff for the gameplay fits into six lines (ish) of code, I had plenty of space to make the presentation more interesting. For instance, I added a neat piece of "music", generated using the SIN function (this is in line 9).

Though it has to be said that this version lacks most of the bells and whistles of the full game. The only bonus available is the double score tile (an H here, not a diamond), and there's no two-player mode.

The main coding challenge has to do with IF THEN-sentences, as whatever code you put in after an IF-statement will never run if the statement is not true. So in order to actually make full use of the lines, the code has to be structured accordingly. There are a couple of alternatives to IF THEN, such as ON GOTO and boolean expressions, and I used the latter in line 6. That weird calculation that doesn't make sense at all – S=S-S*(C=8) – tells the game that the S variable (score) should double if the C variable (gained by peeking the current screen memory address for the player position) is 8 (which is the character display code for the letter H). The fact that I have to use - instead of + is just a quirk of BASIC SA-5510.

Making this tenliner version of Numbertron was a fun challenge, and this version does some things I wish I'd thought of when I made the full game. If you enjoy BASIC-programming, which to me feels more like playing a design-based puzzle game than doing actual work, you should definitely consider participating in the competition next year. Especially if you're a Sharp-fan, there were no MZ-700 contributions this year...

Anyway, if you'd like to play the game, you need a copy of BASIC SA-5510. After that has been loaded, you must load the game file separately (using the LOAD command in BASIC). Use the LIST-command to see the game code, or RUN to run the game. You can find BASIC SA-5510 at MZ-80A.org (in the downloads section). Feel free to ask if you've got any questions.

Files

Bonus: Tenliner implementation of Numbertron in BASIC SA-5510 611 bytes
Apr 04, 2021

Get Numbertron (Sharp MZ)

Download NowName your own price

Leave a comment

Log in with itch.io to leave a comment.