FAQ
Cover
This is the archive Discourse for the Processing (ALPHA) software.
Please visit the new Processing forum for current information.

   Processing 1.0 _ALPHA_
   Topics & Contributions
   Simulation, Artificial Life
(Moderator: REAS)
   fungus
« Previous topic | Next topic »

Pages: 1 
   Author  Topic: fungus  (Read 597 times)
xoff

Email
fungus
« on: Jul 11th, 2003, 5:40pm »

it is a simple atemp to simulate fungus aglomeration using a simple algorithm ......i have to finish the blur implementation...
 
 
 
 
////////////////
// fungus digitalis
 
int pontoh;
int pontov;
int ponto0;
int branco;
int preto;
 
int ponto1;
int ponto2;
int ponto3;
int ponto4;
int ponto5;
int ponto6;
int ponto7;
int ponto8;
 
void setup(){
  size(300, 300);
  noBackground();
  rectMode(CENTER_DIAMETER);
}
 
void mouseDragged(){
  setPixel(mouseX, mouseY, color(0,0,0));
}
 
void loop(){
  for(int a=0; a<=400; a++){
    fungus();
  }
}
 
void fungus(){
  int pontoh = int(random(1,299));
  int pontov = int(random(1,299));
 
  branco= color(0,0,0);
preto= color(255,255,255);
 
  ponto0= getPixel(pontoh, pontov);
  ponto1= getPixel(pontoh-1, pontov-1);
  ponto2= getPixel(pontoh, pontov-1);
  ponto3= getPixel(pontoh+1, pontov-1);
  ponto4= getPixel(pontoh-1, pontov);
  ponto5= getPixel(pontoh+1, pontov);
  ponto6= getPixel(pontoh-1, pontov+1);
  ponto7= getPixel(pontoh, pontov+1);
  ponto8= getPixel(pontoh+1, pontov+1);
 
  if(ponto1==branco){
    setPixel(pontoh,pontov,color(0,0,0));
  }
  if(ponto2==branco){
    setPixel(pontoh,pontov,color(0,0,0));
  }
  if(ponto3==branco){
    setPixel(pontoh,pontov,color(0,0,0));
  }
  if(ponto4==branco){
    setPixel(pontoh,pontov,color(0,0,0));
  }
  if(ponto5==branco){
    setPixel(pontoh,pontov,color(0,0,0));
  }
  if(ponto6==branco){
    setPixel(pontoh,pontov,color(0,0,0));
  }
  if(ponto7==branco){
    setPixel(pontoh,pontov,color(0,0,0));
  }
  if(ponto8==branco){
    setPixel(pontoh,pontov,color(0,0,0));
  }
 
  if (ponto0 != preto){
    if (ponto1!=preto){
 if (ponto2!=preto){
   if (ponto3!=preto){
     if (ponto4!=preto){
  if (ponto5!=preto){
    if (ponto6!=preto){
      if (ponto7!=preto){
   if (ponto8!=preto){
   setPixel(pontoh,pontov,(ponto0+color(20,20,20)));
   }
      }
    }
  }
     }
   }
 }
    }
  }
}
 

||||||||||||||||||||||||| 25% lodead
naztafari

WWW
Re: fungus
« Reply #1 on: Aug 16th, 2003, 8:45pm »

Hey. Cool. Reminds me of Larry Niven's short story "Bordered in Black"
 

-Naz
http://www.object404.com
Pages: 1 

« Previous topic | Next topic »