Fleeing From Fire
Model was written in NetLogo 6.3.0
•
Viewed 7 times
•
Downloaded 0 times
•
Run 0 times
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
;; Fleeing From Fire ;; David Knoke, University of Minnesota ;; August 16, 2024 breed [attenders attender] ;; People try to leave the enclosed room when a fire breaks out breed [flames flame] ;; The stage is on fire!! globals [ colors initial-blue initial-green bluepct greenpct escapedpct ;; percent escaped crushedpct ;; percent crushed exit-1-x exit-1-y exit-2-x exit-2-y exit-3-x exit-3-y interior-patches ;; Inside of building exterior-patches ;; Outside of building number-attenders number-crushedattenders number-escapedattenders ] attenders-own [ target-exit escaped-attender? crushed-attender? ] to setup clear-all ;; Create interior-patches colored white set interior-patches patches with [ (pycor < 25 and pycor > -20) and (pxcor > -20 and pxcor < 20) ] ask interior-patches [set pcolor white] ;; Create exterior-patches colored yellow set exterior-patches patches with [ (pxcor < -20) or (pxcor > 20) or (pycor < -20) ] ask exterior-patches [set pcolor yellow] ;; Create flames on stage at top of room create-flames 1 [setxy 3 27 set shape "fire" set size 6] create-flames 1 [setxy -3 27 set shape "fire" set size 6] draw-walls initialize-attenders initialize-exits set-target-exits reset-ticks end to draw-walls ;; Make 4 walls , color interior white ask patches with [ (pxcor = 20 and pycor > -20 ) or (pxcor = -20 and pycor > -20) ] [set pcolor black] ask patches with [ pycor = 25 and ((pxcor > -21) and (pxcor < 21)) ] [set pcolor black] ask patches with [ pycor = -20 and ((pxcor > -21) and (pxcor < 21)) ] [set pcolor black] ask patches with [ pxcor = 20 and (pycor > 9 and pycor < 13) ] [set pcolor pink] ask patches with [ pxcor = -20 and (pycor > 9 and pycor < 13) ] [set pcolor pink] ask patches with [ pycor = -20 and (pxcor > -3 and pxcor < 3) ] [set pcolor pink] end to initialize-attenders ;; Create N attenders based on slide, then moving to random location inside building create-attenders N-Attenders [ set shape "person" set color blue setxy random-xcor random-ycor set size 3 set escaped-attender? false set crushed-attender? false set target-exit "" move-to one-of interior-patches ;; Count number of attenders of each color set initial-blue count attenders with [color = blue] ;; attenders inside club set initial-green count attenders with [color = green] ;; escaped ] end to initialize-exits set exit-1-x 20 set exit-1-y 11 set exit-2-x -20 set exit-2-y 11 set exit-3-x 0 set exit-3-y -20 end to set-target-exits ;; Attenders target the exit in their quadrant ask attenders [ if xcor >= 0 and ycor >= 0 [ set target-exit "exit 1" ] if xcor <= 0 and ycor >= 0 [ set target-exit "exit 2" ] if ycor <= 0 [ set target-exit "exit 3" ] ] end to go ;; Stop when no attenders remain in building if (count attenders with [color = blue] = 0) [stop] move deathattenders tally tick end to move ask attenders with [escaped-attender? = false] [ go-toward-exits ] end to go-toward-exits if target-exit = "exit 1" [ facexy 20 11 ifelse xcor < 20 [ forward 0.1 ] [ if target-exit = "exit 1" [ facexy exit-1-x exit-1-y ifelse xcor <= exit-1-x and ycor <= exit-1-y [ forward 0.1 ] [ set color green let yellow-patches (patches in-radius 10 with [pcolor = yellow] ) move-to one-of yellow-patches set escaped-attender? true ] ] ] ] if target-exit = "exit 2" [ facexy -20 11 ifelse xcor > -20 [ forward 0.1 ] [ if target-exit = "exit 2" [ facexy exit-2-x exit-2-y ifelse xcor >= exit-2-x and ycor >= exit-2-y [ forward 0.1 ] [ set color green let yellow-patches (patches in-radius 10 with [pcolor = yellow] ) move-to one-of yellow-patches set escaped-attender? true ] ] ] ] if target-exit = "exit 3" [ facexy -0 -20 ifelse xcor > 0 [ forward 0.1 ] [ if target-exit = "exit 3" [ facexy exit-3-x exit-3-y ifelse xcor <= exit-3-x and ycor >= exit-3-y [ forward 0.1 ] [ set color green let yellow-patches (patches in-radius 10 with [pcolor = yellow] ) move-to one-of yellow-patches set escaped-attender? true ] ] ] ] end ;;to crush ;; ask attenders with [count attenders-here >= DieNumber] ;; [ask one-of attenders-here [set color black] ;; ] ;;end to deathattenders ask attenders with [count turtles-here >= DieNumber] [ask one-of attenders-here [set color black] ] ask attenders with [color = black] [ set number-crushedattenders number-crushedattenders + 1 set number-escapedattenders initial-blue - number-crushedattenders ;; die ] end to tally ;; Percentages for BehavioralSpace experiments set bluepct count (attenders with [color = blue]) / (count attenders) * 100 set greenpct count (attenders with [color = green]) /(count attenders) * 100 set escapedpct count attenders with [color = green] / initial-blue * 100 set crushedpct count attenders with [color = black] / initial-blue * 100 end
There is only one version of this model, created 3 days ago by David Knoke.
Attached files
File | Type | Description | Last updated | |
---|---|---|---|---|
Fleeing From Fire.png | preview | Preview for 'Fleeing From Fire' | 3 days ago, by David Knoke | Download |
This model does not have any ancestors.
This model does not have any descendants.