Martial marquet + victor verhagen

From KokkugiaWiki

project 1

research Image:Swarm_Research_Martial_Victor_Page_1.jpg Image:Swarm_Research_Martial_Victor_Page_2.jpg Image:Swarm_Research_Martial_Victor_Page_3.jpg


pseudo code

//variables
 ArrayList shoal_fish: 90 agents(random size min/max, random speed min/max, random colors (white, grey, black))
 
 ArrayList shoal_shark: 3 agents
 
 //functions
 void run() {
   accesses the ArrayLists
 }
 
 void addAgent(){
   adds an agent to the ArrayLists
 }
 

class kAgent_fish{
  //variables 
      velocity, acceleration, size , position, species, max velocity and max size  

  // functions

  void update(){
    calculates a new position of the agent by adding together the returned steering behaviors
    weighting them and adding them to the current position
  }

  void size match(){
    groups agents of same size
  
}

  void color match(){
    groups agents of same color
    
}

  void velocity match(){
    groups agents of same velocity
    
}


  void seek() {
    calls the steer behavior and adds the returned vector to the acceleration vector
  }
   

  kVec steer() {
    returns a vector to steer the agent toward a target
  }


  kVec separate() {
     returns a vector to steer away from the surrounding agents
  }
 
 
  kVec align() {
     returns a vector to align with the direction and velocity of the surrounding agents     
  }


  kVec cohesion() {
     returns a vector to steer towards the center of the surrounding agents
  }

void acceleration(){
     
  
 kVec cohesion() {
     returns a vector to steer towards the center of the surrounding agents
  }
  kVec align() {
     returns a vector to align with the direction and velocity of the surrounding agents     
 } 
  kVec acceleration (){
    the more fish are in the school the fastest they go.
    returns a vector to accelerate the velocity each agent of the shoal 
    max accelerate  <  max velocity
    
  }
 
 void flee(){
   steers away from the predator
   
   }
   
     void render() {
     draws the fish
 
 
 
 
 class kAgent_shark{
  //variables 
   position, max velocity, max size  

  // functions

  void update(){
    calculates a new position of the agent by adding together the returned steering behaviors
    weighting them and adding them to the current position 
  
  void seek() {
    calls the steer behavior and adds the returned vector to the acceleration vector
  }
   

  kVec steer() {
    returns a vector to steer the agent toward a target
  }


  kVec separate() {
     returns a vector to steer away from the surrounding agents
  }
 
 
  kVec align() {
     returns a vector to align with the direction and velocity of the surrounding agents     
  }


  kVec cohesion() {
     returns a vector to steer towards the center of the surrounding agents
  }
  
  void search(){
   steers towards the shoal of fish
   
   }
  
  

  
  
  void render() {
     draws the predators
  }
  
  
  void borders() {
     adjusts the position of the agent such that if it exceeds the edge of the applet it 
     returns on the opposite side.
  }

}
Views