Disease Solo

Disease Solo preview image

1 collaborator

Uri_dolphin3 Uri Wilensky (Author)

Tags

biology 

Tagged by Reuven M. Lerner over 10 years ago

Model group CCL | Visible to everyone | Changeable by group members (CCL)
Model was written in NetLogo 5.0.4 • Viewed 603 times • Downloaded 63 times • Run 1 time
Download the 'Disease Solo' modelDownload this modelEmbed this model

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


WHAT IS IT?

Disease Solo is a one-player version of the HubNet activity Disease. It simulates the spread of a disease through a population. One agent in the population is a person controlled by the user; the others are "androids" controlled by the computer.

HOW IT WORKS

The user controls the blue agent via the buttons and slider on the right side of the view. The infection is started by pressing the "infect" button.

Sick agents are indicated by a red circle.

Androids can move using a few different simple strategies. By default they simply move randomly, however, using the AVOID? and CHASE? switches you can indicate that uninfected androids should run from infected ones or infected androids should chase uninfected ones.

The person may also catch the infection.

Healthy "agents" on the same patch as sick agents have an INFECTION-CHANCE chance of becoming ill.

HOW TO USE IT

Buttons

SETUP/CLEAR - sets up the world and clears plots. SETUP/KEEP - sets up the world without clearing the plot; this lets you compare results from different runs. GO - runs the simulation. INFECT - infects one of the androids

Sliders

NUM-ANDROIDS - determines how many androids are created at setup INFECTION-CHANCE - a healthy agent's chance at every time step to become sick if it is on the same patch as an infected agent

Monitors

NUMBER SICK - the number of sick agents

Plots

NUMBER SICK - the number of sick agents versus time

Switches

AVOID? - when this switch is on each uninfected android checks all four directions to see if it can move to a patch that is safe from infected agents. CHASE? - when this switch is on each infected androids checks all four directions to see if it can infect another agent.

User controls

UP, DOWN, LEFT, and RIGHT - move the person around the world, STEP-SIZE determines how far the person moves each time one of the control buttons is pressed.

THINGS TO NOTICE

Think about how the plot will change if you alter a parameter. Altering the infection chance will have different effects on the plot.

THINGS TO TRY

Do several runs of the model and record a data set for each one by using the setup/keep button. Compare the different resulting plots.

What happens to the plot as you do runs with more and more androids?

EXTENDING THE MODEL

Currently, the agents remain sick once they're infected. How would the shape of the plot change if agents eventually healed? If, after healing, they were immune to the disease, or could still spread the disease, how would the dynamics be altered?

The user has a distinct advantage in this version of the model (assuming that the goal is either not to become infected, or to infect others), as the user can see the entire world and the androids can only see one patch ahead of them. Try to even out the playing field by giving the androids a larger field of vision.

Determining the first agent who is infected may impact the way disease spreads through the population. Try changing the target of the first infection so it can be determined by the user.

NETLOGO FEATURES

You can use the keyboard to control the person. To activate the keyboard shortcuts for the movement button, either hide the command center or click in the white background.

The plot uses temporary plot pens, rather than a fixed set of permanent plot pens, so you can use the setup/keep button to overlay as many runs as you want.

RELATED MODELS

  • Disease (HubNet version)
  • Virus
  • AIDS

CREDITS AND REFERENCES

This model is a one player version of the HubNet activity Disease. In the HubNet version, multiple users can participate at once.

HOW TO CITE

If you mention this model in a publication, we ask that you include these citations for the model itself and for the NetLogo software:

  • Wilensky, U. (2005). NetLogo Disease Solo model. http://ccl.northwestern.edu/netlogo/models/DiseaseSolo. Center for Connected Learning and Computer-Based Modeling, Northwestern Institute on Complex Systems, Northwestern University, Evanston, IL.
  • Wilensky, U. (1999). NetLogo. http://ccl.northwestern.edu/netlogo/. Center for Connected Learning and Computer-Based Modeling, Northwestern Institute on Complex Systems, Northwestern University, Evanston, IL.

COPYRIGHT AND LICENSE

Copyright 2005 Uri Wilensky.

CC BY-NC-SA 3.0

This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License. To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/3.0/ or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.

Commercial licenses are also available. To inquire about commercial licenses, please contact Uri Wilensky at uri@northwestern.edu.

Comments and Questions

Click to Run Model

;;;;;;;;;;;;;;;;;;
;; Declarations ;;
;;;;;;;;;;;;;;;;;;

