Debugging a Mandelbrot Set generator
Posted by Gizmosis350k
Last Updated: April 04, 2012
  2363

(code uses the for loop)

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Ch04Ex06
{
    class Program
    {
        static void Main(string[] args)
        {                     //This is SO PRO yet somehow not fully functional
            double realCoord, imagCoord;
            double realTemp, imagTemp, realTemp2, arg;
            int iterations;
            for (imagCoord = 1.2; imagCoord >= -1.2; imagCoord -= 0.5)
            {
                for (realCoord = -0.6; realCoord <= 1.77; realCoord += 0.03)
                {
                    iterations = 0;
                    realTemp = realCoord;
                    imagTemp = imagCoord;
                    arg = (realCoord * realCoord) + (imagCoord * imagCoord);
                    while ((arg < 4) && (iterations < 40))
                    {
                        realTemp2 = (realTemp * realTemp) - (imagTemp * imagTemp) - realCoord;
                        imagTemp = (2 * realTemp * imagTemp) - imagCoord;
                        realTemp = realTemp2;
                        arg = (realTemp * realTemp) + (imagTemp * imagTemp);
                        iterations += 1;
                    }
                    switch (iterations % 4)
                    {
                        case 0:
                            Console.Write(".");
                            break;
                        case 1:
                            Console.Write("o");
                            break;
                        case 2:
                            Console.Write("0");
                            break;
                        case 3:
                            Console.Write("@");
                            break;
                    }
                }
                Console.Write("\n");

            }

            Console.ReadKey();
        }
    
    }

    
}


It's not printing the exact pattern it should, any help on this would be appreciated
   
  
 
 
   

 
 
thats new..  Mandelbrot Set generator?
 
C################################# mine it cut u 0__o dwl!!!!!!!!
 
lolllll well a medlbrot set....i'd have to show u gimme a sec
 

yeah but in text form, this code shows how to make one, but it not quite correct.
i wrote this out of the book, and now i found the 2010 version, but it's bigger and i need a physical copy lol
 
The power of programming. C# VS VB. Lets have a completion giz ^_^. Wat do you say?
 
sure, you may win tho, but im sticking with C#