Here is a direct link to Snap!
To play with Snap! you can just click on the play button on some of the images, like the one above. If you have any problems with it loading, visit Snap! directly in a new browser tab (On that page, click "Run Snap! now"). Another possible solution, if your browser is not Chrome, is to give Chrome a try.
Take a look at the program below. Click the Start button a few times. Also have a look at the scripts inside the program:
Here is a direct link to this exercise.
Notice both bugs have the same script, which moves them forward each time the Start button is clicked. When you do click that button, which one of the bugs moves first? Do they take turn to move? That's right: they move at the same time. There is no defined order for these scripts. Each bug's script runs independently of the others. In fact, we can say this demo consists of two separate programs. That is true of all Snap! programs: each sprite is running on its own. This is called Concurrent Programming and each sprite's script execution is called a Thread. Concurrent (Multi-Threaded Programming) is powerful, because it allows lots of stuff to be happening all at the same time, without the need to wait for each other.
This demo (and in fact all Snap! programs) is also an example of Event-Based Programming. What's that? It is a kind of program in which things are always ready, waiting to react to any event that occurs. In this demo, the only event which the scripts were listening to was you clicking the Start button. Another example of an event is receiving a broadcast message, which we will see below. Such programs never really end, because they have to always be ready for the next event!
Next: Class 4: Revising the List Example: Under the Hood
Previous: Class 2: A Snappy Snap! Primer
Back to: Table of Contents