How to resolve the algorithm Mandelbrot set step by step in the ALGOL W programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm Mandelbrot set step by step in the ALGOL W programming language

Table of Contents

Problem Statement

Generate and draw the Mandelbrot set.

Note that there are many algorithms to draw Mandelbrot set and there are many functions which generate it .

Let's start with the solution:

Step by Step solution about How to resolve the algorithm Mandelbrot set step by step in the ALGOL W programming language

Source code in the algol programming language

begin
    % -- This is an integer ascii Mandelbrot generator, translated from the   %
    % -- Compiler/AST Interpreter Task's ASCII Mandelbrot Set example program %
    integer leftEdge, rightEdge, topEdge, bottomEdge, xStep, yStep, maxIter;
    leftEdge   := -420;
    rightEdge  :=  300;
    topEdge    :=  300;
    bottomEdge := -300;
    xStep      :=    7;
    yStep      :=   15;
 
    maxIter    :=  200;
 
    for y0 := topEdge step - yStep until bottomEdge do begin
        for x0 := leftEdge step xStep until rightEdge do begin
            integer x, y, i;
            string(1) theChar;
            y := 0;
            x := 0;
            theChar := " ";
            i := 0;
            while i < maxIter do begin
                integer x_x, y_y;
                x_x := (x * x) div 200;
                y_y := (y * y) div 200;
                if x_x + y_y > 800 then begin
                    theChar := code( decode( "0" ) + i );
                    if i > 9 then theChar := "@";
                    i := maxIter
                end;
                y := x * y div 100 + y0;
                x := x_x - y_y + x0;
                i := i + 1
            end while_i_lt_maxIter ;
            writeon( theChar );
        end for_x0 ;
        write();
    end for_y0
end.


  

You may also check:How to resolve the algorithm Prime decomposition step by step in the Fortran programming language
You may also check:How to resolve the algorithm Time a function step by step in the PARI/GP programming language
You may also check:How to resolve the algorithm Sorting algorithms/Stooge sort step by step in the Kotlin programming language
You may also check:How to resolve the algorithm Test a function step by step in the SQL PL programming language
You may also check:How to resolve the algorithm Hex words step by step in the Ring programming language