The SiMPLE Tutorial

(Part 1)

("The Fun and Easy Way to Become a Programmer")


Even though a computer may seem powerful and smart, it's really just a dumb box that can't do anything on its own without first being told what to do and how to do it.

Every amazing and wonderful game, utility, etc. that you have ever used on your computer was created by someone else who "told" your computer how to do all those amazing and wonderful things. When you use that person's creation you are, in effect, letting someone else take control of your computer.

Now we are going to teach you how you can take control of your computer. We are going to show you how to make your computer do what you say!

SiMPLE is a programming language that allows you to tell your computer how to do things. It is designed to be both powerful and easy for everyone to use (even adults!)

Micro-SiMPLE

We soon discovered that we could make the SiMPLE language even easier by ignoring some of its less important features. The result became Micro-SiMPLE, a subset of SiMPLE which is even simpler than SiMPLE! Micro-SiMPLE is a training language for total novices who have never programmed a computer before.

Let's Get Started!

A SiMPLE (or Micro-SiMPLE) program is merely a text file containing a set of instructions that tell your computer what to do. This text file is usually referred to as a "source listing".

As an example, look at the Micro-SiMPLE source listing shown below. (Don't worry if you don't yet understand anything in the listing. By the time you finish this tutorial, you will.)

Source Listing

To run any source listing (such as the one shown above), all you have to do is perform the following three steps:

A. Create a New Text Document on your desktop
    (or anywhere you choose),

B. Open that New Text Document, and type* the
    source listing into it,

C. Close the document, and drop its icon onto the
    "Drop SiMPLE Listing Here" icon on your desktop.

*(You could just "copy and paste" the listing, but you should start getting used to the idea of typing in source listings. Because when you start writing your own programs, there won't be anything for you to copy and paste!)

When you type-in the source listing, feel free to use as many (or as few) spaces as you like. And if you do decide to use spaces, you can put them anywhere you want. (Even in the middle of words if you so choose!) For example, the fourth line of the listing could be typed-in this way:

loop: Call solid color (7)

Or, you could type it this way:

loop:Callsolidcolor(7)

with no spaces at all. Or, you could even type it this way:

lo op:C   al lso   li dc olo   r ( 7)

with spaces all over the place! It's entirely up to you, because spaces don't count!

When you run the program, a black window* will open, and the words "compiling...." and "linking...." should briefly appear:

*(On some systems, the window that opens may have a flickering scrollbar on the right-hand side:

This flicker does not impair the operation of the window in any way. But it is easy to eliminate. Show me how.)

If the computer makes two low beeping sounds and displays some kind of "error" message, it means you made a mistake typing-in the program. (You will need to go back and correct your errors.) Otherwise, another tiny black window will pop open on your screen and quickly expand until it fills the whole display. You should then see the screen fill with gray circles:

Let the program run for as long as you like. When you are ready to stop the program, simply press any key on the keyboard.

Let's Modify The Example Program!

One of the advantages of having a program's source listing is that you are free to make whatever changes to it that you like! Even though you may not yet know much about computer programming, let's go ahead and try something anyway... just for the heck of it!

Reopen the source listing file with your text editor and look at the fourth line:

loop: Call solid color (7)
Let's change the "7" to "random(14)+1"

After you've made the change, run the program again. Notice that the circles are now colored!


Wait... Let's Get Organized!

As we proceed through this tutorial, we will be creating many small program files like the one that we've just made. If we put all of them directly on our desktop, it's going to get awfully cluttered very quickly! So I would suggest creating a folder (let's name it "Workbook") where we can keep all our listings. (Right-click on your desktop. When the menu appears, select "New", and then "Folder".)

After you've created the folder (which we will refer to as a Project folder ) and changed its name to "Workbook" (or whatever name you prefer), open it and drag our "New Text Document" into it. (You might also want to drag in a copy of the "Drop SiMPLE Listing Here" icon as well. That way it will always be handy when you need it.)

And finally, having a folder full of files all named "New Text Document" could become a little confusing in the long run. So it might be a good idea to give your files names that are a bit more descriptive (if you so choose). Let's pick "Bubbles" as the name for our colored circles program. So, right-click the file and select "Rename".*

*(If your copy of Windows does not "hide extensions for known file types",
don't forget to keep the file's ".txt" extension when renaming the file.)


Let's See Some More Examples!

Once again, first create a New Text Document (in your "Workbook" folder now) and (if you choose to do so) change the name of that text document to "Doodle". Then open that new document, and type into it the source listing shown below:

Source Listing

When you are finished, close the document and drop its icon onto the "Drop SiMPLE Listing Here" icon.

When the program runs, the screen will remain completely black with nothing on it but a mouse pointer. Try moving the mouse slowly while the left mouse button is pressed down. The mouse should draw a fat white line. Take your finger off the left mouse button and the mouse stops drawing. Next press the right mouse button and - Presto! - everything gets erased!

On the keyboard, press the 'A' key once. Now move the mouse again while holding down the left mouse button. You will see that the mouse now draws in blue. Press the 'B' key and you will see that the mouse draws in green. Each key on the keyboard will select a specific color. Go ahead and experiment to see which keys make which colors. When you are finished, press the 'Esc' key to exit the program.

Let's modify our "Doodle" program now. The fourteenth line (the line just above the last line) reads:

draw: Call solid circle (x, y, 5)

Let's change it to:

draw: Call solid circle (20*(x/20)+10, 20*(y/20)+10, 10)

When you run the program now, it draws a little differently. (It may remind you of the Lite-Brite toy, without all those little plastic pegs to lose or step on.)


As a final example, try running the following "Dazzler" program:

Source Listing

Once again, to exit the program after it starts running, simply press the 'Esc' key (or any key).


Conclusion

You now know how to type-in, modify, and run any SiMPLE program from a listing that has already been created. Merely follow the same three steps that you just went through:

  1. Create a New Text Document,
  2. Type-in the source listing,
  3. Drop it onto the "runner" icon.

Next, we will show you how to create your own program listings.

Go to Part 2 of the Tutorial




  [ Contact Us | Homepage | Online Forums | About the Author ]

© Copyright 2007 SiMPLE CodeWorks, Inc. All rights reserved.