Advertisement
Guest User

Untitled

a guest
Jun 26th, 2017
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 1.25 KB | None | 0 0
  1. uses crt;
  2.  
  3. var input : text;
  4.     x, y, d, x2, y2 : integer;
  5.     i, j, k, n : byte;
  6.     povel : char;
  7.  
  8. Begin
  9.   clrscr;
  10.   assign(input,'SKOLA.IN');
  11.   reset(input);
  12.   GoToXY(2,2);
  13.   writeln('Votrelci idu! ZENITaci pozor si dajte!');
  14.  
  15.   read(input,x,y);
  16.   readln(input);
  17.   GoToXY(x,y);
  18.   while not eoln(input) do
  19.     Begin
  20.       write('.');
  21.       read(input,povel);
  22.       case povel of
  23.       'W': y := y-1;
  24.       'A': x := x-1;
  25.       'S': y := y+1;
  26.       'D': x := x+1;
  27.       end;
  28.       GoToXY(x,y);
  29.       write('A');
  30.       GoToXY(x,y);
  31.       if (ord(povel) >= ord('1')) and (ord(povel) <= ord('9')) then
  32.       Begin
  33.          d := (ord(povel)-48)*2+1;
  34.          n := ord(povel)-48;
  35.          x2 := whereX-n;
  36.          y2 := whereY-n;
  37.          GoToXY(x2,y2);
  38.          for i := 0 to n-1 do
  39.              Begin
  40.                   for k := 1 to d do
  41.                       Begin
  42.                            for j := 1 to d do write(i);
  43.                            GoToXY(x2,whereY+1);
  44.                       end;
  45.                    if d <= 1 then break;
  46.                    x2 := x2+1;
  47.                    y2 := y2+1;
  48.                    d := d-2;
  49.                    GoToXY(x2,y2);
  50.              end;
  51.       end;
  52.      end;
  53.   close(input);
  54.   readln;
  55. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement