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

This manuscript has not been published. It is Copyright, JosephBergin.

Some of you are using this manuscript in your courses. This is fineif you are a non-profit educational institution. However, note thatthere are few exercises here. The exercises are in the book Karel++. Ifyou use this manuscript it will be helpful to the authors and to yourstudents if you have at least a few (more than one) copies of theprinted book available for your students. That way they have theexercises and the authors (and publisher) get paid something for ourefforts.

If you are using this manuscript I'd like to know about it. Pleasesend me email at berginf@pace.edu.

Dedication | TeachingNotes | Table of Contents
Simulator | Use with JJ| Use with BlueJ | Extras
Goodies

 

 

Changes coming to Karel J Robot

In preparation for publishing this as abook some decisions are being made that you should be aware of. Notethat I have no publication date or firm plan yet, but the manuscript isbeing updated. The online version will probably not change to reflectthese decisions, however. When it is published, most of the manuscriptwill no longer be available here and I will ask that those who mirrorit update their pages accordingly for copyright reasons. The list ofdecisions below may change as we proceed.

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

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

 

 

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

 

Teaching Notes(new)

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.


Preface

1 The Robot World

2 Primitive Instructions and SimplePrograms

3 Extending the Robot Programming Language

4 Polymorphism

Optional Section on Linked Lists(before selection)

5 Conditionally Executing Instructions

Optional Section on Recursion (beforeiteration)

6 Instructions That Repeat

7 Advanced Techniques for Robots

8 Concurrent Robot Programs

9 Moving Beyond Robots to Objects

10 Input, Output, and ExceptionHandling

11 Safe Concurrent Programming withRobots

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


There is a Simulator that you can use to run Karel J.Robot programs written in 100% pure Java (see below). Here is a (Southfacing) 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 runconcurrent robot programs as well as sequential ones. An example isprovided (Philosopher.java) that illustrates the dining philosopherproblem.


Simulator Available

A new simulatorwith a world builder is now available.

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

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

Another Simulator

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


Shirts and Other Stuff with the Karel J Robot Logo

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 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.

Karel J. Robot and JJ

JJ is an online interactive Java educational environment that youcan use with just a Java enabled browser. Karel J. Robot is nowavailable 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/) isa Java environment for novices. On the IDE page youcan find a link to instructions on how to makeit work with Karel J. Robot.

bluej logo


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

Extras

Here is an exercise that you can do after completing the first sevenchapters of Karel J. Robot. The LostBeeper Mine Adventure.

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

There are some Additional Materialsavailable that were produced by other people.

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

Here is a Role-Play Exercise youcan use to introduce Karel J. Robot and some ideas of Object-OrientedProgramming. 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 CalculatePI. Thanks to Dan Eliot of Azusa Pacific University and El DoradoHigh School for providing this neat project for students.

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


Last Updated:February 8, 2005

Back to Joseph Bergin's Home Page.