WR Home      Topic Home      Chapter:  1  2  3  4 
<Previous Next>

Chapter 04

Reachability Test

Page 4

Reason for unreachablity


The previous program output only illustrated that a given set of (dx, dy) isReachable or not. It would have been more informative if it also gave the reason for un-reachablity.

Example:
Previous Output: Boolean Desired Output: Color shows the reason
Boolean With Reason of Un-reachablity

NOTE: The area shown in Yellow is also reachable, but will not be used practically, so it is considered as un-usable.
Can you modify the previous program and function to output as above.

A simple MATLAB® code is provided below:
main_009.m is to be executed.

Click here to download the code
Click here to view the code and its output.

Can you modify the code for faster execution, sample output is shown below:
Optmized for fast execution

The code for time optmization is given below. In order to reduce the execution time, the variables row and col are incremented by y_step and x_step instead of 1.

main_010.m is to be executed.
Click here to download the code
Click here to view the code and its output.



WR Home      Topic Home      Chapter:  1  2  3  4 
<Previous Next>