Navigate a Maze

10 points

In this program, you create a maze and then finish a program that allows a user of your program to navigate a KarelJ robot through the maze. The user will use the 4 arrow keys to move the robot. It is built into KarelJRobot that the robot dies if it hits a wall. You might start by creating a maze, for which you'll need the KarelJRobot.jar file. To reach it, go to the Desktop and choose Developer Tools. Choose "ext shortcut." Choose KarelJRobot.jar.

Here is an example of a maze:

 

Here is a more challenging maze, designed by DL '22:

The beeper indicates the robot's target destination. When the robot reaches the destination, a box pops up telling the user how long it took them to navigate the robot through the maze.

 

Starting Point

You can download KarelKeys2.java to use as a starting point in writing your program. You should also download StopWatch.java which will enable you to time the robot's trip through the maze. Put both files into a project.

Instructions for writing the code are given in KarelKeys2.java.