home *** CD-ROM | disk | FTP | other *** search
- { Zeichnet Apfelmaenchen = Mandelbrot-Menge }
-
- PROGRAM apfelman;
-
- CONST
- xres = 560;
- yres = 200;
- ak = 2;
- pmin = -2.25;
- pmax = 0.75;
- qmin = -1.5;
- qmax = 1.5;
- r_max = 50;
- k_max = 50;
-
- VAR
- np, nq, k : INTEGER;
- dp, dq,
- p, q,
- x, x_alt, y : REAL;
-
- LABEL exit;
-
- {---------------------------------------------------------}
-
- PROCEDURE iterat (np, nq: INTEGER);
-
- BEGIN
- p := pmin + np * dp;
- q := qmin + nq * dq;
- k := 0;
- x := 0;
- y := 0;
- REPEAT
- x_alt := x;
- x := x * x - y * y + p;
- y := 2 * x_alt * y + q;
- k := k + 1;
- UNTIL (x * x + y * y > r_max) OR (k = k_max);
- IF k = k_max THEN
- k := 0;
- Plot(np, yres - nq, k Mod ak);
- END;
-
- {---------------------------------------------------------}
-
- BEGIN
- ClrScr;
- HiRes;
- HiResColor(15);
- dp := (pmax - pmin) / xres;
- dq := (qmax - qmin) / yres;
- FOR np := 0 TO xres - 1 DO
- BEGIN
- FOR nq := 0 TO yres - 1 DO
- iterat(np, nq);
- IF KeyPressed THEN GOTO exit;
- END;
- REPEAT UNTIL KeyPressed;
- exit:
- END.
-