Grid Traversal Algorithm in C
The algorithm requests user to input rows(x) and columns(y) and grid’s value (grids value can be 0 or 1, if the value of the grid is 1 then it is blocked 0 means it is unblocked ) then it should provide the number of possible path to move from (1,1) to (x,y).
The problem is that my code is working fine. Still, it is not working as it was intended The algorithm is meant to move only to the right and down grid also it can jump over obstacles (Can jump over one grid), but for the input 3*3 grid, the input is 0 0 0, 0 1 1, 0 0 0 the output should contain the number of possible paths for this the output should be 3. It gives 3 but it is moving diagonally,
The path should be:can move from (1, 1) to (2, 1) and then to (3, 1) and finally to (3, 2) and then to (3, 3).
(3,2) is blocked so it should move from (3,1) to (3,3)
And another alternative is from (1, 1) to (2, 1) , and then to (2,3) and then to (3,3)
But the code consider the diagonal jump not the last path.