Rygte- og smittespredning

Rygte- og smittespredning preview image

1 collaborator

Tags

(This model has yet to be categorized with any tags)
Visible to everyone | Changeable by everyone
Model was written in NetLogo 6.2.2 • Viewed 149 times • Downloaded 11 times • Run 0 times
Download the 'Rygte- og smittespredning' modelDownload this modelEmbed this model

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


Info tab cannot be displayed because of an encoding error

Comments and Questions

Please start the discussion about this model! (You'll first need to log in.)

Click to Run Model

turtles-own
[ sick?                  ;; if true, the turtle is infectious
  immune?                ;; if true, the turtle is immune
  sick-time   ]          ;; how long, in days the turtle has been infectious

globals
  [ %infected            ;; what % of the population is infectious
    %immune ]            ;; what % of the population is immune

;; The setup is run when clicking "setup" in the interface

to setup
  clear-all
  setup-turtles
  update-global-variables
  update-display
  reset-ticks
end 

;; We create 1000 turtles of which 1 is infectious, and distribute them randomly

to setup-turtles
  create-turtles 1000
    [ setxy random-xcor random-ycor
      set size 2
      set shape "dot"               ;;  Her sættes formen til at være en prik. Prøv at ændre til "person".
      get-healthy
      set immune? false ]
  ask n-of 1 turtles
    [ get-sick ]
end 

;; The go is run when clicking "go" in the interface

to go
  ask turtles [
    move
    if sick?
    [ get-older
      infect
      ;recover             ;; Fjern semikolonet foran recover i starten af denne linje og se hvad der sker.
      ;survive             ;; Fjern semikolonet foran survive i starten af denne linje og se hvad der sker.
    ]
  ]
  update-global-variables
  update-display
  tick
end 

to move
  right random 100 - 50    ; Drej en tilfældig vinkel mellem -50 og 50
  forward 1                ; Gå en frem
end 

to get-older
  set sick-time sick-time + 1
end 

;; If a turtle is sick, it infects other turtles on the same patch.
;; Immune turtles don't get sick.

to infect
  ask other turtles-here with [ not sick? and not immune?]
    [ if random-float 100 < infectiousness
      [ get-sick ] ]
end 

to recover ;; If a turtle is sick longer than duration, then the person gets healthy and immune
  if sick-time > duration
  [become-immune]
end 

to survive
  if random 1000 < 10 [ die ]
end 

to become-immune
  set sick? false
  set sick-time 0
  set immune? true
end 

to get-sick
  set sick? true
end 

to get-healthy
  set sick? false
  set sick-time 0
end 

to update-global-variables
  if count turtles > 0
    [ set %infected (count turtles with [ sick? ] / count turtles) * 100
      set %immune (count turtles with [immune?] / count turtles) * 100
       ]
end 

to update-display
  ask turtles
    [
      set color ifelse-value sick? [ red ]  [ifelse-value immune? [grey] [ green ] ]
  ]
end 

; Smittespredning modificeret ud fra "virus", copyright 1998, Uri Wilensky af
; Eva Danielsen, Solveig Skadhauge, Solvejg Pedersen, Rune Klarskov og Emil Blumenfeld.
; See Info tab for full copyright and license.

There are 2 versions of this model.

Uploaded by When Description Download
Solveig Skadhauge over 2 years ago window fits Download this version
Solveig Skadhauge over 2 years ago Initial upload Download this version

Attached files

File Type Description Last updated
Rygte- og smittespredning.png preview Preview for 'Rygte- og smittespredning' over 2 years ago, by Solveig Skadhauge Download

This model does not have any ancestors.

This model does not have any descendants.