Go to the first, previous, next, last section, table of contents.


Introduction

Learning to Program

My first college computer class, in the fall of 1982, used Karel the Robot as the introduction to programming in Pascal. I found it an entertaining and useful introduction to structured programming. While structured programming has fallen out of favor in deference to object oriented programming, I still think this can be a useful introduction to computer programming. And I think that children are entertained by the idea of instructing a robot to perform a task, and then watching the robot actually follow the instructions.

Karel

This document is light on the details of the Karel language. The definitive reference is Richard Pattis' Karel The Robot: A Gentle Introduction to The Art of Programming(1). What this document attempts to describe is the Karel simulator, which loads and executes Karel programs.

There are three user interfaces that come with the Karel package: text, curses, and gtk. The text interface prints out a line whenever Karel moves or turns. This is useful for debugging and regression testing, but not very useful to a user. The curses interface allows users to run Karel programs on a terminal, no windowing system required. The gtk interface can be used on systems that have the X Window system and the GTK development headers and libraries.

The architecture of the Karel package is such that developers can build their own user interfaces using virtually any toolkit they desire. All they need is a C interface to interact with the Karel engine. Karel was written this way to avoid being tied to any particular GUI toolkit. The choice of GUI toolkits is largely personal preference; I set the goal of being relatively toolkit independent. I expect it to be possible to build user interfaces to the Karel environment in Qt, Motif/Lesstif, Athena, Tcl/Tk, Java, perl, guile, or any other system that has a C callout mechanism.

How to use this manual

This manual is divided into 2 sections, a User's Guide and a Programmer's Guide. If you want to write Karel programs and run them, you'll want to read the User's Guide. If you want to extend the Karel environment, or you are curious about the inner workings of the environment, you will find the Programmer's Guide helpful.

Acknowledgements

Thanks go to Richard Pattis wrote Karel the Robot, upon which this program is based. Richard was kind to give me his permission to distribute this simulator. Without his book, this program could never have been written.

Thanks also go to Jan Miksovsky, who wrote a Karel simulator in the mid 1980's. I found that program in early 2000, dusted it off, and it ran. I then modified the program to be more modular, and object-oriented (as much as one can in C). I was able to locate Jan on the internet (it pays to have a unique last name, I guess) and he was gracious enough to give me his permission to modify his original work and distribute it. Not much remains of Jan's code, but the concepts behind the simulator, and particularly the engine that builds and executes a Karel program, are Jan's, and I probably couldn't have written this system without his lead to follow.

Don Dietrick and Bill Mackiewicz both served as early beta testers. I am indebted to them for their patience in dealing with a half-baked glob of software, and sparse documentation. They dutifully did the compile-make-repeat loop in order to test out the latest I had to offer.


Go to the first, previous, next, last section, table of contents.