Karel J. Robot
A Gentle Introduction to the Art of Object-Oriented Programming in Java

Karel J Robot and the related books are now at Amazon.com.

All of these are available at Amazon.com. Search for them by name there or see the individual pages, below.

Since the book has now been published, I'm withdrawing permission to use or mirror the manuscript other than the pages still available here. If you have such a mirror of the removed chapters please remove it.

 

Note on Review Copies:

Review copies are difficult, at best, for me. This is self published and I need to pay money out of pocket to send any review copy. I even need to purchase copies for my own use. I hope you understand. Eventually, we hope this will be picked up by a more permanent publisher. I will consider special needs, of course, but may not be able to help.

 

If you are using the book, I'd like to know about it. Please send me email at jbergin@pace.edu.

Latest News

Greenfoot iconA New Simulator is now available that works within the Greenfoot system.

See the Greenfoot Simulator Page for details.

 

Alice LogoI've also been working on importing Karel into the Alice 3 system. It is now available (release candidate 3). It will soon be possible to use this with BlueJ.

See the Alice Simulator Page for details.

 

 


Volume 2 is now available. It extends the ideas presented in Karel J Robot to complete a first course. It is available through CafePress now. Here is the Table of Contents for Volume 2. Software for this book is now available on the new combined CD at CafePress.

Visit the Beyond Karel J Robot Page


A Python Edition is now available from the Karel J Robot site at Cafe Press. It is somewhat different, since Python is somewhat different. It tries, as all of these books have done, to capture the essence of the language. Software for this book is also on the new combined CD. Both book and software are available now.

Visit the Monty Karel Page.

Note that a student who studies from either Karel J Robot or Monty Karel will benefit very little from using the other as well. They are ready for something more. Beyond Karel J Robot might be considered for those who studied from Karel J Robot first, however.

There is also a new Beyond Monty Karel volume.


The Ruby edition is now available both in print and as an E-Book. It is similar to Monty Karel, as Ruby is also a dynamic language. This is the only book in this series available as an e-Book.

Karel Ruby Cover Visit the Karel R Tuesday Page


 

Dedication | Teaching Notes | Table of Contents
Simulator | Use with JJ | Use with BlueJ | Extras
Goodies | Feedback

 

 

Changes to Karel J Robot

 

Errata: The printed book contains a few errors.

 If you feel strongly about any of these issues, please feel free to contact me.

Kristen Nygaard Image
Dedication. The authors would like to dedicate this work to the memory of Kristen Nygaard, who, along with his friend and colleague Ole-Johan Dahl, invented object-oriented programming in the 1960s and who worked since then to refine and extend it. Kristen was an interesting and lively person who worked his entire life to make things better for others, both in technology and otherwise. We, who came to know him, miss him and his continuing inspiration greatly. He died suddenly in August 2002 at the age of 75.

 

 

NOTE. See below for information about a simulator in 100% pure Java.

 

Instructor's Guide is now available (March 2, 2005) (Errors corrected May 18, 2005)

Teaching Notes (older)

Supplementary Java Code: This zip file contains the code extracted from the text of the book. All complete classes are included plus a few goodies. On the simulator page, you can get a set of world files.

The Programmer's Journal: An idea for students. (NEW)

The simulator page now has a user's manual for the simulator.


Preface

1 The Robot World

2 Primitive Instructions and Simple Programs

3 Extending the Robot Programming Language (Withdrawn)

4 Polymorphism(Withdrawn)

Optional Section on Linked Lists (before selection)

5 Conditionally Executing Instructions(Withdrawn)

Optional Section on Recursion (before iteration)

6 Instructions That Repeat(Withdrawn)

7 Advanced Techniques for Robots(Withdrawn)

8 Concurrent Robot Programs(Withdrawn)

9 Moving Beyond Robots to Objects

10 Input, Output, and Exception Handling

11 Safe Concurrent Programming with Robots

Note that this version may contain several minor errors. It has not been through a rigorous editing process. I would appreciate comments and bug reports sent to me at berginf@pace.edu. Thanks.

Here is the complete Table of Contents of the book as printed.


There is a Simulator that you can use to run Karel J. Robot programs written in 100% pure Java (see below). Here is a (South facing) robot trying to place some beepers in the world.

 

Image of Karel in a world with two beepers and some walls

This version is very sophisticated and may be used to run concurrent robot programs as well as sequential ones. An example is provided (Philosopher.java) that illustrates the dining philosopher problem.


Simulator Available

A new simulator with a world builder is now available.

Note that the worlds read and written by this simulator are not compatible with those of the Karel ++ versions. Here we use simple text files, where in the earlier work we used a proprietary format.

You will need a text editor or IDE to create java programs for this simulator. You will also need Java.

Another Simulator

Here is another simulator independently developed in Germany by Christoph Bockisch. This one is built with Swing and uses features of Java 1.4, so it only runs on the latest Java versions. I have not been able to test this. It is faithful to the current manuscript, in that the user writes a "task" not a "public static void main..." There is a preprocessor to translate it to real Java. Note that the book, when published will probably also be real Java, and "task" and "loop" will be replaced by their true Java equivalents. This simulator also does not support the functionality needed in the later chapters of the manuscript.


Shirts and Other Stuff with the Karel J Robot Logo

In addition to the book, you can now purchase Karel J Robot auxiliary products, such as shirts and buttons from

http://www.cafepress.com/kareljrobot

The authors do not make a profit from many of these goods. They are provided "just for fun." Enjoy. You might want to give out a button or two as prizes for particularly well done programs.

Some premium products are also available here:

Some of these are appropriate as prizes for your best students and for a well-done assignment or a programming contest.


 

Karel J. Robot and JJ

JJ is an online interactive Java educational environment that you can use with just a Java enabled browser. Karel J. Robot is now available interactively via the JJ system at http://www.publicstaticvoidmain.com/.

You can test it at
http://www.publicstaticvoidmain.com/cgi-bin/sfjj.cgi?freeschool=KarelJRobot&file=introToKarel.java

 Karel J. Robot is JJ enabled (logo)


Karel J. Robot and BlueJ

BlueJ (http://www.bluej.org/) is a Java environment for novices. On the IDE page you can find a link to instructions on how to make it work with Karel J. Robot.

bluej logo


Thanks to Trevor Gosbell from Australia for a very simple Introduction to Karel J Robot using BlueJ

The Objects First with Java Book is an excellent follow-on to Karel J Robot. Click the image to see it on Amazon.com


Extras

Here is an exercise that you can do after completing the first seven chapters of Karel J. Robot. The Lost Beeper Mine Adventure.

Some additional exercises were written for Karel++. They work with Karel J. Robot just as well. Note, however, that Chapters 5 and 6 in the printed Karel++ corresponds to Chapters 6 and 7, respectively, in Karel J. Robot. Additional Exercises.

There are some Additional Materials available that were produced by other people.

There are some Additional Classes available that you might want to use with your Robot programs.

Here is a Role-Play Exercise you can use to introduce Karel J. Robot and some ideas of Object-Oriented Programming. Thanks to Joseph A. Tosh for this.

Karel J Robot as a Turing Machine

Some additional ideas about using Polymorphism (see Chapter 4) is now available.

Karel J Robot is smarter than I thought. It can now Calculate PI. Thanks to Dan Eliot of Azusa Pacific University and El Dorado High School for providing this neat project for students.

There is now a ChangeHistory page for the simulator and for these pages.


Last Updated:July 6, 2023

Back to Joseph Bergin's Home Page.