USA Mass shooting model (NetLogo 6.04)

USA Mass shooting model (NetLogo 6.04) preview image

1 collaborator

Tags

mass shooting 

Tagged by Ivan Smarzhevskiy over 4 years ago

shooter 

Tagged by Ivan Smarzhevskiy over 4 years ago

Visible to everyone | Changeable by everyone
Model was written in NetLogo 6.0.4 • Viewed 265 times • Downloaded 10 times • Run 0 times
Download the 'USA Mass shooting model (NetLogo 6.04)' 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

Model running

The model runs very slowly on the web (with the number of agents (people) of the order of 10,000). It is recommended to download the model.

Posted over 4 years ago

Click to Run Model

globals [i objects]

;; service variables are  i, objects
breed [humans human]
breed [guns gun]
breed [shots shot]
breed [stressors stressor]
humans-own
[psycho ;; boolean
 hasgun ;; boolean
 alive  ;; boolean
 drive  ;; boolean
 age
 life_span
 stress_list          ;; Memory for stressors. Psycho has the memory, normal humans has't it
 memory_size
]
stressors-own [value]

to setup
  clear-all
  create-ordered-shots 10 [set size turt_size set shape "star" set color black]   ;; create shots figures
  create-ordered-humans quantity
    [
    set size turt_size set shape "person"
   ;; set label who
    set age random 75                     ;; population of different ages humans. They are alive now, not just born.
    set life_span random-normal 75 6
    set hasgun false
    set alive true
    set drive false
    set stress_list []
    set memory_size 3
    ifelse (random 100000 < PsychoPer100000) [set psycho true set color blue write "Psycho" show who] [set psycho false set color green]
    setxy random-xcor random-ycor
    ]
  create-ordered-guns quantity * GunHumanRatio
    [
    set color white
    set size turt_size  set shape "gun1"

    setxy random-xcor random-ycor
    ]

  write "Psycho"                ;;  {------OBSERVER------}
  show count humans with [psycho];; {------OBSERVER------}
  show  "---------------- setup done ------------------"
  reset-ticks
end 
;-------------------------------------------------------------------------------------

to go


  ask humans with [alive] [lt random Stoch_Motion_Speed fd random 2 * Stoch_Motion_Speed] ;;; move it stochasticaly!!!
  ask guns [lt random Stoch_Motion_Speed fd random 2 * Stoch_Motion_Speed] ;;; move it stochasticaly!!!

  create-stressors quantity * StressorsHumanRatio                ;;; generation stressor factor as breed
    [
    set color red
    setxy random-xcor random-ycor
    set value random 1000
    set hidden? not StressorsVisible
    ]
  HasGun?
  HasDrive?
  Fire!!!
  tick
  generation                                              ;; new humans
  ask humans [set age age + 1]
  ask humans with [alive and age > life_span] [die]       ;; corpses don't die )))

  ask stressors [die]

  if (ticks = 10000 or count humans with [alive] = 0) [stop]
end 
;-----------------------------------------------

to HasGun?   ;; Is there a gun next to human?
  ask humans [
    ifelse (count guns in-radius GunRadius) > 0 [set hasgun true] [set hasgun false]
             ]
end 

to HasDrive?
  ask humans
  [
     let vp sum [value] of stressors in-radius StressRadius
     ifelse length  stress_list < memory_size
        [set stress_list lput vp stress_list ]
        [set stress_list remove 0 stress_list set stress_list lput vp stress_list]
     ifelse psycho
      [   ifelse (sum stress_list > ShootingLevel)  [set drive true][set drive false]  ]
      [   ifelse (last stress_list > ShootingLevel) [set drive true][set drive false]  ]
  ]
end 

to Fire!!!
  ask humans with [drive and alive and age > 11]                                ;;;;  [psycho and alive and age > 15 and drive] OLD version
  [ if hasgun and random 100 < 33

  [ let vpx xcor let vpy ycor
    set objects count other humans in-radius FireRadius
    if objects > 0
      [
      set i 0
      while [i < min list objects 10]   ;; we have 10 shots figures only
      [
        ask shot i [set color yellow set xcor vpx + random i set ycor vpy - random i]
        show "Boo-bookh!!!"
        set i i + 1
      ]
      ask other humans in-radius FireRadius [set alive false set color red]
      set alive false             ;; now psycho  is dead
      write "Ticks, Shooter's  age, victims, Psycho?" write ticks  write age  write objects show psycho
     stop
     ]
  ]
  ]
end 

to generation
  let v count humans with [alive and age > 15 and age < 46]
  create-ordered-humans random-normal (v * TickReprRatio% / 100 ) (v / 20)
    [
    set size turt_size set shape "person"

    set age 0
    set life_span random-normal 75 6
    set hasgun false
    set alive true
    set drive false
    set stress_list []
    set memory_size 3
    ifelse (random 100000 < PsychoPer100000) [set psycho true set color blue write "Psycho" show who] [set psycho false set color green]
    setxy random-xcor random-ycor
    ]
end 

There is only one version of this model, created over 4 years ago by Ivan Smarzhevskiy.

Attached files

File Type Description Last updated
USA Mass shooting model (NetLogo 6.04).png preview Preview for 'USA Mass shooting model (NetLogo 6.04)' over 4 years ago, by Ivan Smarzhevskiy Download

This model does not have any ancestors.

This model does not have any descendants.