Softwire Speed Coding Challenge – Question 2
23 April 2012, by Chris Williams
Welcome to the next in our series on Softwire’s coding challenge! Last time, we discussed the winning answer to the first question. Here’s question 2 for you to try, which may require a bit of mathematical knowledge – I’ll post the winning answer and some further discussion in a week or so.
Write a program to draw part of the Mandelbrot Set. Define:
where is a complex number. Equivalently you can forget about complex numbers and use 2d coordinates:
For our purposes, points (or (,)) in the complex plane are said to be in the Mandelbrot set if:
Your picture should be 800×600 pixels (you may use 200×150 pixels if you are using Ruby or Python). It should have its left top co-ordinate at (-1.14183, 0.47056) and its right bottom co-ordinate at (-0.60999,-0.06128), and it should draw pixels which are in the Mandlebrot Set as white, and those that are not as black.
Best of luck, don’t forget to comment and let us know how you get on!