Ok, here is the psuedocode I found: For each pixel on the screen do:
{
x = x0 = x co-ordinate of pixel
y = y0 = y co-ordinate of pixel
iteration = 0
max_iteration = 1000
while ( x*x + y*y <= (2*2) AND iteration < max_iteration )
{
xtemp = x*x - y*y + x0
y = 2*x*y + y0
x = xtemp
iteration = iteration + 1
}
if ( iteration == max_iteration )
then
colour = black
else
colour = iteration
plot(x0,y0,colour)
}
Mr. Baldwin, do you know anything about the Mandelbrot set? I have been attempting to program one based off of a psuedocode I found on Wikipedia. It does not work at all! It appears red, except for a black patch in the middle. Could you please help me?
yes, when run in Java it is a bit different.....the size is a bit larger in Java than in the actual program itself. Slobasso did an experiment which proved this. If you like, I can post a link to it.
It took me a few tries to get it to run properly online. I had a problem getting the collision test to work properly in the online version even though it worked fine in local mode.
Download this project!
Download the 14 sprites and 14 scripts of "Bacteria3D-01" and open it in Scratch
Project Notes
Click the green flag to start or re-start. Sit back, be patient and watch the bacteria grow. Replace the hide command with a show command to see how it works.
Comments
You need to be logged in to post comments
Add a Comment
just assume that "while" is "repeat until not". Also, <= would roughly translate to < or =
I can only get a red background with a black dot in the middle! Do you know what I could do to change this so it works?
Ok, here is the psuedocode I found: For each pixel on the screen do: { x = x0 = x co-ordinate of pixel y = y0 = y co-ordinate of pixel iteration = 0 max_iteration = 1000 while ( x*x + y*y <= (2*2) AND iteration < max_iteration ) { xtemp = x*x - y*y + x0 y = 2*x*y + y0 x = xtemp iteration = iteration + 1 } if ( iteration == max_iteration ) then colour = black else colour = iteration plot(x0,y0,colour) }
Mr. Baldwin, do you know anything about the Mandelbrot set? I have been attempting to program one based off of a psuedocode I found on Wikipedia. It does not work at all! It appears red, except for a black patch in the middle. Could you please help me?
I would be pleased to help if I could, but I have never written a Mandelbrot program in any language.
(link to project) here it is! Sorry it took so long
Thanks
Now we need a penicillin simulation...just look at all these things!
Tennis balls meet binary fission...fun!
yes, when run in Java it is a bit different.....the size is a bit larger in Java than in the actual program itself. Slobasso did an experiment which proved this. If you like, I can post a link to it.
Yes, I would like to see that link.
Once again, bacteria projects are very cool!
It took me a few tries to get it to run properly online. I had a problem getting the collision test to work properly in the online version even though it worked fine in local mode.