using System.Collections.Generic;
private static (int x, int y) dimensions = (4, 4);
private static int pointDensity = 100;
private static int limit = 200;
private static int[,] escapeTimes = new int
[(int)(dimensions.x * pointDensity) + 1, (int)(dimensions.y * pointDensity) + 1];
private static void FillArray(ref int[,] arr)
for (int x = 0; x < arr.GetLength(0); x++)
for (int y = 0; y < arr.GetLength(1); y++)
current = ConvertFromIndex(x,y);
IterateMandelbrot(current, limit, out int escT, out _);
private static void FillArray(ref bool[,] arr)
for (int x = 0; x < arr.GetLength(0); x++)
for (int y = 0; y < arr.GetLength(1); y++)
current = ConvertFromIndex(x,y);
IterateMandelbrot(current, limit, out _, out bool isInSet);
private static Complex ConvertFromIndex(int x, int y)
double real = -0.5 * (double)dimensions.x + (double)x / (double)pointDensity;
double imaginary = 0.5 * (double)dimensions.y - (double)y / (double)pointDensity;
Complex output = new Complex(real, imaginary);
private static Complex IterateMandelbrot(Complex z, int limit, out int escT, out bool isInSet)
while (current.Magnitude < 2 && i < limit)
current = current * current + z;
public static void Main()
[(int)(dimensions.x * pointDensity) + 1, (int)(dimensions.y * pointDensity) + 1];
for (int i = 0; i < BAndW.GetLength(0); i++)
for (int j = 0; j < BAndW.GetLength(1); j++)
string boolValue = (BAndW[j, i] == true) ? "$" : " ";
Console.Write(boolValue + " ");