Advertisement
ncot_tech

Turbo Pascal 2 CP/M Mandelbrot

May 18th, 2020
1,314
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 1.11 KB | None | 0 0
  1. program Mandy;
  2. {$U+}
  3.  
  4. label
  5.      break;
  6.  
  7. var
  8.    maxIter: Integer;
  9.    chars: String[21];
  10.    x: Integer;
  11.    y: Integer;
  12.    creal: Real;
  13.    cimag: Real;
  14.    zReal: Real;
  15.    zImag: Real;
  16.    count: Integer;
  17.    zm: Real;
  18.    zn: Real;
  19.    zl: Real;
  20.    zr2: Real;
  21.  
  22. begin
  23.      maxIter := 20;
  24.      chars := ' .,"~!^:;[/<&?oxOX#    ';
  25.      for y := -39 to 39 do
  26.      begin
  27.           for x := -39 to 39 do
  28.           begin
  29.                creal := x / 20;
  30.                cimag := y / 20;
  31.                zReal := creal;
  32.                zImag := cimag;
  33.                count := 1;
  34.                repeat
  35.                   2  zm := zReal * zReal;
  36.                      zn := zImag * zImag;
  37.                      zl := zm + zn;
  38.                      if (zl > 4) then goto break;
  39.                      zr2 := zm-zn+creal;
  40.                      zImag := zReal * zImag *2+cimag;
  41.                      zreal := zr2;
  42.                      count := count + 1;
  43.                until count>maxIter;
  44.                break:
  45.                   write(chars[count+1]);
  46.           end; (* For x *)
  47.           writeln('');
  48.      end; (* for y *)
  49. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement