Advertisement
melnikovmaxim

KLENINA_spiral

Dec 16th, 2019
315
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 1.21 KB | None | 0 0
  1. //link https://yadi.sk/d/mW96jkaciYHsRg
  2.  
  3. uses graphABC;
  4. var x,y,r,h,i:integer;
  5. procedure zl(x11,y11:word);
  6. var z:integer;
  7. begin
  8. if (getpixel(x11,y11) <> rgb(0,0,0)) then
  9. begin
  10. setpixel(x11,y11,clred);
  11. if (getpixel(x11,y11+1)<> rgb(0,0,0)) or (getpixel(x11,y11-1)<> rgb(0,100,100)) then
  12. zl(x11,y11+1)
  13. else
  14. if (getpixel(x11-1,y11)<> rgb(0,0,0)) or (getpixel(x11,y11-1)<> rgb(0,100,100)) then
  15. zl(x11-1,y11)
  16. else
  17. if (getpixel(x11,y11+1)<>rgb(0,0,0)) or (getpixel(x11,y11-1)<> rgb(0,100,100)) then
  18. zl(x11,y11-1)
  19. else
  20. if (getpixel(x11+1,y11)<>rgb(0,0,0)) or (getpixel(x11,y11-1)<> rgb(0,100,100)) then
  21. zl(x11+1,y11);
  22. end;
  23.  
  24. end;
  25. begin
  26. r:=4; // размер и количе
  27. //cередина
  28. x:=325;
  29. y:=240;
  30. h:=0;//ifu
  31. repeat
  32. h:=h+1;
  33. for i:=1 to 2*h-1 do  //вправо
  34.  begin
  35.   x:=x+2*r;
  36.   line(x-2*r,y+r,x,y+r);;
  37.   sleep(0);
  38.  end;
  39. for i:=1 to 2*h-1 do //вниз
  40.  begin
  41.   y:=y+2*r;
  42.   line(x,y-r,x,y+r);
  43.   sleep(0);
  44.  end;
  45. h:=h+1;
  46. for i:=1 to 2*h-1 do//влево
  47.  begin
  48.   x:=x-2*r;
  49.   line(x,y+r,x+2*r,y+r);
  50.   sleep(0);
  51.  end;
  52. for i:=1 to 2*h-1 do//вверх
  53.  begin
  54.         y:=y-2*r;
  55.         line(x,y+r,x,y+3*r);
  56.  
  57.    sleep(0);
  58.  end;
  59. until y<=2*r;
  60. readln();
  61. zl(325+11,240+16);
  62. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement