I am developing a program in Pascal that takes a matrix and assigns to each box the average of the 4 adjacent quasi-squares during n repetitions.
for contador:= 1 to itera do
begin
for i := 0 to width-1 do
begin
for z := 0 to height-1 do
begin
if(mapnew[i][z].modifi) then
mapnew[i][z].pot := ( map[i+1][z].pot+map[i][z+1].pot+map[i-1][z].pot+map[i][z-1].pot)/4;
end;
end;
map:= mapnew;
end;
The problem is that when I execute it and print the matrix with which I work, I get the modified Nan values. I know it's not a number, but I'd like it to show the result but I do not know how to modify it.