3
Drainage
•Given an nxn array A, “plot” the drainage map from the highest to the lowest point, if it exists
•Declarations …
•
•program drainage;
•config var n : integer = 50;
•region     R = [1..n,1..n];
•direction no = [-1, 0]; ne = [-1, 1];
•     ea = [ 0, 1]; se = [ 1, 1];
•     so = [ 1, 0]; sw = [ 1,-1];
•     we = [ 0,-1]; nw = [-1,-1];
•var      A : [R] integer;
• Tu,Td,Up,Dn : [R] Boolean;