N = 100;
randomness = 0;
% M = rand(N);
% threshold = 0.4;
% M(M<threshold) = 0;

M = rand(N);
M(N/2, 1:45) = 100
M(N/2, 55:N) = 100;
% 
% M = rand(N);
% M(30:70, 30:70) = 100;

colormap(gray);
axis equal
imagesc(M);
pause(2);
saveas(gcf, ['river1/', '0', '.png']);

costs = seam(M);
trace(M, costs, randomness);