In this assignment, we shall use Pro-Bot to do a treasure hunt. We shall work with a graph and use XY coordinates to specify the points where the treasures are located. We shall also think of ways of optimizing our paths to get to the various locations.

The minimum distance that Pro-Bot can traverse is 1cm. Hence, the graph paper that you use should have grids of a minimum dimension of 1cm x 1cm. If not, you can always draw your own set of XY axes and put in coordinates 1 cm or more apart. You can then set each step of Pro-Bot to be the distance between successive points on your XY axes.

Computer Science concepts involved: Sequential programming, Optimization

Math concepts involved: XY coordinates, Measuring distances on a graph, Finding shortest path between points, Cost comparison, Angles

Grade levels: 3, 4, 5

Hours required: 1 or more

###
**Compare and Contrast Different Paths for Pro-Bot’s Treasure Hunt**

Pro-Bot is going on a treasure hunt. It has been told the coordinates at which the treasures are kept. Can you write the programs for Pro-Bot to get to the treasure?

Let us start with Pro-Bot placed at location (0, 0).

- The first treasure is located at the coordinates (3, 4). Can you write a program for Pro-Bot to get to this point by traveling
*only along horizontal and vertical paths*(i.e., turns only at 90 degrees)? There are no limits on the number of units of horizontal or vertical distance that Pro-Bot can travel continuously at a time. Remember that Pro-Bot starts its journey from location (0, 0). - What is the total distance traveled by Pro-Bot in your above program? Is there a shorter path for Pro-Bot to reach the point (3, 4) from its starting point of (0, 0), if you did not have the condition that Pro-Bot can only travel along horizontal and vertical paths?
- Can you write a program for Pro-Bot to travel along your new shorter path to get to the point (3, 4)? Assume that Pro-Bot is facing the X-axis at the start point.
- If gas costs $3.00 per gallon, and Pro-Bot uses a gallon of gas per step, how much did it cost for gas using your first program? How much did it cost by using your second program with the shorter path? How much money did you save?

**A second treasure for Pro-Bot:**

- There is a second treasure located at the coordinates (6, 8). If Pro-Bot has to pick up the second treasure soon after the first one, what path would it take under the condition that it can only use horizontal and vertical paths (i.e., turns only at 90 degrees)? Can you modify your first program to allow Pro-Bot to pick up both treasures, with the starting point at (0, 0)?
- What is the total distance traveled by Pro-Bot now in your above program? Is there a shorter path for Pro-Bot to reach both points ((3, 4) and (6, 8)) from its starting point of (0, 0), if you did not have the condition that Pro-Bot can only travel along horizontal and vertical paths?
- Can you write a program for Pro-Bot to travel along the shorter path to get to both the points (3, 4) and (6, 8)? Assume that Pro-Bot is facing the X-axis at the start point.
- If gas costs $3.00 per gallon, and Pro-Bot uses a gallon of gas per step, how much did it cost for gas in your first program where you traveled only along horizontal and vertical paths? How much money did it cost using your second program with the shorter path? How much money did you save?

###
**A Different Spin on Pro-Bot’s Treasure Hunt**

Let’s try a variation on our treasure hunt. This time, we have an extra condition:

*Pro-Bot can take only one step (or 1 unit) at a time in any direction.*

For example, to get to a point with coordinates (2, 1), Pro-Bot cannot travel 2 cm straight along the X axis; it can take 1 step horizontally along the X axis, and then move up 1 step and then turn and move 1 step horizontally to get to (2, 1).

- Can you write a program for Pro-Bot to get to the treasure at location (3, 4) starting from (0, 0) with the condition that you can take only one step at a time in any direction. Do you travel more distance to get to the treasure under this condition?
- If gas costs $3 per gallon and Pro-Bot uses a gallon of gas per step, how much does it cost to get to the treasure?
- Can you write a program for Pro-Bot to get to the treasure at location (6, 8) starting from (0, 0) with the condition that you can take only one step at a time in any direction.
- If gas costs $3 per gallon and Pro-Bot uses a gallon of gas per step, how much does it cost to get to the treasure?
- Can you write a program for Pro-Bot to get to the treasure at location (6, 8) starting from (3, 4) with the condition that you can take only one step at a time in any direction.

## No comments:

## Post a Comment