This  assignment lets you build a set of classes to support a program to find  paths through a cave. By the end of Unit 4, you will have a program that

This  assignment lets you build a set of classes to support a program to find  paths through a cave. By the end of Unit 4, you will have a program that  can read a 2-dimensional cave layout from a file, search the layout to  find a path to a mirror pool, then print the path to take. This unit,  you will build the infrastructure for this project, including  storing  data in a two dimensional structure, searching the data structure for a  simple path from start to finish and reading data from a text file.

Preparation

See the announcements for the link to the GitHub repository for this assignment. 

Directions

Write a class CaveExplorer, that has the following methods:

  1. Constructor  with no parameters. It should create the two-dimensional structure  shown below, where the characters in the layout are ‘R’ for rock, ‘.’  for a clear path, ‘M’ for mirror pool, and ‘S’ for self. This  constructor hardcodes the cave without reading from a file.
  2. toString  – no parameters, returns a string (including new lines) showing the  current state of the cave exploration. For the initial configuration,  this string would be”RRRRRR\nR..SRR\nR.RRRR\nR.MRRR\nRRRRRR\n”
  3. solve  – no parameters, returns a boolean true if there is a path to the  mirror pool, and false if there is not. This method is where you will  spend some time figuring out the logic. Even though there is only one  path, you still have to search in four different directions and make  sure you don’t get caught in an infinite loop. How you do this is up to  you.
  4. getPath – no parameters, returns a String showing the path  taken to get to the mirror pool. In the example, this path would be the  string of directions “wwsse” for West, West, South, South, East. The  method should return the empty string if there is no path.
  5. Constructor  with one String parameter – the name of a text file with the cave  layout. The file has a line with two integers, the number of rows and  columns of the cave layout, followed by the layout itself.  For  exampleYou will have to modify the text file with the cave data using  your favorite editor. Your cave layout should contain a path requiring  at least 4 moves in two different directions. There must be exactly one  path through the cave, that is, from any location, there is only at most  one location to move to next that hasn’t already been visited. If you  need help reading from a file, there are many resources on the web  regarding using the Scanner class to read text data. A short one is the   section on Scanners at to an external site.)
  6. main  – test your class by writing a main method that creates at least 2  CaveExplorer objects, solves each one, then prints the starting layout,  the final layout, and the path taken, if it exists, for each one. Be  sure to follow this order of operations.

Share This Post

Email
WhatsApp
Facebook
Twitter
LinkedIn
Pinterest
Reddit

Order a Similar Paper and get 15% Discount on your First Order

Related Questions

This week, you will submit the second project, the Desktop Migration Proposal. Using the requirements analysis your manager provided and the Internet

This week, you will submit the second project, the Desktop Migration Proposal. Using the requirements analysis your manager provided and the Internet research you conducted, submit your recommendation to the assignment folder. As you are writing your recommendation, ensure your analysis and recommendations align with your manager’s priorities and concerns.

Comparing and contrasting space and time complexity in algorithm analysisWhen performing an algorithm analysis, **time complexity** and **space

Comparing and contrasting space and time complexity in algorithm analysisWhen performing an algorithm analysis, **time complexity** and **space complexity** are two of the most significant variables to consider. Although they both gauge an algorithm’s efficiency, they focus on distinct areas of performance.**Time complexity** is the relationship between an algorithm’s execution

Career Focus (Required/Graded) SubscribeThe CompTIA A+ certification demonstrates to employers that you have the knowledge, ability, and skills in

Career Focus (Required/Graded) SubscribeThe CompTIA A+ certification demonstrates to employers that you have the knowledge, ability, and skills in entry-level PC technology. Many industry insiders started with the CompTIA A+, and that led them to higher-paying, more complex jobs in both IT and cybersecurity. Many large corporations such as Apple, Cisco,

CompTIA’s T/S Methodology (Required/Graded) SubscribeFor this discussion, you will be assessing the following help desk ticket below from Chikako

CompTIA’s T/S Methodology (Required/Graded) SubscribeFor this discussion, you will be assessing the following help desk ticket below from Chikako (connectivity issue). Use the CompTIA 6-step troubleshooting process below to help figure out the connectivity issue. CompTIA 6-Step Troubleshooting Process: Identify the problem. Establish a theory of probable cause. Evaluate the theory

Accounting: Business and finance: computerscience: Economics: Marketing: Social Science Am a professional academic writer, content creator and, copywriter

Accounting: Business and finance: computerscience: Economics: Marketing: Social Science Am a professional academic writer, content creator and, copywriter with 7 years of research based experience.  My accounting: Business and finance: computerscience: Economics: Marketing: Social Science Am a professional academic writer, content creator and, copywriter with 7 years of research based

Explain why we cannot corrupt the output buffer of Buffovrflw_Demo4 through we can trigger a segmentation fault We cannot corrupt the output buffer of

Explain why we cannot corrupt the output buffer of Buffovrflw_Demo4 through we can trigger a segmentation fault We cannot corrupt the output buffer of `Buffovrflw_Demo4` because the program is likely designed with protections such as stack canaries, non-executable stack, or address space layout randomization (ASLR). These mechanisms prevent direct buffer