%
% make a maze
%

function maze = amaze(m)
maze = ones(m);
p = 1;
figure(1)
axis([0 m 0 m])
grid on
disp(' ')
disp('  Click on SW & NE corner of obstacle')
while p
  xyc = ginput(2);
  xy = ceil(xyc);
  maze(xy(1,2):xy(2,2),xy(1,1):xy(2,1)) = 0;
  xi = [floor(xyc(1,1)) ceil(xyc(2,1)) ceil(xyc(2,1)) floor(xyc(1,1))];
  yi = [floor(xyc(1,2)) floor(xyc(1,2)) ceil(xyc(2,2)) ceil(xyc(2,2))];
  fill(xi,yi,[0 0 0]);
  axis([0 m 0 m])
  grid on
  hold on
  p = input('continue? (1 or 0)');
end
maze = maze';
