Terror Paranoia

Terror Paranoia preview image

1 collaborator

Default-person Kevin Jin (Author)


(This model has yet to be categorized with any tags)
Model group MAM-2015 | Visible to everyone | Changeable by everyone
Model was written in NetLogo 5.2.0 • Viewed 357 times • Downloaded 15 times • Run 0 times
Download the 'Terror Paranoia' 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

breed [people person]
globals [
  mouse-was-down?   ;;tracks the previous state of the mouse
  terror-event?     ;;tracks whether a terror event has occurred recently, true after a terror event until community intervention occurs
  help-timer        ;;keeps track of time until community intervention occurs
turtles-own [
  fear-level           ;;level of fear of each turtle
  group                ;;which group each turtle is in
  last-patch-residual  ;;keeps track of the last patch's residual fear level so fear does not constantly increase while in area
patches-own [residual-fear] ;;residual fear from after terror events

;Setup Procedure
;Clears everything and then initializes the variables. Initial FEAR-LEVEL is randommly assigned and 
;the group is based on each turtle's WHO and how many groups there should be.
;The ask people call is necessary after the create-people command block because not all the 
;people have been assigned to a group yet and so there would be no links created for the first 
;few turtles. Initialize the global variables and patch variables as well.

to setup 
  set-default-shape people "person"
  create-people population [
    set size 1.5
    setxy random-xcor random-ycor
    set fear-level random 100 + 1
    set group who mod groups  
  ask people [
    if network?
    [ let network n-of links-with-others other people with [group = [group] of myself]
      create-links-with network] 
  ask patches [
    set residual-fear 0
    if show-residual-fear? = true
    [set plabel residual-fear]
  set mouse-was-down? false
  set terror-event? false
  set help-timer 0

;Go Procedure
;The go procedure checks if a terror event has occurred. Then it asks the people
;to adjust their FEAR-LEVEL based on the person they physically encounter and if
;this is a network, adjust their FEAR-LEVEL based on the network.
;Then adjust the FEAR-LEVEL based on whether there is any RESIDUAL-FEAR left on the 
;patch. Update the color and the LAST-PATCH-RESIDUAL to the RESIDUAL-FEAR of the current 
;patch. Then move. Then check the patches to see if they should be showing the residual fear
;and then decay any RESIDUAL-FEAR by the RESIDUAL-DECAY-RATE. Then finally check if 
;there is a community intervention on this turn.

to go
  ask people [
    let other-person-here one-of other people-here
    if other-person-here != nobody
    [ adjust-fear-levels other-person-here ]
    if network? = true and ticks mod network-communication-frequency = 0 ;adjust FEAR-LEVEL based on every link neighboor
    [ foreach [self] of link-neighbors [ adjust-fear-levels ? ] ]
    set last-patch-residual [residual-fear] of patch-here
  ask patches [
    ifelse show-residual-fear? = true
    [ set plabel residual-fear ]
    [ set plabel "" ]
    if residual-fear > 0
    [ set residual-fear (residual-fear - residual-decay-rate) ] 
  ifelse help-timer > 0
  [ set help-timer help-timer - 1 ]
    if terror-event? = true
      set terror-event? false 
      ask n-of number-of-interventions people
      [ set fear-level round ((1 - level-of-intervention) * fear-level) ] 

;terror-event procedure
;Checks to see if the mouse is currently not down and was previously down. This is done 
;so that the only a single click is registered, instead of registering the entire time that the mouse
;is down. If a click is detected, everyone within the radius is increase their FEAR-LEVEL
;by the TERROR-SEVERITY. Set the residual fear for the surrounding patches and then start HELP-TIMER
;whcih keeps track of when community intervention occurs. TERROR-EVENT? is then updated 
;as is the current status of the mouse.

to terror-event
  if mouse-was-down? and not mouse-down?
    ask patch round mouse-xcor round mouse-ycor [
      ask people in-radius terror-radius [
       let boundary fear-level + terror-severity < 100
       ifelse boundary
       [ set fear-level (fear-level + terror-severity) ]
       [ set fear-level 100 ]
       set last-patch-residual fear-level
      ask patches in-radius terror-radius
      [ set residual-fear round (terror-severity * initial-residual-fear / 100) ]   
    if terror-event? = false
    [set help-timer intervention-delay]
    set terror-event? true
  set mouse-was-down? mouse-down?

;adjust-fear-levels, a turtle procedure
;The FEAR-LEVELs of the people are adjusted based on what the the FEAR-LEVEL of the
;other-turtle argument. To do this, it takes 5% of the difference in FEAR-LEVELs 
;(whether positive or negative) and adds it to its own FEAR-LEVEL. 

to adjust-fear-levels [other-turtle]
  if other-turtle != nobody
    let difference round ([fear-level] of other-turtle - fear-level) / 20
    let fear-change round (fear-level + difference)
    ifelse terror-event? = false
      ifelse fear-change < 0 
      [ set fear-level 0 ]
        ifelse fear-change > 100
        [ set fear-level 100 ]
        [ set fear-level fear-change ]
      if difference > 0
        ifelse fear-change > 100
          [ set fear-level 100 ]
          [ set fear-level fear-change ]

;residual-fear-effect, a turtle procedure
;Increases the FEAR-LEVEL by the current RESIDUAL-FEAR of the patch the turtle is on

to residual-fear-effect
  if [residual-fear] of patch-here != 0 and last-patch-residual = 0
    let pdifference fear-level + [residual-fear] of patch-here
    ifelse pdifference > 100
    [ set fear-level 100 ]
    [ set fear-level pdifference ]

;move, a turtle procedure
;If there is a person ahead and a random number is less than the fear-level, 
;then go towards them, otherwise turn randomly and then advance forward.

to move
  let person-ahead one-of people in-cone 2 120
  ifelse person-ahead != nobody and (random 100 + 1) < fear-level
  [ face person-ahead ]
  [ rt random 121 - 60 ]
  fd 1

;update-color, a turtle procedure
;updates COLOR of turtle, lower FEAR-LEVEL is more blue and higher FEAR-LEVEL
;is more red.

to update-color
  ifelse fear-level = 50
  [ set color white ]
    ifelse fear-level > 50
    [ set color 18 - ((fear-level - 50) / 10) ]
    [ set color 108 - ((50 - fear-level) / 10) ]

There are 4 versions of this model.

Uploaded by When Description Download
Kevin Jin over 5 years ago Final version Download this version
Kevin Jin over 5 years ago Final version Download this version
Kevin Jin over 5 years ago updated behavior of agents Download this version
Kevin Jin over 5 years ago Initial upload Download this version

Attached files

File Type Description Last updated
Final Project Proposal.docx background Project Proposal over 5 years ago, by Kevin Jin Download
Final Report.pdf pdf Final Report over 5 years ago, by Kevin Jin Download
Final Research poster.pptx powerpoint final poster over 5 years ago, by Kevin Jin Download
KevinJin_June1.docx background Progress Report 3 over 5 years ago, by Kevin Jin Download
KevinJin_May18.docx background Progress Report 1 over 5 years ago, by Kevin Jin Download
KevinJin_May25.docx background Progress Report 2 over 5 years ago, by Kevin Jin Download
poster SLAM.pdf powerpoint PosterSLAM over 5 years ago, by Kevin Jin Download
Terror Paranoia.png preview View over 5 years ago, by Kevin Jin Download
Terror Paranoia.png preview interface preview over 5 years ago, by Kevin Jin Download

This model does not have any ancestors.


Graph of models related to 'Terror Paranoia'