There are a ton of windmills in Idaho. Mostly big ones for power, but you see a few smaller ones used for irrigation and wells. But, when I wrote this month’s program, I couldn’t remember any being around where I lived in Indiana. No matter. I still wrote a simple windmill animation, and today is the day to share it.
Although I planned to share another program, as I started to type it in I had this feeling I already had. After a quick save and a search of my hard drive, I soon discovered I had. Yet, to my surprise, I found not one, but a dozen more programs.
Going through this stash from ’98, I realized I’d meant them for my original ZX81 site. Not only were the programs there, but I’d printed screenshots and listings as well. None, of course, found their way to my site. Heck, some I’d even typed some in again. Oops. The cool part, though, is I now have a few more programs to share.
As for windmill itself, the animation is straight forward. The program starts by asking you to enter in a speed and duration. Once entered, the program uses them to animate two blades, given an illusion the windmill is moving.
There is also a power turbine that rotates along with the blades. The original idea was to show dots of electricity flowing, but I didn’t add them. I still think it would have been a nice feature, but otherwise looks fine.
To be honest, the effect works better than I expected. The two animations, as simple as they are, are pleasing to watch. The blades have a bit of a lag to them which adds to the illusion that they are moving. I do, however, find the faster speeds look better.
Problems and fixes.
Yet, although the animation works, as does duration, the speed doesn’t. When you enter it in, the program uses it in a
FOR loop to slow down the animation. The problem, though, is the formula doesn’t work. Here is the original version.
130 LET S=S-(S-(SGN S*20))+
(S=1 OR S=20)
To be honest, the math is broke. No matter what you enter the answer is 20, except if you enter 1 or 20. In that case, you get 21. Of course, if the number doesn’t change, neither does the animation. I’m sure I tested it, but must not of bothered to dig deeper once I found it worked.
Sure, I could have left the original version, but it bugged me having a broken program. It is already pretty short, so leaving in such an obvious bug was problematic. Time for a fix.
130 LET S=(20-S)*2
In this version, the larger the number is, the smaller the delay. Perfect. This is exactly what I wanted. Now, if you enter in a speed it will change the rotation rate of the blades. To widen the difference between speeds, I multiplied the result by two. Not required, I found it worked best while testing.
The animation is nice, but I could’ve done much better. Looking at what windmills look like today, I wish I’d made the blades longer and reduced the width of the base. Plus, that turbine doesn’t make sense. You can store the power generated from the blades without an intervening system.
But, this was 1985. Not having the references I do today, I can forgive my vision. Yet, I’m confused by the interactive nature of the program. If I were to change something, it would be how you interact with the Windmill.
First, I’d remove the the duration. Having a set time for the animation to run is silly and unnecessary. The abrupt ending to the animation is jarring. Removing it would look much better.
Second, I should have removed the
INPUT for the speed. Instead, I could use an
INKEY$ command to let the user speed up, or slow down, the blades. Doing so makes the program much more interactive. And, married with the above change, would streamline the look and feel of the program.
INPUT statements would provide another benefit. Although I offer a range to enter, I don’t test that the user stayed within those bounds. Changing the program as noted above would remove the need to do so.
To be honest, the program still works well enough. The changes offered would make it better, but they aren’t required. Yet, if you decide to try them, I’d sure like to see the result.