maybe they should call him "DUDEney"

(2 comments)
2007.12.30
click to run

wallpaper
Wallpaper, an example algorithm from A.K. Dewdney's "The New Turing Omnibus", a bit of a fractal. You can use the mouse to adjust the three input parameters.

What makes this cool is how simple the main drawing routine is...
  for(int i = 0; i < 100; i++){
    for(int j = 0; j < 100; j++){
      float x = (corna + i) * side / 100;
      float y = (cornb + j) * side / 100;
      int c = round((x*x)+(y*y));

      if(c % 2 == 0 ){
        plot(i,j);  
      }   

    }
  }
It turns out corna and cornb are just the horizontal and vertical offsets, and "side" is acting as a zooming factor. (Those are the variable names Dewdney uses... I don't know why he doesn't use more descriptive names.)

I was actually able to knock the basic implementation off in about 10 minutes in Processing, though the sliders took a bit more work because I was trying to be cute.