My program for creating a Mandelbrot set has an error: whenever the pen changes colors, and every 42nd pixel after that becomes lighter. It is rather a coincidence, a mandelbug (yes, I just recognized this term), since it is inconsistent for many pixels near the “edge” (it can be blurred between the color that it should have and the color of the last, or the next , the pixel should be), but it is always the 42nd pixel after that until the next color change. I am using OSX 10.6.8, PYTHON 2.7. When I wrote this program at school, it worked fine (Windows), and then I sent it to myself and worked on it a bit (basically just making the sample size and therefore enlarging the image) and running it, I got this error. EDIT: My bad one, I forgot to mention that this only happens with my Mandelbrot program, the several other tortoise programs that I have at home are wonderful.
Parts of screenshots (so you don’t have to wait long while the program is running to see what I'm talking about):
From my first version from home:
In the current version (sideways):
Here is the code:
import turtle import math turtle.speed(0) def benoit(onelen): turtle.left(90) for x in range(-2*onelen, onelen): turtle.up() turtle.goto(x, int(-1.5*onelen)-1) turtle.down() for y in range(int(-1.5*onelen)-1, int(1.5*onelen)-1): z = complex(0,0) c = complex(x*1.0/onelen,y*1.0/onelen) for k in range(20): z = z*z+c if abs(z) > 2: g = .2 + .8*(20-k)/20 break if k == 19: g = 0 turtle.pencolor(0,g,0) turtle.forward(1) benoit(250) x = raw_input("Press Enter to Exityadayadayada")
EDIT: DSM recommended a solution that likes this bug. However, I have no experience editing Python source code, and all the underscores make me nervous. Can someone tell me what specifically change and / or how?
source share