Programming assignment-the pathfinder

Assignment Help Basic Computer Science
Reference no: EM13839233

Programming Assignment

The Pathfinder

Problem Statement

The following grid of ones and zeroes is a double scripted array representation of a terrain of size 12 x 12.

1200_Array representation of a terrain of size.jpg

The ones represent the obstacles if the field, and the zeroes represent positions in the possible path through the field.

In this assignment, the field will have a single entrance and a single exit, i.e., there will be only two zeroes in the "outer wall" of the field. In order to find the entrance and the exit, traverse the outer wall of the field in the counter-clockwise direction, starting from the upper left corner. The first encountered zero will be the entrance (square [2,0] in the field above), and next zero will be the exit (square [4,11]). In this assignment, the size of a field is NOT FIXED, it MAY NOT BE A SQUARE array. Each array dimension will vary in size between 5 and 200.

There are several simple algorithms for walking through a field that guarantee finding the path, if one exists. The only legal moves are north, west, south or east (no diagonal moves). For example, look to your right and walk forward. Always keep the obstacle to your right. If you reach the corner of the obstacle, turn right and continue following its "border" on your right side. There may be a shorter path than the one you have taken, but in this way you are guaranteed to get out of the field. In this algorithm, if you exit from the field through the entrance, this means that the path from the entrance to the exit does not exist. Otherwise, the algorithm has
found a path that avoids all obstacles. In your assignment, you need to write a program called path.c. First of all, the program should ask user to type in the size of the field (if you enter 12, 6, this will imply a 12 rows and 6 columns field). Then the program
should request the user to type in the name of the input file that contains the field (the code for reading the file is offered to you on Moodle). You may assume that the field size given to the program always matches the size in the file. The field will be given to your program in an ASCII text file, looking very much like the one above (but of proper size). Upon opening the file, your program must find the entrance. As your program attempts to find a path through the field, it should place the character X into each square visited in the path. Note that your program MUST NOT replace a 1 (an obstacle) with an X. Only zeroes can be replaced by X's. Before exiting,
your program must display the traversed path, that is, the path between the entrance and the exit (the path is marked by X's). Your program must also report whether the path was found or not.

In case of the field from the figure above, the path could not be found and your program would provide the following output:

2047_entrance and the exit.jpg

No path found.

Reference no: EM13839233

Questions Cloud

Rf behavior calculations : In this Lab, students use an online calculator to compute power, cable loss, antenna gain, free space path loss, link budget, and Fresnel zone clearance.
Describe the role of a systems analyst : First, in general terms describe the role of a systems analyst, then demonstrate your understanding, by providing examples of that role in the context of the workplace situation in your source.
What are the variance and expected return : What are the variance and expected return of an equally weighted portfolio of all five securities?
Calculate the companys total weekly gross profit : Calculate the company's total weekly gross profit assuming the table cleaner is not processed further. Calculate the company's total weekly gross profit assuming the table cleaner is processed further.
Programming assignment-the pathfinder : The following grid of ones and zeroes is a double scripted array representation of a terrain of size 12 x 12.
Why do those two examples represent luxury to you : What represents luxury to you and focus on two (2) examples of luxury when explaining what represents luxury to you, Why do those two examples represent luxury to you, and how does price impact that perception
Vocabulary development within the pre-production : Describing the benefits of strategies that encourage vocabulary development within the pre-production and early production stages of language acquisition. These strategies should transcend all content areas.
Calculate the divisional margin for the year : Calculate the divisional margin for the year. Calculate the DuPont ROI, and evaluate the performance of Global Resources in relation to the expected performance. Calculate the residual income.
Describe penn jillette''s use of ethos and logos : Describe Penn Jillette's use of ethos, logos, and pathos in the article "There Is No God." What assumptions has he made about his audience. How can you tell

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Alter computation of prefix function-correctly match string

if ‘_' is wild-card, then pattern ‘foo*bar*nad' can be found in ‘foofoowangbarnad'. Alter computation of prefix function to correctly match strings using KMP.

  Create a short text-based adventure game

In this assignment you will create a short text-based adventure game. The user is presented with a short text description of the state of the game and a small set of alternative actions to take.

  Make sure the formatted string contains only 2 digits

Make sure the formatted string contains only 2 digits following the decimal point. Store the formatted string into a String variable called str.

  Draw a flowchart and write the pseudocode

Draw a flowchart and write the pseudocode - calculate the average grade for each class and how many student''s grades are above and below that average.

  Explain your hypothesis of what has occurred

Determine your next steps chronologically in investigating this issue and describe the parties you would involve and the extent of their involvement - explain your hypothesis of what has occurred.

  What is the command you would use to compile the file

What is the command you would use to compile the file Addition.java?

  Fresh data instead of requiring web page to reload

Tim O'Reilly, "Web 2.0 is a loose collection of information technologies and applications, plus the web that use them" (Rainer, p. 174). Some 2.0 web sites are AJAX, tagging, blogs, and wikis. AJAX: "is a Web development technique that allows p..

  Find out the number of candidate keys

Find out the number of candidate keys

  The beginning of the description of the function

From the same code you provided me with, can you complete the following: Use pseudocoding and (optionally) flowcharting to describe the flow of the main program. If there are functions that support the main flow describe separately in sub sections of..

  Examine the interview structure presented in the sequencing

Examine the interview structure presented in the sequencing

  Find all the information for the homework

Have to write a small program that prompts the user to enter a temperature in degrees Fahrenheit and then prints a massage as to whether Attached you will find all the information for the homework.

  Describe the impact of software development

Explain the technologies that have contributed to the exponential growth of the Internet and the World Wide Web (WWW). Describe the impact of software development, and computing technologies on business productivity

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd