Transcript for:
Getting Started with Karel Programming

Hi, in this video we're going to learn a little bit more about Karel and write our second Karel program together. So first, let's start off by revisiting Karel's world. There are a few more parts to Karel's world that we'll learn about in this video. First, are the walls. The walls are represented by lines that Karel cannot move through. Some of these lines make up the border of the world, and some of these lines are inside on the grid. We also want to be able to refer to Karel's position. Karel is usually at a certain row and column. The rows are also referred to as streets and run horizontally. Here I've highlighted 5th Street. The columns are also referred to as avenues and run vertically. Here I've highlighted 8th Avenue. Something that's important to understand when programming in Karel is which direction Karel is facing. So Karel can face one of the four compassed directions-north, east, south, or west-and looks a bit different when facing each direction. When you're programming Karel, it's important to try to understand Karel's sense of direction. You have to imagine that you're facing the direction that Karel is and think which way would you move if you're going forward, or which way would you turn if you're turning to the left. So let's take an example of turning left. The left, Karel is facing east, and then when we give him the turnLeft command, he rotates such that now he's facing north. Let's look at another example. If Karel is facing north, then when he turns to his left, he'll then be facing west. So now let's use this to go write our second Karel program. Okay, so the first thing we want to do is put down a ball, and then move, and then turn left. So let's see what that looks like. (On screen). Now we're facing north. So let's put down another ball. Move, and then turn left again. So, putBall, move, turnLeft, putBall, move, turnLeft. Great, and I put a space here on line 4, but the spaces are ignored when Karel goes through the commands. So I want to put down another ball, and then move. Let's see where we end up here. [Program running.] Okay, now I'm going to turn left. Let's run this one more time a little bit slower. [Program running.] Great. We're almost there. We'll put down a ball, we'll move, and then we'll turn left. [Program running.] Great. We've written our second Karel program. Now it's your turn to write some more Karel programs.