To my surprise, I was thumbing through my old printouts and discover that I actually wrote an Input Two program. I covered Input One as March’s Program of the Month. For September, however, it is Input Two’s opportunity to shine.
Input Two is a very different program though. Unlike the first program that was a study in guessing words, the second is a work of text manipulation. It takes the words you entered and reverses them. Much like before, Input Two does this using brute force. It isn't elegant, but it works and the program displays the results rather nicely.
So how does it work? Simply, it uses a pair of
FOR loops. The first one walks the list of words. The second one flips the word. Nothing special, but I did something in this program I don’t remember doing before. I used a three-dimensional array. In case you missed it, here is the line of code:
10 DIM A$(10,2,10)
I’ve used plenty of two-dimensional arrays, usually to represent a series of words. But three is pretty rare, at least for me.
So why three? The first dimension is the number of words. In this case there are ten words or 10. Since I want to flip the word, the second dimension represents the word forward, 1, and backward, 2. The last dimension is the size of the word. I chose a pretty good size of 10. It actually works quite nicely since it is what helps create the uniform display. However, it does mean longer words will get truncated.
Speaking of the display, I did notice something odd when using long words. If you use exactly ten letters, you will notice them butting up against each other. I probably should have included a space between them. But it doesn’t really matter much.
Input Two does a good job of showcasing doing something with entered words. I will note, however, that I don’t miss those
INPUT statements. Although they work, it breaks up the flow. The way the ZX81 dumps you to the bottom of the screen is just odd and something I really don’t miss.