378 Supporting On Demand Business Applications with the IBM Problem Determination Tools
Note that the land(1,1) entry has been rewritten. Obviously there must be something
wrong with rank(1,1). Take a look by compressing land in the locals window and selecting
rank, as shown in Figure 14-40.
Figure 14-40 Debug Tool - PLI - Remote debugger - looking at the value of rank(1,1)
12.Remember that a 0 value at a rank position indicates a position to which the knight should
not go. However, rank(1,1) has a value of 1. The problem is that the value of rank is not
being set to 0 once it has been used as a landing point in the path. Modify the code to add
the following statement at line 169:
rank(r,c) = 0;
This means that used squares are marked out of bounds and will not be selected, as
shown in Example 14-6.
Example 14-6 Final code change to fix the knight code
else;
end;
/********************************************************/
/* make the move */
/* */
/********************************************************/
rank(r,c) = 0;
r = r + rowjump(minmove);
c = c + coljump(minmove);
m = m + 1;
land(r,c) = m;
end;