function  z  =  rwalkfill2(xvec,yvec,zvec,n)
   
figure;
hold on;
set(gca,'XTick',[-n-1:1:n+1]);
set(gca,'YTick',[-n-1:1:n+1]);
axis([-n-1 n+1 -n-1 n+1]);
%axis equal;
axis square;
grid on;
xlim([-n-1 n+1]);
ylim([-n-1 n+1]);

line([-n n n -n -n],[-n -n n n -n],'Color','k');
for ii=1:length(xvec)
  xv=xvec(ii);
  yv=yvec(ii);
  zv=zvec(ii);

  ya= xv-0.10;
  yb= yv-0.20;

  ga= xv-0.10;
  gb= yv+0.20;

  ba= xv-0.20;
  bb= yv-0.05;

  ca= xv+0.20;
  cb= yv-0.05;

  if (ii ==1)
     rectangle('Position',[xv-0.5 yv-0.5 1.0 1.0],'FaceColor','r');
  else
    if  (ii ==length(xvec))
        rectangle('Position',[xv-0.5 yv-0.5 1.0 1.0],'FaceColor','b');
    end
    switch (zv)
    case 'n'
      text('Position',[ya yb],'String',num2str(mod(ii-1,100)),'FontSize',9);
    case 's'
      text('Position',[ga gb],'String',num2str(mod(ii-1,100)),'FontSize',9);
    case 'e'
      text('Position',[ba bb],'String',num2str(mod(ii-1,100)),'FontSize',9);
    case 'w'
      text('Position',[ca cb],'String',num2str(mod(ii-1,100)),'FontSize',9);
    end
  end
end
  z=length(xvec);
  hold off;
end
