MS Virus

No 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 50 times • Downloaded 7 times • Run 0 times
Download the 'MS 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 number-to-be-infected]

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
  set 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
    if Daily-Infection-Rate = 1 [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 turtles [ set size 1]
  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 is only one version of this model, created about 3 years ago by Katherine Bolger.

Attached files

No files

This model does not have any ancestors.

This model does not have any descendants.