Assignment 4 1. (30 points) Make a copy of the Pathfinder project from Chapter 5. In the copy, find where Heuristic_Euclid is defined (look in the common folder), and change the method so that it approximates the Euclid distance with a linear approximation. Remember from class that if (x,y) is a 2D vector, a linear approximation to it's length is given by the formula let u = max(abs(x), abs(y)) let v = min(abs(x), abs(y)) distance = u + 0.336358*v or distance = 0.960434*u + 0.397825*v The first approximation formula has a maximum error of 5.5%, and the second approximation formula has a maximum error of 4.0%. You only have to use one of the approximation formulas, and it is your choice as to which one you use. Run the modified copy using the A* algorithm with the source and target far apart from each other and in different columns and rows from each other so that lots of red lines appear (paths that are explored but not part of the final solution). Note the time it took to find the lowest-cost path (shown at the bottom of the window). Run the original pathfinder project with the source and target in the same place as they were when you ran the modified copy. Email to the TA a screen capture of the run of the modified copy, and the times taken by the two runs. We are trying to see how much faster the linear approximation is to the original Euclid formula. 2. (60 points) The ScriptedStateMAchine project from Chapter 6 implements a simplified version of WestWorld1 project from Chapter 2. Right now minor Bob has three states he can be in: GoHome, Sleep, and GoToMine. Make a copy of the ScriptedStateMachine project and modify it by adding two new states in the Lua script: QuenchThirst and VisitBank. These should be comparable to the QuenchThirst and VisitBankAndDepositGold states in the WestWorkd1 project, only now they are written in the Lua script file. You will also have to make some minor changes to the java files as well (at least in Main.java and Miner.java). Run the modified copy project, get a screen capture showing a part of the generated dialog in which is shown the statements produced by both of the new states at least once. Send to the TA a document showing that screen capture and the segments of code you added to the project. (You don't have to include whole files, only the parts of the files you added or changed.)