Run/Edit Program
Edit World
Save/Restore World
Sample Programs
Language Reference

Karel Tutorials

Click the tutorial title to link to the tutorial.

Karel's Environment

This tutorial discusses all of the basic elements in Karel's environment. This includes beepers, walls, programs, and sensors. The grid of streets and avenues that Karel moves through are also discussed.

Several examples are shown of the simulator's runtime screen of Karel performing simple tasks. The 5 primitive instructions that Karel responds to are also discussed.

Writing Simple Programs

This tutorial provides an example of how to write a program for Karel to perform a simple task. This program only uses the 5 primitive instructions.

The example shows step by step how the simulator's Edit World page is used to create the task specific world. It then shows how the RUN page is used create and run the program.

Restoring Graphical Worlds

This tutorial shows how to restore a graphical world from a previously saved JSON (JavaScript Object Notation) file.

The tutorial goes through an example step by step showing how to restore and run a previously saved program and world. The sample programs page provides examples for practice.

Syntax and Error Messages

This tutorial discusses syntax diagrams and how to use them in interpreting error messages. The syntax diagram for a condensed version of the language ( only primitive instructions ) is defined and discussed.

Several examples are used to illustrate the proper approach to interpreting error messages.

Defining New Instructions

This tutorial shows how to define new instructions in Karel the Robot's programming language. The syntax for new instruction definition is discussed. Examples are used to illustrate the concepts.

In addition, pre- and post-conditions are used to specify new instructions. Both a bottom up and top down approach to program design are discussed.

Defining New Instructions - Part 2

This is a continuation of the New Instruction Definition tutorial. It goes into detail concerning using new instructions in other new instruction definitions. An example is used to illustrate this.

In addition, the tutorial goes into detail concerning how new instructions effect program flow. This is important for understanding subroutines in traditional programming languages.

Top Down Design and New Instructions

This tutorial uses the "Bowling Pins Problem" from Pattis' text (problem #2. page 59) to show a top down approach to solving a problem. The approach tries to show what new instruction specifications are needed to perform a task (set the bowling pins).

After the specifications are developed through pre- and post-conditions, the detailed code is written and executed. The problem can be found on the Sample Programs page.