Virus Spread (simple)_Final

Virus Spread (simple)_Final preview image

1 collaborator

Julian_wallace Julian Wallace (Author)

Tags

(This model has yet to be categorized with any tags)
Visible to everyone | Changeable by everyone
Model was written in NetLogo 6.1.1 • Viewed 100 times • Downloaded 8 times • Run 0 times
Download the 'Virus Spread (simple)_Final' 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 [
  virus? ;; Ture or False? Turtle has the virus
]

to setup ;; this procedure sets up simulation anew
  clear-all
  create-turtles number-of-agents [setxy random-xcor random-ycor
  set virus? false ;; all turtles enter world without virus
    set shape "person"
  ]
  ask one-of turtles [set virus? true] ;; one unlucky turtle will enter world infected w/ virus
  ask turtles [recolor]
  reset-ticks
end 

to go
  if all? turtles [virus?] [stop] ;; will end simulation after all turtles are infected
  ask turtles [ move ]
  ask turtles [spread]
  ask turtles [recolor]
  tick
end 

to move
  right random 50
  left random 50
  fd 1
end 

to spread
  ifelse virus? [] [ ;; if infected touches other infected do nothing, otherwise run following procedure
  if any? other turtles-here with [virus?] ;; asks if there are any other turtles in the same patch (space) as them with the virus
  [set virus? true
      if connections [ask self [ create-links-from other turtles-here with [virus?]]]
  ]
  ]
end 

to recolor
  ifelse virus? [set color red] [set color blue]
end 

There is only one version of this model, created over 3 years ago by Julian Wallace.

Attached files

File Type Description Last updated
Virus Spread (simple)_Final.png preview Preview for 'Virus Spread (simple)_Final' over 3 years ago, by Julian Wallace Download

This model does not have any ancestors.

This model does not have any descendants.