control number of apperead agent

6 views
Skip to first unread message

Suhad Faisal

unread,
Oct 25, 2014, 4:40:05 AM10/25/14
to gama-p...@googlegroups.com
Hello 
I try to draw one agent moved in specified speed and distance , but I get many appeared as out put , althought I try to use the facet of number:1 but I loss the movement of the agent 

any explain please 

init 
{
create alias from:initdata  with:[location.x ::int(read('pos_x')) , location.y ::int(read('pos_y')) ,tower::int(read('mat_id')),  timy ::int(read('timt'))]
location<-point([location.x, location.y];
          }  // init
      } // global
entities
 {
reflex dd{
aliy <- list(species_of(self)) ; 
loop i from:0 to: length(aliy)-2
{
        source  <-alias(i).location;
soutime <-alias(i).timy;
int j<-i+1;
    targ    <-alias(j).location;
    targtime<-alias(j).timy; 
   
    if  (source !=targ   )
{
    difftime<-abs(targtime-soutime);
    write "DiffTime     " +difftime;
    distance<-source distance_to targ ;
    write "Distance     "+distance;
    speedy  <- (distance/difftime)  ; 
    write "Speed        "+speedy ;} 
    do  goto target:targ on:shape return_path:true speed:speedy;     
      } //loop
   } // reflex dd      
        
aspect base {  draw circle(500) color:rgb('red') at:location ; }   } //alias species 
   } //entities 

cheers
Suhad
VoronoiVoronoi.shp
alias519.shp
26.10.gaml
Reply all
Reply to author
Forward
0 new messages