goal.
The goals of this assignment are to:
program.
A robot and a treasure are located somewhere in a room (which is empty
except for the robot and the treasure).
The floor of the room is covered with square tiles, so you can think
of the room as having a giant piece of graph paper covering its floor.
The robot and the treasure each occupy a different tile in this grid,
and you know the location of each one.
The locations are specified using (x,y) coordinates.
Your job is to write a program that will take the coordinates of the
robot and the treasure and then determine and provide directions to the
robot for how to travel to the treasure.
You can assume that the robot begins by facing in the positive Y
direction.
Your output will say something like "go forward 3 tiles, turn left,
go forward 4 tiles".
You enter the coordinates using command-line arguments, as we did in class.
So, your program has to do the following:
You can assume that the input values are all whole numbers. Your calculated outputs should be whole numbers in terms of the number of tiles to travel in each direction.
sample run.
Below is a sample run for two cases.
The unix command line is highlighted in bold font.
unix$ java hw1eis2003 0 0 3 3 robot is at (0,0) treasure is at (3,3) go forward 3 tiles, turn right, go forward 3 tiles, stop. unix$ java hw2eis2003 4 3 2 1 robot is at (4,3) treasure is at (2,1) turn around, go forward 2 tiles, turn right, go forward 2 tiles, stop.
source code.
Your source code (i.e., your .java
file) must be neat and
clearly commented.
You must have a header comment and you should comment the end of each
block (i.e., each }
).
submission.
points.
This assignment is worth 15 points (out of 100 for the semester).
Distribution of points is: