Exercise - inclass
09/15/2006
|
Moving Beepers
|
Due: Friday, September 15 end of class
|
Work on this exercise in class and ask any questions you may
have. You are welcome to talk to each other about this. If you do not finish, turn in what you have before
leaving the room and submit a complete version by Monday at 8am.
If you finish this before class is over, you should work on another exercise.
Assignment: (worth 2 exercise points)
1) Take a look at the handout code on paper. With a
partner, try to create Execution Equivalent code that is shorter and
more concise. Put your name(s) on the paper and hand in
your answer.
2) Get the ex09-15-inclass.zip file. Use the
files
in this folder as your basis for this assignment. Complete the application to do the following:
Specifications:
- Ask the user for the name of a world.
- A robot starts at the origin (1,1) with no beepers in the
beeper bag.
- Directly north of the robot at an unknown distance is a pile of
beepers – move the robot to the beeper pile.
- Have the robot pick all of the beepers – the number of beepers
in the pile is unknown.
- Directly to the East on the same street as the beeper pile that
the robot just picked is a vertical (North/South) wall – the distance
to this wall is unknown. Move the robot to the wall.
- Face the robot South and have the robot put one beeper on every
intersection on the avenue extending to the South including
the intersection on which the robot is now standing. It is
guaranteed that there is enough room to put down every beeper in the
bag at one beeper per intersection between the robot’s current location
and the southern boundary wall.
- Return the robot to the original starting position – the final
direction the robot faces in not specified in this assignment.
Notes:
- Be sure to include comments as appropriate in your .java files.
- You are not required to create a new robot class, but you may do so if you wish.
Testing:
Be sure to test your program on all five provided worlds (beeps1.txt,
beeps2.txt, beeps3.txt, beeps4.txt, and beeps5.txt).
There should be no error shutoffs in any of the five
worlds.
Handin:
- Question 1 should be handed in on paper. The rest of the instructions are for Question 2.
- 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-piles". For example, if I were in Section Z, I would rename my folder to
be: "McElfresh-Scott-100Z-piles"
(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.
|