Lab04

pdf

School

University of California, Berkeley *

*We aren’t endorsed by this school

Course

MISC

Subject

Computer Science

Date

Feb 20, 2024

Type

pdf

Pages

1

Uploaded by GrandMoonTrout26

Report
CS2173 Lab 04 0. A Netbeans project for Lab04 has been provided as a starting point. Do not modify the SearchViz package unless you encounter a bug that you need to work around (and in this case notify me immediately!). Do not modify the tests at the top of Lab04 main, except to comment and uncomment them as needed. public interface SearchNode { public LinkedList<SearchNode> getChildren (); // All possible improvements on current solution public double getCost (); // Number indicating opposite of quality of the solution public boolean goalAchieved (); // Is the solution at this node partial or complete? } 1. Code a Lab04SearchNode class that implements the SearchNode interface. Here is the required signature for the Lab04SearchNode constructor: public Lab04SearchNode(SearchViz.Terrain[][]map, Path path1, int xAdd, int yAdd, int xGoal, int yGoal) Note: Cost is time in minutes for a 50 kph tracked vehicle as considered in the previous lab. Use Manhattan (L1) distance to estimate the time from the end of the path to the goal. The L1 distance from (x1,y1) to (x2,y2) is abs(x1-x2)+abs(y1-y2). Add in the following methods: String toString () : print the path and path cost Path getPath () : returns the path contained in the node 2. Gradually uncomment the tests in Lab04.main to produce output as close as possible to the console output (at bottom of Lab04 file) and visualization (result.png) provided. 3. Add your own test at the bottom of Lab04.main. Choose a path somewhere else on the map so there will be no conflict with the visualization you just got working. Visualize the search node's path and the end points of its child nodes as done in the test already present in Lab04.main. You do not need to replicate all the printing tests unless you find it helpful.
Discover more documents: Sign up today!
Unlock a world of knowledge! Explore tailored content for a richer learning experience. Here's what you'll get:
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help