vector-borne diseases

vector-borne diseases preview image

1 collaborator

Default-person Kevin Jin (Author)

Tags

(This model has yet to be categorized with any tags)
Visible to everyone | Changeable by everyone
Model was written in NetLogo 5.0.4 • Viewed 241 times • Downloaded 11 times • Run 0 times
Download the 'vector-borne diseases' 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

breed [ vectors vector ] 
breed [ androids android ]

globals 
[
  pen?
  pen-color
]

turtles-own
[
  infected?
  base-shape
  healthy-color
  infected-color
  move-distance
]

vectors-own
[
  life-counter
  energy
  mature?
  victims
  nearest-victim
  gen
  last-bite
]

androids-own
[
]

to setup
  clear-all
  setup-vectors
  make-androids
  reset-ticks
  set pen? false
end 

to go
  
  move-androids
  move-vectors
  check-death
  reproduce
  if count vectors = 0 ;or ticks > 1000
  [ stop ]
   
  tick
end 

to setup-vectors
  create-vectors vector-population
  ask vectors
  [
    
    set size 1
    set base-shape "butterfly"
    set healthy-color sky
    set infected-color red
    set shape base-shape
    setxy random-xcor random-ycor
    set infected? false
    update-health
    set life-counter random 300
    ifelse life-counter >= 200
    [ set mature? true 
      set hidden? false]
    [ set mature? false
      set hidden? true ]
    set energy ((random 33) + 33) 
    set gen 1
    set last-bite 0
  ]
end 

to make-androids
  create-androids android-population
  ask androids
  [
    set size 2
    set healthy-color grey
    set infected-color yellow
    set base-shape "android"
    set shape base-shape
    setxy random-xcor random-ycor
    set infected? false
    update-health
  ]
end 

to update-health
  ifelse infected? = false
  [
    set color healthy-color
  ]
  [
    set color infected-color
  ]
end 

to initial-infect
  let healthy-vectors vectors with [ not infected? ]
  let percentage (percentage-infected * (count vectors) / 100)
  
  ask n-of percentage healthy-vectors
  [
    set infected? true
    update-health
  ]  
end 

to move-vectors
  ask vectors
  [
    set move-distance ((random 2) + 1)
    if life-counter >= 200
    [
      set mature? true
      set hidden? false 
    ]
    if mature? = true
    [
              
      hunt
      if life-counter - last-bite > 33
      [
        bite
      ]
      
    ]
    set life-counter life-counter + 1
  ]
end 

to hunt
  set victims androids in-cone vector-vision field-of-vision
  ifelse any? victims
  [
    set nearest-victim min-one-of victims [ distance myself ]
    face nearest-victim
    fd move-distance
  ]
  [
    rt random 360
    fd move-distance
  ]
  set energy energy - move-distance
end 

to bite 
  let prey one-of androids-here
  let healthy-androids androids-here with [ infected? = false ]
  
  if prey != nobody 
  [
    let android-infected? [infected?] of prey
    if android-infected? = true and infected? = false
    [set infected? true
      update-health]
    if android-infected? = false and infected? = true
    [ask prey [ set infected? true
        update-health]]
    
    set energy  energy + 150 + (random 3 + 4)
    set last-bite life-counter
    
  ]
end 

to move-androids
  ask androids
  [
    set move-distance ((random 2) + 1)
    rt random 360
    fd move-distance 
  ]
end 

to check-death
;  ifelse count vectors < 500
;  [
    
    ask vectors
    [
      if energy <= 0
      [die]
      if life-counter >= 300 and ( (random-float 100.0) + 1 <= 99 )
      [die]
      if life-counter < 300 and life-counter >= 250
      [
        if ((random-float 100.0) + 1 <= 7)
        [die]
      ]
      if life-counter < 250 and life-counter >= 200
      [
        if ((random-float 100.0) + 1 <= 3)
        [die]
      ]
      if life-counter < 200 and life-counter >= 150
      [
        if ((random-float 100.0) + 1 <= 3)
        [die]
      ]
      if life-counter < 150 and life-counter >= 100
      [
        if ((random-float 100.0) + 1 <= 1)
        [die]
      ]
      if life-counter < 100 and life-counter >= 50
      [
        if ((random-float 100.0) + 1 <= 1)
        [die]
      ]
      if life-counter < 50
      [
        if ((random-float 100.0) + 1 <= 1)
        [die]
      ]
    ]
end 

to reproduce
  ask vectors
  [
    let reproductive-chance ((random 100) + 1)
    if mature? and energy > 100 and life-counter mod 33 = 0 and reproductive-chance <= 80
    [
      
      set energy energy - 100
      hatch ((random 10) + 1)
      [
        if pen?
        [pen-up]
        
        set energy 50
        set infected? false
        update-health
        set life-counter 0
        set mature? false
        setxy random-xcor random-ycor
        set hidden? true
        set gen gen + 1
        set last-bite 0 
        if pen?
        [pen-down]
      ]
    ]
  ]
end 

There is only one version of this model, created almost 9 years ago by Kevin Jin.

Attached files

File Type Description Last updated
vector-borne diseases.png preview Preview for 'vector-borne diseases' almost 9 years ago, by Kevin Jin Download

This model does not have any ancestors.

This model does not have any descendants.