Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 1st, 2012  |  syntax: None  |  size: 0.67 KB  |  hits: 12  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. breed [agents agent]
  2.  
  3. agents-own [num-volta visivel]
  4.  
  5. to setup
  6.  
  7.   clear-all
  8.   reset-ticks
  9.  
  10.   create-agents 250 [
  11.     set color green
  12.     setxy random-xcor random-ycor
  13.   ]
  14. end
  15.  
  16. to go
  17.   if ticks >= 500 [
  18.     stop
  19.   ]  
  20.  
  21.   ask agents [
  22.     contar-a-volta
  23.     contar-visivel
  24.    
  25.     ifelse num-volta > 10 [
  26.       face heading max-one-of visivel [num-volta] + 180
  27.     ]
  28.     [
  29.       face heading max-one-of visivel [num-volta]
  30.     ]
  31.    
  32.     fd random 10
  33.   ]
  34.   tick
  35. end
  36.  
  37. to contar-a-volta
  38.   set num-volta agent count agents with [myself != self] in-radius 8
  39. end
  40.  
  41. to contar-visivel
  42.   set visivel agents with [myself != self] in-radius 16
  43. end