Linear virus

Linear virus preview image

1 collaborator

Default-person Katherine Bolger (Author)

Tags

(This model has yet to be categorized with any tags)
Visible to everyone | Changeable by the author
Model was written in NetLogo 6.2.0 • Viewed 77 times • Downloaded 8 times • Run 0 times
Download the 'Linear virus' 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 [ infected day-became-ill]
globals [ number-infected infected-set]

to go
  count-infected-turtles
  if number-infected >= Number-Of-Students [ stop ]
  infect-students
  tick
end 

to count-infected-turtles
  set number-infected count turtles with [ infected = true ]
end 

to infect-students
  let number-to-be-infected 0
  if Model = "default" [ set Model 1 ]
  if Model = 1 [
    set Daily-Infection-Rate 1
    repeat Daily-Infection-Rate [
      if number-infected < Number-Of-Students[
        ask one-of turtles with [ infected = false  ][
          set infected true
          set shape "face sad"
          set color red
          set ycor ycor * -1
          set day-became-ill ticks
          count-infected-turtles
        ]
      ]
    ]
  ]
   if Model = 2 [               ;; make this one exponential
    set Daily-Infection-Rate 1.1
    set number-to-be-infected ( number-infected * (Daily-Infection-Rate ^ ticks)  )
    set number-to-be-infected (number-to-be-infected - number-infected )
    print number-to-be-infected
    repeat number-to-be-infected [
      if number-infected < Number-Of-Students[
        ask one-of turtles with [ infected = false  ][
          set infected true
          set shape "face sad"
          set color red
          set ycor ycor * -1
          count-infected-turtles
        ]
      ]
    ]
  ]
   if Model = 3 [
    set Daily-Infection-Rate 2
    set number-to-be-infected (ticks ^ Daily-Infection-Rate )
    set number-to-be-infected (number-to-be-infected - number-infected )
    repeat number-to-be-infected[
      if number-infected < Number-Of-Students[
        ask one-of turtles with [ infected = false  ][
          set infected true
          set shape "face sad"
          set color red
          set ycor ycor * -1
          count-infected-turtles
        ]
      ]
    ]
  ]
end 

to reset
  clear-all
  setup-patches
  setup-turtles
  reset-ticks
end 

to setup-turtles
  create-turtles Number-Of-Students
  ask turtles [ setxy random-xcor random max-pycor]
  ask turtles [ if ycor = 0 [ set ycor ycor + 1 ] ]
  ask turtles [ set shape "face happy" ]
  ask turtles [ set color green ]
  ask turtles [ set infected false ]
  ask turtle 1 [ set color red ]
  ask turtle 1 [ set infected true ]
  ask turtle 1 [ set shape "face sad" ]
  ask turtle 1 [ set day-became-ill 0 ]
  let negYcor [ycor] of turtle 1
  ask turtle 1 [ set ycor ycor * -1 ]
  count-infected-turtles
end 

to setup-patches
  ask patches [ if pycor = 0 [set pcolor grey ] ]
  ask patches [ if pycor > 0 [set pcolor green + 4 ] ]
  ask patches [ if pycor < 0 [set pcolor red + 4 ] ]
end 

There are 2 versions of this model.

Uploaded by When Description Download
Katherine Bolger about 3 years ago implemented model3 Download this version
Katherine Bolger about 3 years ago Initial upload Download this version

Attached files

File Type Description Last updated
Linear virus.png preview Preview for 'Linear virus' about 3 years ago, by Katherine Bolger Download

This model does not have any ancestors.

This model does not have any descendants.