Steeple Chase

8 points

The WHILE loop allows you to instruct the computer to keep on carrying out some instructions until some condition is met. The WHILE loop is an important way of carrying out 'iteration'. The basic form of a WHILE loop is:
     while( some condition is true )
     {  do this
        do that
        do the other thing

Chapter 6 in the Java textbook, as well as Chapter 5 in the Karel++ book, discusses loops, including WHILE loops.

In this Karel program, use the WorldBuilder to create 'hurdles' of any height. East of all the hurdles, there is a beeper on street 1 that tells Karel (when he encounters it) that he is done. Here is the world I created:

Your program puts Karel at street 1 and avenue 1 and gets him to jump over each hurdle in order. Karel starts at street 1 in jumping each hurdle. When he encounters the beeper, he knows he is done and he turns off.

There is more information on writing the needed methods in SteepleChase.java, which you download below.


Starting Point

You can download SteepleChase.java to use as a starting point in writing your program.

You can download KarelJRobot.jar to your server space. Double-click on it to create a Karel world for your program to run in.