Karel

From Witscopedia
Karel The Dog
Karel The Dog

Karel is a dog who listens to your commands. Karel lives in a grid world enclosed by walls along the edge. Each dot represents a space where Karel can stand on. We can move Karel around the grid world and even command Karel to put down and pick up tennis balls. More specifically Karel knows four commands:

  • move,
  • turn left,
  • put ball,
  • and take ball.

The "move" command moves Karel by one space in the direction that Karel is facing.

The "turn left" command turns Karel 90° to the left (or counterclockwise). Karel can face in four directions: north, south, east, and west.

The "put ball" command puts down one tennis ball on the space that Karel is currently standing on.

The "take ball" command takes one tennis ball from the space that Karel is currently standing on.

Programming (or coding) is giving commands to a computer. It's similar to giving commands to a dog!

Let's look closer at the parts of a Karel command. The structure of each Karel command is the same: it starts with the command name and ends with a pair of parentheses and a semicolon. Notice that there are no spaces in the command and the capitalization needs to match exactly, and every command ends in ();—open parentheses, close parentheses, with a semicolon at the end. When typing a command for Karel, we need to type these commands precisely, so that Karel fully understands them.

The best way to learn how to program with Karel is to dive in and do it! Here is the first Karel program you will create. The program starts with Karel in the world on the left, with Karel positioned in the bottom left corner of the grid facing east. The program ends with the world on the right where Karel moves forward two spaces, puts down a tennis ball, and then moves two more spaces. Let's dive in and create this program!

Karel is in her world where she can move spaces, put balls, and take balls. Using a variety of commands that are listed under the quick docs on the left hand side, we're gonna move Karel using the "move" c