summaryrefslogtreecommitdiff
path: root/fpcsrc/tests/webtbs/tw11053.pp
blob: 7cf27592968131e96aa2558ad88590951575b373 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
program Project1;

{$mode delphi}

const height = 1;
      width = 1;

var pix: array [0..height-1,0..width-1] of Integer;

procedure Main;
var
    dx, dy: Integer;
    Color, digest: cardinal;
    cx, cy, zx, zy: Double;
    scale: Double;
    deep: Integer;

begin
  FillChar(pix, SizeOf(pix), $f0);
        scale := 0.05;
        deep := 30;
        Digest := 0;


      for dy := 0 to height -1 do
      begin
        cy := (dy - height / 2) * scale;
        for dx := 0 to width - 1 do
        begin
          color := 0;
          cx := (dx - width / 2) * scale;

          zx := cx;
          zy := cy;

          while zx * zx + zy * zy < 1 do
          begin
            zx := zx * zx - zy * zy + cx;
            zy := 2 * zx * zy + cy;
            Inc( color );
            if color > Cardinal(deep) then break;
          end;
          pix[ dy, dx ] := color;
        end;
      end;

  pix[ 0, 0 ] := 80;

  Digest := 0;
  for dy := 0 to height -1 do for dx := 0 to width - 1 do Digest := Digest + pix[dy, dx];

  if (digest<>80) then
    halt(1);
end;
begin
  Main;
end.