Starlings bird

Starlings bird preview image

1 collaborator

Avatar_black Leo B (Author)

Tags

birds 

Tagged by Leo B about 10 years ago

starlings 

Tagged by Leo B about 10 years ago

Visible to everyone | Changeable by the author
Model was written in NetLogo 5.0.5 • Viewed 248 times • Downloaded 17 times • Run 0 times
Download the 'Starlings bird' modelDownload this modelEmbed this model

Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)


Comments and Questions

Please start the discussion about this model! (You'll first need to log in.)

Click to Run Model

turtles-own[
 target 
 block?
]

globals[
  TARGET_MOUSE
]
patches-own[
  avaible?
]

to Setup
  ;; (for this model to work with NetLogo's new plotting features,
  ;; __clear-all-and-reset-ticks should be replaced with clear-all at
  ;; the beginning of your setup procedure and reset-ticks at the end
  ;; of the procedure.)
  __clear-all-and-reset-ticks
  set TARGET_MOUSE nobody
  ask patches [
   set pcolor green 
   set avaible? true
  ]
  ask n-of number_of_turtles patches [
   sprout 1[
     set color black
     set target nobody
     set block? false
   ] 
  ]
end 

to Go
  every 0 [
  move
  ]
  Mouse-Control
end 

to Mouse-Control
  
  if mouse-down?
  [ 
    ifelse (not Made_Wall?) [
      if TARGET_MOUSE != nobody [ ask TARGET_MOUSE [set pcolor green]]
      set TARGET_MOUSE patch mouse-xcor mouse-ycor
      ask TARGET_MOUSE [set pcolor red]
    ]
    [
      ask patch mouse-xcor mouse-ycor[
        set pcolor grey
        set avaible? false
      ]
    ]
  ]
ask turtles [ set target TARGET_MOUSE ]
end 

to move
  ask turtles[
    set color black
   ifelse (target = nobody) [
     right random 90
     left random 90
    
  ][
  if (not block?) [face target]
  set block? false
  ]

  
  let front (turtle-set ( other turtles in-cone 2 70 ))
  let front_wall (patch-set patches in-cone 2 70 with [not avaible?])
  ifelse (count front = 0 and count front_wall = 0) [fd 0.5]
  [set color blue
    right random 90
    left random 90
    set block? true
     set target nobody]
  
 
  ]
end 

to Reset-target
if TARGET_MOUSE != nobody [ ask TARGET_MOUSE [set pcolor green]]
set TARGET_MOUSE nobody
end 

to Reset-Wall
ask patches [
 set pcolor green
 set avaible? true 
]
end 

There is only one version of this model, created about 10 years ago by Leo B.

Attached files

File Type Description Last updated
Starlings bird.png preview Preview for 'Starlings bird' about 10 years ago, by Leo B Download

This model does not have any ancestors.

This model does not have any descendants.