globals
[
  ;; number of turtles that are sick
  num-sick
  ;; when multiple runs are recorded in the plot, this
  ;; tracks what run number we're on
  run-number
  ;; counter used to keep the model running for a little
  ;; while after the last turtle gets infected
  delay
]

breed [ androids android ]
breed [ users user ]

;; androids and users are both breeds of turtle, so both androids
;; and users have these variables
turtles-own
[
  infected?    ;; whether turtle is sick (true/false)
]

;;;;;;;;;;;;;;;;;;;;;
;; Setup Functions ;;
;;;;;;;;;;;;;;;;;;;;;

;; clears the plot too

to setup-clear
  clear-all
  set run-number 1
  setup-world
end 

;; note that the plot is not cleared so that data
;; can be collected across runs

to setup-keep
  clear-turtles
  clear-patches
  set run-number run-number + 1
  setup-world
end 

to setup-world
  set-default-shape androids "android"
  set-default-shape users "person"
  set num-sick 0
  set delay 0
  create-some-androids
  create-user
  reset-ticks
end 

to infect
  ask one-of androids [ get-sick ]
end 

to create-some-androids
  create-androids num-androids
  [
    setxy random-pxcor random-pycor   ;; put androids on patch centers
    set color gray
    set heading 90 * random 4
    set infected? false
  ]
end 

;;;;;;;;;;;;;;;;;;;;;;;
;; Runtime Functions ;;
;;;;;;;;;;;;;;;;;;;;;;;

to go
  ;; in order to extend the plot for a little while
  ;; after all the turtles are infected...
  if num-sick = count turtles
    [ set delay delay + 1  ]
  if delay > 50
    [ stop ]
  ;; now for the main stuff;
  androids-wander
  ask turtles with [ infected? ]
    [ spread-disease ]
  set num-sick count turtles with [ infected? ]
  tick
end 

;; controls the motion of the androids

to androids-wander
  ask androids
  [
    ifelse avoid? and not infected?
      [ avoid ] [
    ifelse chase? and infected?
      [ chase ]
      [ rt (random 4) * 90 ] ]
  ]
  ask androids [
    fd 1
  ]
end 

to avoid ;; android procedure
  let candidates patches in-radius 1 with [ not any? turtles-here with [ infected? ] ]
  ifelse any? candidates
    [ face one-of candidates ]
    [ rt (random 4) * 90 ]
end 

to chase ;; android procedure
  let candidates turtles in-radius 1 with [ not infected? ]
  ifelse any? candidates
    [ face one-of candidates ]
    [ rt (random 4) * 90 ]
end 

to spread-disease ;; turtle procedure
  ask other turtles-here [ maybe-get-sick ]
end 

to maybe-get-sick ;; turtle procedure
  ;; roll the dice and maybe get sick
  if (not infected?) and (random 100 < infection-chance)
    [ get-sick ]
end 

;; set the appropriate variables to make this turtle sick

to get-sick ;; turtle procedure
  if not infected?
  [ set infected? true
  set shape word shape " sick" ]
end 

;;;;;;;;;;;;;;;;;;;;;
;; User Procedures ;;
;;;;;;;;;;;;;;;;;;;;;

to create-user
  create-users 1
  [
    set color sky
    set size 1.5     ;; easier to see than default of 1
    set heading (random 4) * 90
    set infected? false
  ]
end 

to move [ new-heading ]
  ask users
  [
    set heading new-heading
    fd step-size
  ]
end 


; Copyright 2005 Uri Wilensky.
; See Info tab for full copyright and license.

There are 10 versions of this model.

Uploaded by When Description Download
Uri Wilensky almost 11 years ago Updated to NetLogo 5.0.4 Download this version
Uri Wilensky over 11 years ago Updated version tag Download this version
Uri Wilensky over 11 years ago Updated to version from NetLogo 5.0.3 distribution Download this version
Uri Wilensky about 12 years ago Updated to NetLogo 5.0 Download this version
Uri Wilensky almost 14 years ago Updated from NetLogo 4.1 Download this version
Uri Wilensky almost 14 years ago Updated from NetLogo 4.1 Download this version
Uri Wilensky almost 14 years ago Updated from NetLogo 4.1 Download this version
Uri Wilensky almost 14 years ago Updated from NetLogo 4.1 Download this version
Uri Wilensky almost 14 years ago Model from NetLogo distribution Download this version
Uri Wilensky almost 14 years ago Disease Solo Download this version

Attached files

File Type Description Last updated
Disease Solo.png preview Preview for 'Disease Solo' almost 11 years ago, by Uri Wilensky Download

This model does not have any ancestors.

This model does not have any descendants.