Computer Science 3675
Fall 1999
Programming Assignment 7

Due: Dec 6, 5:00pm For this assignment, look at the Java applet /export/stu/3675/robot/RobotSim.java. That applet creates two robots of the same kind and moves them around the screen. It must avoid an obstacle, shown as a square, and it tries to find a goal, shown by an X.

The robot that is implemented moves in a random direction. You are to replace one of the robots by a robot that uses a different search strategy. Your robot should not use randomization at all, but instead should have a deterministic strategy.

Your robot must use a strategy that will find the goal even if the goal is moved to someplace other that where it is currently, and also if the obstacle is moved. It is not allowed for the robot to look directly at the data concerning the position of the obstacle or the goal.

Implement the new robot by extending class Robot. That is, add a new class. You should not need to modify ANY of the code that is present with the exception of the code at the end that creates the robots. Instead of creating two random robots, create one random robot and one of your robots. Also, you can modify the images of the robots if desired.

To compile your program, use the Java compiler, called javac. For example, type

    javac RobotSim.java
The compiler will produces files with extension .class, one for each class in your package.

To run your applet, you can either use the appletviewer or you can put your robot class in your directory called public_html. (If you don't have such a directory, create one.) Copy file RobotSim.html and the gif files to that directory as well. Be sure that the .class files generated by the Java compiler are in that directory. Then visit http://stymie.math.ecu.edu/~youraccount/RobotSim.html on stymie with a web browser, where youraccount is replaced by your account name. The applet should start on its own. Be careful: sometimes, after you update the .class files, the web browser will used cached copies, and so will continue to run the old one. If all else fails, kill the browser and start a new one.

This simulation is fairly crude. The graphics is simple, and it does not offer you a way to stop the simulation except by going to another page. Enhance it if you like. If you want to make the random robots move a little faster or slower, you can. Fix the wait loop.

Note. If stymie does not respond to the web browser, then there is something wrong with its http server. Let me know.