Computer Science 3675
Summer 1999
Programming Assignment 7

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.

Implement the new robot by extending class Robot. 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, 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 RobotSim.html with a web browser on stymie. If you have put the files directly in your public_html directory, and your account is myaccount, then you visit page stymie.math.ecu.edu/~myaccount/RobotSim.html. The applet should start on its own.

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, you can. Just make them move more pixels at a time.

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