|
Getting Started With
SiMPLE
An Introduction To
SiMPLE
Programming For Total Beginners
|
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. But now, we are going to introduce you to SiMPLE, a very easy (but powerful) programming language that lets you make your computer do whatever you want it to do!
Before you can start using SiMPLE, you will first need to download it. . . if you haven't already done so.
Ok, now that you've got SiMPLE downloaded, let's start having some fun with it!
Open the "SiMPLE Projects" folder that you got when you installed the SiMPLE package. (If you've installed SiMPLE onto your computer's main "C:" drive, the "SiMPLE Projects" folder is on your desktop. If you've installed SiMPLE onto some other drive [such as a flash drive], the "SiMPLE Projects" folder is in the root directory of the drive.)
Inside the "SiMPLE Projects" folder you will find several other folders, one of which is named "Samples".
(The above image might look different on your computer, depending on such things as: the version of SiMPLE
that you are currently using, the version of Windows that you are using, how you've configured Windows, etc.)
Open the "Samples" folder. In there you will find a lot of text files, a
(The above image might look different on your computer, depending on such things as: the version of SiMPLE
that you are currently using, the version of Windows that you are using, how you've configured Windows, etc.)
For the present time, we will be interested only in the text files and the
This will run SiMPLE's built-in "Update" program which automatically connects directly to the SiMPLE CodeWorks website and updates your copy of SiMPLE to the very latest version!Before we continue, let's first take a moment to make sure that your copy of SiMPLE is completely up-to-date. (This isn't a requirement for our present discussion, esecially if you've just now installed your copy of SiMPLE. But you should become familiar with the procedure for updating SiMPLE, and you should get into the habit of doing it frequently. Then you will always be sure that you are using the very latest version of SiMPLE.)
How to Update SiMPLE: [NOTE: You must be connected to the Internet if you want to update. And before updating, you should close any another SiMPLE windows or files that may still be open.] Double-click the
"S i M P L E" (toy block) shortcut. When the black window appears, type the word "update" and press the Enter key on your keyboard:
![]()
(If a "User Account Control" window appears, just let it know that everything's OK. )
When you see the message box telling you that your copy of SiMPLE has been updated (or if it tells you that your drive already contains the latest version of SiMPLE), click the box's "OK" button, and then close the black window (by clicking the black window's close button).
(Now... that wasn't so hard, was it?
)
Each text file in the "Samples" folder contains a "program listing" (i.e., a set of "instructions" that tells the computer what it should do). Shortly, we will start creating our own program listings. But for now, let's just use the ones that we already have in the "Samples" folder.
The easiest way to run a SiMPLE program listing is by using "Drag & Drop" mode. To do so, just drag and drop any SiMPLE program listing onto the
|
*Note: On some computers, when using SiMPLE on a drive other than the main "C:" drive, the "S i M P L E" icon might only allow you to use SiMPLE in "Command-line" mode. In that event, find the "Drop SiMPLE Listing Here" icon:
Use that "Drop SiMPLE Listing Here" icon instead of the "S i M P L E" icon to use SiMPLE in "Drag & Drop" mode. |
For example, let's try running the "Circles" program listing. Just drag and drop the "Circles" text file onto the
*(If you've installed SiMPLE onto your main "C:" drive, you won't have a "Drop SiMPLE Listing Here" icon.)
A black window will open, and the words
Then a black screen will pop open, and some noisy animated circles will appear. (On some computers, the circles might not make any noise at all.)
[If the "Circles" program fails to execute, click here for further instructions.]
Let the program run for as long as you like. When you are ready to stop the program, simply press the "Esc" key on your keyboard.
Most of the program listings in the "Samples" folder are merely intended to illustrate some of the capabilities of SiMPLE. As such, those programs are not necessarily meant to be entertaining and/or useful for anything in particular. But go ahead and try running some of them anyway. Just drag and drop any one of them onto the appropriate "runner" icon (either the
Then, after the program starts executing, simply press the "Esc" key to end the program (unless otherwise instructed).
Note: As you try running the other program listings, it's a good idea to end each previous program before trying to run the next one. Otherwise that next program might not execute as well as it should.
Now that you know how to run a SiMPLE program listing, let's start creating our own SiMPLE program listings! (But, before we begin, just
Project Folders
A "project folder" is merely a special folder that is designed to hold your SiMPLE program listings. Every program listing should exist in a project folder inside your "SiMPLE Projects" folder.
|
Note: Unless you've installed SiMPLE onto your "C:" drive, you should not move the |
The only project folder that we have been working with is the "Samples" project folder. Later on, we'll see how to create as many other project folders as we need. But for now, we can just continue using the "Samples" folder to hold the program listings that we will be creating.
Our First SiMPLE Program!
Ok, let's get started! First, create a new text document inside the "Samples" folder. (Right-click anywhere on the white portion of the "Samples" window and select "New", and then select "Text Document".)
Next, open the newly created text document (by double-clicking it) and type the word Win-SiMPLE on the top line.
Although it is no longer necessary to do so, we suggest that you begin every SiMPLE program listing with the word Win-SiMPLE (with an upper-case "W" in the word "Win") on the first line of the listing. (In some of the older versions of SiMPLE, that "Win-SiMPLE" line was required. But not anymore.) After that first line, whatever instructions you put into the rest of the listing are up to you.
For our first program, let's have the computer do nothing more than draw a circle somewhere on the screen. So, on the second line of our new text document, type: Call circle (300, 200, 100)
By the way, when creating a program listing, you can put as many spaces anywhere you
Callcircle(300,200,100)
with no spaces at all. Or you could even type it like this:
Ca l lci rcl e (30 0, 20 0,1 00 )
with spaces all over the place! Either way will work. However, the letter "C" in the word "Call" must be a capital letter.
When you've finished typing, close the text document (by clicking the "x" button in the upper-right corner of the window) and, when asked if you want to save the changes, click the "Save" button.
Then run the program by dropping the "New Text Document" file onto the the appropriate "runner" icon:
If you didn't make any typing mistakes you should see a white circle appear somewhere on your display.
Congratulations! You've just written and executed your first SiMPLE computer program! (Now, that wasn't so hard, 
Question: In our program, what do the numbers "300, 200, 100" mean?
Answer: They are called "parameters". They specify where the circle is to be drawn and how big it should be.
Try changing those three parameters to different numbers, and then run the program listing again to see how the new values affect the size and location of the resulting circle. You will discover that the first parameter (the "300" in our above example) indicates how far over (from the left side of the screen) the circle is to be drawn, the second parameter (the "200") indicates how far down (from the top of the screen), and the third parameter (the "100") indicates how big the circle should be.
Let's Make Another SiMPLE Program!
This time, we'll write a program that draws a red circle and a green square somewhere on the screen.
Once again, first create another new text document inside the "Samples" folder. (Right-click and select "New", and then select "Text Document"). Then open new text document (by double-clicking it) and type the following five lines:
In addition to the "W" in the word "Win" and the "C"s in all of the "Call"s, make sure that you've spelled the word "Red" with a capital "R" and the word "Green" with a capital "G". While spaces don't matter in a SiMPLE program, the use of capital letters is important. (And the general rule is: "Never use capital letters unless they are so indicated." )*
|
*However, when specifying the name of a color, you have the option of either capitalizing |
When you've finished typing, close the text document (by clicking the "x" button in the upper-right corner of the window) and, when asked if you want to save the file, select the "Save" button. Then run the program by dropping the file onto the the appropriate "runner" icon, just as before. If you didn't make any typing mistakes you should see a red circle and a green square appear on your display.
When the computer executes the list of instructions in a program listing, it generally does so by starting at the top of the list and then working its way down toward the bottom, performing one instruction at a time (just like you would probably do if you were given a list of things to do). So the first thing that our program told the computer to do was: "Set red as the color to be used for drawing lines." Then it told the computer to: "Draw a circle 100 units big, and put it 300 units over from the left side of the screen and 200 units down from the top of the screen." So the computer drew a red circle at that location. Next, our program told the computer to: "Set green as the color to be used for drawing lines (and forget about using red)." And finally, it told the computer to: "Draw a square 75 units big, and put it 500 units over from the left side of the screen and 350 units down from the top of the screen." So the computer drew a green square at that location.
In case you are interested, the "units" that we have been talking about are something called "pixels". [A pixel (short for Picture Element) is a single point in a graphic image. Your computer displays pictures by dividing the display screen into thousands of pixels, arranged in rows and columns. The location of each pixel on the screen is specified by giving the column number and the row number at which the pixel exists.]What Else Can I Do Besides Drawing Circles And Squares?
Don't be misled into thinking that SiMPLE is only good for creating graphics images.
SiMPLE is capable of much more than merely letting you use primitive shapes (such as circles, squares, etc.) to make "pretty pictures".
As you become more experienced at programming, you will discover that SiMPLE lets you do things like: perform complex mathematical calculations, manipulate strings of text characters, read and write data files to and from
So we're starting out by just showing you how to do some "visual" kinds of stuff.
The "Vocabulary" of SiMPLE
The three "commands" that we've used so far ("color", "circle", and "square") are referred to as "tasks". (In other programming languages, "tasks" are sometimes referred to as "subroutines".)
Every task exists in something called a "library". In SiMPLE, there are two main types of libraries. The most important one is the "System Library". It contains hundreds of tasks that perform very general and primitive operations (such as drawing a circle, etc.) Inside your "SiMPLE" folder (in your root directory) you will find another folder named "Docs". If you open that "Docs" folder, you will find a text file named "W-Syslib". It contains a description of all the System Library's tasks and functions that are available.
In addition to the System Library, SiMPLE also utilizes a second type of library called an "Append" library. An Append library contains tasks that were written by a third-party supplier (such as a
The tasks and functions in the System Library, together with the tasks in the Append library(s), constitute most of the "vocabulary" that SiMPLE understands.
When studying a foreign language, knowing as much of the language's vocabulary as possible is important if you want to become fluent in the language. The same holds true for SiMPLE -- you will want to become familiar with as many of SiMPLE's "words" (i.e., tasks and functions) as possible in order to be "fluent in SiMPLE".
You can think of the "W-Syslib" and "Toys-Lib" documents (in SiMPLE's "Docs" folder) as being "dictionaries" that list all the "words" that SiMPLE understands.
Using the "Beginner's Dictionary"
We've already seen examples of some of the graphics tasks (circle, square, etc.) in the "Beginner's Dictionary". So let's now play around with some of the other tasks that are available.
The "bell" task plays a "bell" sound through the speaker. The "cuckoo" task plays a "cuckoo" sound through the speaker. And the "cls" task can be used to clear the entire screen to a specified color.
Let's write a program that plays three "cuckoo" sounds, then turns the entire display screen red, and then rings a bell five times.
Once again, first create another new text document, and type the following ten lines into it:
| Program Listing |
When you've finished typing, close the text document and then run the program by dropping the file onto the the appropriate "runner" icon, just as before.
Show Me More!
The "Beginner's Dictionary" contains a task ("showcard") that will display the image of any playing card. And the "messbox" task displays a small window containing a message, along with an "OK" button. Let's use these tasks to write the following little program:
| Program Listing |
Notice that, even though the general rule is: "Never use capital letters unless they are so indicated," it is OK to use your own capital letters whenever you use them between quote marks (such as when specifying a message that you want to have displayed. Also, when spaces appear between quote marks, SiMPLE does not ignore them.)
Using the "toys" Library
Located near the bottom of the "Beginner's Dictionary" is a list of some of the tasks that exist in the "toys" Append library. Let's write a program that uses the "rocket" task from that "toys" library to draw a red rocket on the screen. (We'll even put a few stars in the sky as well.) And we'll invoke the "explode" task to make the rocket explode when you press any key on the keyboard:
| Program Listing |
Notice that you must remember to include an "@" character whenever you invoke a task from an Append library, and you must include an appropriate "Append" statement (with a capital "A") at the end of your listing.
At this point, you should spend some time experimenting with the rest of the tasks and functions described in the "Beginner's Dictionary". Knowing how to use as many of those tasks and functions as possible will allow you to create more interesting programs later on.
How Do I Create a New Project Folder?
Creating a new Project folder is almost trivially easy:
The first time you use the "S i M P L E" icon (or the "Drop SiMPLE Listing Here" icon), it will automatically create for you a Local "Append" Library folder (named "Library") inside your Project folder (so that, if the time comes that you want to start creating your own library modules, you will be all set to do so.
)
Conclusion
We have barely scratched the surface of all the different kinds of programs you can create with SiMPLE. But you now know enough to at least start creating your own little fun computer programs.
When you're ready to do so, you should next read our SiMPLE Tutorial to discover many of the other cool things that you can do with SiMPLE.
| Let Me Read The SiMPLE Tutorial |
|
Are you sure that your copy of SiMPLE is up-to-date?
Remember to Update it regularly!
|
![]()
[ Contact Us | Homepage | Online Forums | About the Author ] © Copyright 2011-2013 SiMPLE CodeWorks, Inc. All rights reserved. |