April’s Program: RMS


Randomly generate some basic monster statistics for adventure games.

RMS, 1983Are there any D&D folks in the audience? Come on, you know who you are. Past or present doesn’t matter, just if you know what I’m talking about. Why, you ask? Because RMS, April’s program of the month, will use your ZX81 to build monsters. Any fledgling DM could then use these creatures in their latest campaign. Elves and humans will cringe at your originality and cruelty.

Kidding and dragons aside, RMS or Random Monster Statistics, was one of my attempts at using the ZX81 for things not related to computers. I always enjoyed playing D&D and tended to buy up all the books and modules I could. Naturally, this would eventually bleed over into my programming habit. RMS is just that, a way to generate monster characteristics that theoretically could be used in a game of D&D.

Of course, I never actually used these. The statistics are pretty crude and seriously aren’t very useful. You still have to enter in the names yourself, which seems odd that I required there. From there you get the AC (armor class) modifier, HD (hit dice although I think it’s really hit points or HP), color, AT (number of attacks), and attack damage (primary and alternate). These are purely random numbers and, in the end, there is no logic or relationship. You can fill the screen with monsters, then copy the statistics to the printer, start over, or quit. I guess you could do this until you found something that looked good, but ultimately without a description, random monster statistics really isn’t that valuable.

As a program, though, there is some interesting stuff going on under the hood. Although I said there was no logic, there is some logic in how the program generates the monsters. RMS generates all of the statistics using a FOR loop and a single variable assignment. Using the ZX81’s Boolean logic, I modified the random number based on the value of B. It is an interesting method to generate 7 variables when writing seven lines of code would have been just as short, and probably easier to read. It’s hard to believe that at 13 I would use such a complex routine. But I did and it works.

It works so well, you’ll find me using it over and over. I used it to set the color and size of the monster. When printing the statistics, I used it to format the output. In fact, the only place I didn’t use it was when dealing with the key press at the end of the routine.

One other cool think I used was string splicing on static strings. A static string is just a bit of text in quotes. Generally, you would use the ZX81’s splicing routines against variables. However, there is nothing to prevent you from do it with a static string. In line 100, you’ll find this code: "--+-"(INT (RND*4+1)). Basically, this prints a negative or positive sign in front of the AC statistic. Since there are three minuses, 75% of the time it is negative. I have to admit it threw me at first when typing this in since I don’t normally do that in programs today. However, it is actually a pretty good solution to the problem.

Although RMS isn’t a very useful if you wanted to play D&D. It is a good experiment with the ZX81’s interesting math routines. Although some programing languages today have similar functions, I wouldn’t recommend using them. Although interesting and perhaps a good choice when writing tight code on the ZX81, it is horrible to read. In modern languages, it is better to write readable code.



Comments on this article:

No comments so far.

Write a comment:

Type The Letters You See.
[captcha image][captcha image][captcha image][captcha image][captcha image][captcha image]
not case sensitive