Advertisement
caeles-lupus

q200189966

Apr 27th, 2017
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 0.83 KB | None | 0 0
  1. uses graphabc;
  2. const n=10000;
  3. type TCell=record
  4.   x,y:integer;
  5. end;
  6. var
  7.   m:array[1..N] of byte;
  8.   i,x,y,x0,y0:integer;
  9.  
  10. BEGIN
  11. x0 := windowwidth div 2;
  12. y0 := windowheight div 2;
  13. Window.Width := 500;
  14. Window.Height := 500;
  15. MoveTo(x0,y0);
  16. SetPenColor(clWhite);
  17.  
  18. // формирование пути
  19. //write('Путь: ');
  20. for i := 1 to N do begin
  21.   m[i] := random(8)+1;
  22.   //write(m[i],' ');
  23. end;
  24.  
  25. // определение координат
  26. for i:= 1 to N do begin
  27.   case m[i] of
  28.   1: x := x-1; //left
  29.   2: y := y-1; //top
  30.   3: x := x+1; //right
  31.   4: y := y+1; //bot
  32.   5: begin x := x-1; y := y-1; end; //left-top
  33.   6: begin x := x+1; y := y-1; end; //right-top
  34.   7: begin x := x+1; y := y+1; end; //right-bot
  35.   8: begin x := x-1; y := y+1; end; //left-bot
  36.   end;
  37.   LineTo(x0+x,y0-y);
  38.   SetPenColor(clBlack);
  39. end;
  40. END.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement