The Beginning | page 2 |
Programming for the Genius-Impaired
A series of lessons for those who want to learn how to create their own Lightwave Plugins with Lscript. |
|
Pick a Number, Any Number I remember my very first BASIC program, lo these many years ago. I'd checked out a book from the library (this was somewhat before the World Wide Web, and somewhat after rubbing two sticks together to make fire), and I read the first chapter during study hall. Chapter one was a simple little game where the computer would pick a number between one and ten, and you would try to guess it. By lunch I'd figured it out, and by the time I could track down a computer to run it on, I'd modified it to hurl increasingly naughty insults at you, the longer you took to guess. I think that approach holds up pretty well, so let's get cracking. If you've gone through the first exercise (making a peanut butter sandwich), you know that a program is basically just a very specific list of "things-to-do" for the computer. So let's make a rough list of the steps involved in playing the number guessing game. |
|
Making the List Every game has at least two players (who said Solitaire? ...uh..you're playing against implacable destiny. Shut up.), so the best way to make this list is to play the part of both players, and step through the game, labeling each step either "Player," or "Keeper of the Number" (KotN, to keep it short).
Whew. The hard part is over. Now we just have to translate this into LScript! |
|