Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

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.

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M91409054
  • Price:- $50

Priced at Now at $50, Verified Solution

Have any Question?


Related Questions in Computer Engineering

Question suppose you are given a turing machine m not

Question : Suppose you are given a Turing machine M (not necessarily a decider), a string w, and a magic genie. You can ask the magic genie whether a certain Turing machine halts on a certain input string, and the genie ...

Question suppose that an application has m input variables

Question : Suppose that an application has M input variables and that each variable partitions the input space into N equivalence classes. The multidimensional partitioning approach will divide the input domain into how ...

The question is asking how to do it in linuxa scientist ran

The question is asking how to do it in Linux. A scientist ran an experiment that generated data that accumulated in a sequence of files: data1, data2, data3, data4 and data5. He wants to know how many lines of data he ha ...

Question suppose you are now acting as a consultant to an

Question : Suppose you are now acting as a consultant to an organization of your choice that has one or more specific compliance requirements. Considering this scenario, respond to the following: • Describe your selected ...

Williamnbspis interested in knowingnbspwhether or not

William is interested in knowing  whether or not athletics from his team have lower satisfaction with their team on a survey than the known population average survey score of 19  and the known population survey standard ...

Scenarioyour friend tim hall is an expert in creating

Scenario Your friend, Tim Hall, is an expert in creating websites. In Hall's opinion, creation of websites is now a simple task using tools such as Adobe Dreamweaver, and therefore, he does not feel the need to learn HTM ...

Write a program to ask the user to eithernbspselect 1 to

Write a program to ask the user to either  Select 1 to print the digits in an integer reversely  Select 2 to print the characters in a string reversely using a switch case, your program will either 1- call the recursive ...

Design a combinational circuit with three inputs a b and c

Design a combinational circuit with three inputs: A, B, and C, D and the output W. The output should be 1 only when the values of A, B interpreted as an unsigned integer (AB) is equal to the values of C, D interpreted as ...

Suppose that we have a block cipher and want to use it as a

Suppose that we have a block cipher and want to use it as a hash function. Let X be a specified constant and let M be a message consisting of a single block, where the block size is the size of the key in the block ciphe ...

1 what is the boolean expression for an and gate2 what is

1. What is the Boolean expression for an AND gate? 2. What is the Boolean expression for an OR gate? 3. What is the Boolean expression for a NOT gate?

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As