When we construct sentences in English, we end up using quite a bit of syntax in order to make sure our meaning is communicated correctly. This often includes quite a bit of punctuation–seemingly meaningless symbols that drastically change the way we read/interpret a sentence. If you’ve ever seen a program in a traditional text-based programming language like Python, Java, or even something like Fortran, you’re sure to have noticed the same types of things! Semicolons, indents, and parentheses are just some examples of syntax that are used in text-based programming languages to prevent ambiguities.
But today, we want to get programming right away and don’t want to have to get used to using a text-based language. Instead, we’re going to use a blocks-based language to program the movements of our turtle buddy! A blocks-based language is a computer programming language where programs are constructed visually, with commands “snapping” together just like pieces in a jig saw puzzle.
Below, we have our now familiar turtle simulator, but you’ll notice a “Programming Canvas” to the right hand side. On the Canvas on the right-hand side you’ll see the beginning of a program which tells our turtle how to MOVE.. You’ll see on the right-most side of your screen a set of 4 different blocks, three of which should remind you of the buttons we used to solve this simple puzzle just a few minutes ago.
While issuing commands one-at-a-time to our turtle was great, here we want to write our program using these blocks. In a way, we’re basically programming the turtle’s brain. We upload our program to its brain with the RUN PROGRAM button and let it do its thing. To add blocks to your TO MOVE function, just click and drag a block from the rightmost side of your screen and snap it, like a puzzle piece, on to the bottom of the TO MOVE block (use the little nibs on the blocks as a guide). Continue this process with whichever blocks you need to guide your turtle buddy to the safety of the violet patch. Once you’ve finished your program, use the RUN PROGRAM button to have the turtle run your program.
If your turtle hits the lava, it’ll let you know and go back to its starting position. But if your turtle stays safe but doesn’t make it to the goal, you’ll need to change your program to accommodate its new position.
Note: If you try to stop your program while it is executing by clicking the RUN PROGRAM button, your turtle will likely get confused. If this happens to you, make sure to click the CLEAR TURTLE BRAIN button before trying again.