Exercise
09/15/2006
|
Diagonal
|
Due: Tuesday, September 19 8am
|
Relevant Reading:
- Handout from class (not available on line) and class notes
-
Chapters 5 and 6 of the Karel J. Robot text
Assignment: (worth 10 exercise points)
Get the ex09-15.zip file. Use the
files
in this folder as your basis for this assignment.
You
are to modify the program such that the robot picks up a pile of
beepers located in a corner of a square room and lays them down on a
diagonal of the room. You are to create and utilize at
least one new subclass of Robot in order to achieve this task.
- All worlds contain one square room of varying size with no openings through which a robot might “accidentally” escape.
- In one of the four corners of the enclosed room (southwest,
northwest, northeast, southeast) is a pile of beepers that contains
exactly enough beepers for a robot to use to lay a diagonal line of
beepers from the southwest corner of the room to the northeast corner
of the room if the robot lays one and only one beeper per corner.
- The user chooses the world (this is already done). Worlds are box1, box2,box3,box4, and box5.
- The robot should start off at the intersection
(1,1). The initial direction the robot faces is up to
you. The robot should start off with no beepers.
- The robot should find the beeper pile and lay a diagonal
line of beepers from the southwest corner of the room to the northeast
corner of the room.
- The robot must move to the southeast corner of the room when it has finished laying the line of beepers.
- The robot must be turned off.
- The code you add to Application should be rather short and
uncomplicated. In particular, you probably want any loops or ifs
to be located inside your new class.
Remember:
- In the comment at the top of each file that you create or modify, be sure to put your name.
- Each method you write should have a comment that says what the instruction does.
- At the top of .java file with your new subclass(es), you should add to the comment what behaviors you have added to the robot.
- You are permitted to talk with others in this section
regarding how the program works. However, you need to do the
actual work yourself and understand the answer that you produce.
Handin:
-
Be sure to read the general handin instructions on the exercises page.
-
Rename the folder containing all of the files to be
"lastname-firstname-100SectionLetter-diagonal". For example, if I were in Section Z, I would rename my folder to
be: "McElfresh-Scott-100Z-diagonal"
(without the quotes).
- Create a zip file of this folder, with the same name as the folder (except
with the .zip ending this time). Instructions for zipping can be found in
the system and software handouts linked on the main course page.
- Submit this file via the electronic
handin. If you have problems, contact me.
|