February’s Program: Math Bash
Solve math problems to save the planet from the aliens.
At the one level, you can sum up most programs into three big groups: business, gaming, or educational. Most of my programs fit into one of these base categories. The standouts are generally the animation or demo programs that really have no distinct genre. Even those, however, I can lump into one of the big three without much effort. There are times when these categories get blurred and a program can fit into two or more categories. This month’s program is one of those.
From its opening text, Math Bash is clearly an educational program. Its primary goal is to help students practice their math skills. At its core though it is still a game. Aliens are landing and you have to stop them. The key mechanic is solving various math problems correctly or the alien will reach the earth and end the game. There is a score and can thereby be competitive, but Math Bash doesn’t force a timer on you. There is no rush. The program ramps up the pressure by increasing the difficulty of the math problems. In this way, the program accomplishes its goal, perhaps too well as will discuss later. Now whether the game is fun is debatable.
Overall presentation is actually pretty good. The program introduces itself, clearly describing itself as an educational game. The aliens are cute and the graphics and simple animations work well. It has all the core elements of a game. Each alien you defeat increases the on-screen counter. Between questions, the program displays the score as well as when you are finally defeated. There are explosions and exposition when you win or lose. I could have used these elements along with a different play mechanic to create a very different game. Instead, I aimed for something more than just action and, for the most part, Math Bash works.
The program unfortunately has a fatal flaw and that is the game mechanic itself. I’m not quite sure what age I was targeting, but I could barely get through some of these problems when I tested it today. Worse, some of the problems are impossible, at not without an intimate knowledge of how the ZX81 performs math. To understand that, let’s explore how Math Bash generates the problems. First, the ZX81 randomly calculates two numbers between one and your current alien count, plus twenty if there are less than fifty aliens defeated. The program than randomly selects an operator: “+”, “-”, “*”, or “/”. The routine itself works quite elegantly and I can understand why I did it. Unfortunately, it probably wasn’t the best way to build the problems.
The addition problems are decent throughout the game and the difficulty seems to ratchet up nicely. However, subtraction doesn’t sort the highest number first which raises the difficulty beyond any potential target audience. A quick search turned up that negative numbers don’t usually get taught until around grade 6. I doubt this educational game would sit well with that age group. To make things worse the multiplication routines, once introduced, are too difficult due to the high numbers generated. And division, well that is a different problem altogether.
I wasn’t thinking when I added division. To help you understand that, you need to understand how Math Bash derives the answers. To do this, I had the computer create a string with each number and the operator. I then use a
VAL routine to have the computer calculate the answer. This works well for the other operators, but fails completely for division. Why, you ask? Think remainders. Computers generally don’t like them, instead using floating point to represent real numbers. Although the ZX81 is good at this, humans generally are not and isn't something I should have expected a young child to know. Worse, unless you think like the ZX81 you’ll probably never get the answer right. I really should have done things differently, but hey there is a way around this problem.
If you want a way to win this game forever, look no further than how you enter in the answer. I used the default
INPUT command with a numeric variable. That is, a variable without the dollar sign. This allows you to enter your answer in and the program will then compare it and tell you if you get it right or wrong. The only problem is that the ZX81 will actually take any numeric input including operators and boolean logic. For example, if you get asked what “56/43” all you need to do is type that in. The ZX81 will gladly calculate the answer for you and give it back to the program.
The code itself is a mix of good and bad. Ugly print routines and lack of code reuse top the bad. The aforementioned way of creating the problem and evaluating it top the good. My lack of forethought on picking the numbers aside, the program is actually pretty tight and works. Adding a better input method, one that prevents the user from cheating, would have also given me the option to animate the alien a bit more. This would have helped hold the players attention a bit more while offering a more tailored experience. Oh, and having a target audience in mind might have ensured the program met its intended goal of educating.
Overall Math Bash was a good idea. The teenage me found a good idea and slapped together a working program. The adult me sees the flaws and understands how to correct them. Math Bash has potential, but does this 30-year-old program have life in today’s technology?