Building Evacuation

No preview image

2 collaborators

Default-person David Haynes (Author)
Default-person Conor Horan (Author)

Tags

evacuation 

Tagged by David Haynes about 6 years ago

safety 

Tagged by David Haynes about 6 years ago

Visible to everyone | Changeable by everyone
Model was written in NetLogo 5.0.4 • Viewed 1649 times • Downloaded 184 times • Run 0 times
Download the 'Building Evacuation' 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

globals [
  row
  aisle 
  goal-x goal-y
  n
]

patches-own [path?]
turtles-own [direction
  fast?
  fear?
  other-nearby]

to setup ; linked with setup button on interface
  clear-all
  
  setup-patches ;declaration, created further down in code
  
  set-default-shape turtles "person" ;makes them look like people
  ask n-of number patches with [pcolor = blue]  ; makes turtles sprout on blue patches only
  [
    sprout 1 [
      if count neighbors4 with [pcolor = brown] = 4 [ die ]  
      set size 1              ;; setting turtle size
      facexy -132 55 ; initial direction faceing
      set direction 1
      set color green     ;initial color
      if xcor mod 2 != 0 [set fast? false] ;seting half the turtles to have boolean fast? false
      if xcor mod 2 = 0 [set fast? true]
      if turtles != red [set fear? false]; sets turtles not red to not have fear
      
                                         ;Kirwan
      if xcor <= 6 and xcor >= -6 [walk1];calls function walk one for turtles in specified zone
      
      
      if xcor <= 0 and xcor >= -7 [ set heading -90] ;tells turtles in zone what direction to face
      if xcor > 0 and xcor <= 7 [ set heading 90]
      if xcor >= -11 and xcor < -7 [set heading 90]
      if xcor <= 11 and xcor > 7 [set heading -90]
      
      ;Larmour
      if xcor <= 30 and xcor >= 16 [walk1]
      
      ;Dillon
      
      if xcor <= -16 and xcor >= -30 [walk1]    
      
      ;AC201
      
      if xcor < 56 and xcor >= 35 [walk1]
      
      ;AC202
      
      if xcor >= 57 and ycor < 48 and xcor <= 72 and ycor >= 40  [ set heading 0 ]
      
      ;AC203
      
      if xcor >= 73 and ycor < 48 and xcor < 84 and ycor >= 40 [set heading 0]
      
      ;AC204
      
      if xcor >= 84 and ycor < 48 and xcor <= 95 and ycor >= 40 [set heading 0]
      
      ;O'Flaherty
      if xcor = 102 and ycor > 10 and ycor < 42 [ set heading 0]
      if xcor = 103 and ycor > 10 and ycor < 42 [ set heading 0]
      if xcor = 114 and ycor > 10 and ycor < 42 [ set heading 0]
      if xcor = 115 and ycor > 10 and ycor < 42 [ set heading 0]
      
      if xcor >= 96 and xcor <= 100 [set heading 90]
      if xcor >= 115 and xcor <= 118 [set heading -90]
      if xcor >= 102 and xcor <= 113 [walk1]  
      
      ;D'arcy Thompson
      if xcor >= 120 and xcor <= 134 [walk1] 
      
      ;Cairne
      if xcor >= 136 and xcor <= 139 [set heading 90]
      if xcor >= 155 and xcor <= 158 [set heading -90]
      if xcor >= 141 and xcor <= 153 [walk1]
      
      ;McMunn
      if xcor < -127 and xcor > -138 [walk1]
      
    ]
    
  ]
  fear ;calls function fear
  reset-ticks
end 

to walk1 ;function earlier called
  
  ifelse ((random 2) = 0);allows turtles randomly decide if they will go left or right in rows.
    [
      go-left
    ]
    [
      go-right
    ]
end 

to go-left 
  set heading 90
end 

to go-right
  set heading -90
end 

to setup-patches 
  ;creates rows, aisles, concourse and exits
  draw-row
  draw-concourse
  draw-aisle
  draw-exit1
  draw-exit2
  draw-exit3
  draw-exit4
  draw-exit5
  draw-exit6
  draw-exit7
  draw-exit8
  draw-exit9
  draw-exit10
  draw-exit11
  draw-exit12
  draw-exit13
  draw-exit14
  draw-exit15
  draw-exit16
  
  ;Labels
  ask patch -1 -21[
    set plabel-color white
    set plabel "Kirwan"]
  
  ask patch 24 22[
    set plabel-color white
    set plabel "Larmour"]
  
  ask patch -24 22[
    set plabel-color white
    set plabel "Dillon"]
  
  ask patch 44 38[
    set plabel-color white
    set plabel "AC201"]
  
  ask patch 63 38 [
    set plabel-color white
    set plabel "AC202"]
  
  ask patch 80 38 [
    set plabel-color white
    set plabel "AC203"]
  
  ask patch 90 38 [
    set plabel-color white
    set plabel "AC204"]
  
  ask patch 110 7 [
    set plabel-color white
    set plabel "O'Flaherty"]
  
  ask patch 135 -2 [
    set plabel-color white
    set plabel "D'arcy Thompson"]
  
  ask patch 146 18 [
    set plabel-color white
    set plabel "Cairnes"]
  
  ask patch -130 24 [
    set plabel-color white
    set plabel "McMunn"]
  
  ask patch -38 37 [
    set plabel-color white
    set plabel "Media Centre"]
  
  ask patch -50 37 [
    set plabel-color white
    set plabel "Smokey's Café"]
  
  ask patch 2 71[
    set plabel-color Black
    set plabel "Stairs"]
end 

to draw-concourse
  ask patches with [pycor >= 41 and pycor <= 54 and pxcor >= -139 and pxcor <= 34];asks particular zone of patches to turn their color to brown
  [set pcolor brown]
  ask patches with [pycor >= 49 and pycor <= 54 and pxcor >= 35 and pxcor <= 158]
  [set pcolor brown]
  ask patches with [pxcor >= -15 and pycor >= 24 and pxcor <= 15 and pycor <= 48]
  [set pcolor brown] 
  ask patches with [pxcor >= 16 and pycor >= 39 and pxcor <= 34 and pycor <= 48]
  [set pcolor brown]
  ask patches with [pxcor <= -16 and pycor >= 39 and pxcor >= -34 and pycor <= 48]
  [set pcolor brown]
  ask patches with [pxcor >= -11 and pycor >= 55 and pxcor <= 11 and pycor <= 85]
  [set pcolor brown]
  ask patches with [pxcor >= 95 and pycor >= 43 and pxcor <= 158 and pycor <= 48]
  [set pcolor brown]
  ask patches with [pxcor >= 119 and pycor >= 23 and pxcor <= 135 and pycor <= 42]
  [set pcolor brown]
  ask patches with [pxcor >= -84 and pycor >= 39 and pxcor <= -60 and pycor <= 45]
  [set pcolor brown]
  ask patches with [pxcor >= -64 and pycor >= 46 and pxcor <= -50 and pycor <= 48]
  [set pcolor brown]
  ask patches with [pxcor >= -3 and pycor >= 68 and pxcor <= 3 and pycor <= 78]
  [set pcolor white]
  
  ;media centre
  ask patches with [pxcor <= -35 and pycor <= 48 and pxcor > -50 and pycor >= 39]
  [set pcolor white]
  
  ;smokies cafe
  ask patches with [pxcor <= -50 and pycor <= 45 and pxcor > -62 and pycor >= 39]
  [set pcolor green]
  
  ;smokies seating
  ask patches with [pxcor <= -65 and pycor <= 48 and pxcor > -85 and pycor >= 45]
  [set pcolor brown]
  ask patches with [pxcor <= -85 and pycor <= 48 and pxcor > -126 and pycor >= 39]
  [set pcolor brown]
  ;table1
  ask patches with [pxcor <= -72 and pycor = 39 and pxcor >= -75]
  [set pcolor blue]
  ask patches with [pxcor <= -72 and pycor = 42 and pxcor >= -75]
  [set pcolor blue]
  ask patches with [pxcor = -77 and pycor >= 40 and pycor <= 41]
  [set pcolor blue]
  ask patches with [pxcor = -70 and pycor >= 40 and pycor <= 41]
  [set pcolor blue]
  ;table 2
  ask patches with [pxcor <= -81 and pycor = 39 and pxcor >= -84]
  [set pcolor blue]
  ask patches with [pxcor <= -81 and pycor = 42 and pxcor >= -84]
  [set pcolor blue]
  ask patches with [pxcor = -86 and pycor >= 40 and pycor <= 41]
  [set pcolor blue]
  ask patches with [pxcor = -79 and pycor >= 40 and pycor <= 41]
  [set pcolor blue]
  ;table 3
  ask patches with [pxcor <= -90 and pycor = 39 and pxcor >= -93]
  [set pcolor blue]
  ask patches with [pxcor <= -90 and pycor = 42 and pxcor >= -93]
  [set pcolor blue]
  ask patches with [pxcor = -95 and pycor >= 40 and pycor <= 41]
  [set pcolor blue]
  ask patches with [pxcor = -88 and pycor >= 40 and pycor <= 41]
  [set pcolor blue]
  ;table 4
  ask patches with [pxcor <= -99 and pycor = 39 and pxcor >= -102]
  [set pcolor blue]
  ask patches with [pxcor <= -99 and pycor = 42 and pxcor >= -102]
  [set pcolor blue]
  ask patches with [pxcor = -104 and pycor >= 40 and pycor <= 41]
  [set pcolor blue]
  ask patches with [pxcor = -97 and pycor >= 40 and pycor <= 41]
  [set pcolor blue]
  ;table 5
  ask patches with [pxcor <= -108 and pycor = 39 and pxcor >= -111]
  [set pcolor blue]
  ask patches with [pxcor <= -108 and pycor = 42 and pxcor >= -111]
  [set pcolor blue]
  ask patches with [pxcor = -113 and pycor >= 40 and pycor <= 41]
  [set pcolor blue]
  ask patches with [pxcor = -106 and pycor >= 40 and pycor <= 41]
  [set pcolor blue]
  ;table 6
  ask patches with [pxcor <= -81 and pycor = 44 and pxcor >= -84]
  [set pcolor blue]
  ask patches with [pxcor <= -81 and pycor = 47 and pxcor >= -84]
  [set pcolor blue]
  ask patches with [pxcor = -86 and pycor >= 45 and pycor <= 46]
  [set pcolor blue]
  ask patches with [pxcor = -79 and pycor >= 45 and pycor <= 46]
  [set pcolor blue]
  ;table 7
  ask patches with [pxcor <= -90 and pycor = 44 and pxcor >= -93]
  [set pcolor blue]
  ask patches with [pxcor <= -90 and pycor = 47 and pxcor >= -93]
  [set pcolor blue]
  ask patches with [pxcor = -95 and pycor >= 45 and pycor <= 46]
  [set pcolor blue]
  ask patches with [pxcor = -88 and pycor >= 45 and pycor <= 46]
  [set pcolor blue]
  ;table 8
  ask patches with [pxcor <= -99 and pycor = 44 and pxcor >= -102]
  [set pcolor blue]
  ask patches with [pxcor <= -99 and pycor = 47 and pxcor >= -102]
  [set pcolor blue]
  ask patches with [pxcor = -104 and pycor >= 45 and pycor <= 46]
  [set pcolor blue]
  ask patches with [pxcor = -97 and pycor >= 45 and pycor <= 46]
  [set pcolor blue]
  ;table 9
  ask patches with [pxcor <= -108 and pycor = 44 and pxcor >= -111]
  [set pcolor blue]
  ask patches with [pxcor <= -108 and pycor = 47 and pxcor >= -111]
  [set pcolor blue]
  ask patches with [pxcor = -113 and pycor >= 45 and pycor <= 46]
  [set pcolor blue]
  ask patches with [pxcor = -106 and pycor >= 45 and pycor <= 46]
  [set pcolor blue]
  ;table 10
  ask patches with [pxcor <= -117 and pycor = 44 and pxcor >= -120]
  [set pcolor blue]
  ask patches with [pxcor <= -117 and pycor = 47 and pxcor >= -120]
  [set pcolor blue]
  ask patches with [pxcor = -122 and pycor >= 45 and pycor <= 46]
  [set pcolor blue]
  ask patches with [pxcor = -115 and pycor >= 45 and pycor <= 46]
  [set pcolor blue]  
end 

to draw-row;draws rows in the theatres....turtles can sprout here
           ;Kirwan  
  ask patches with [pxcor < 12 and pxcor > -12 and pycor = 23]
    [set pcolor blue]
  ask patches with [pxcor < 12 and pxcor > -12 and pycor = 21]
    [set pcolor blue]
  ask patches with [pxcor < 12 and pxcor > -12 and pycor = 19]
    [set pcolor blue]
  ask patches with [pxcor < 12 and pxcor > -12 and pycor = 17]
    [set pcolor blue]
  ask patches with [pxcor < 12 and pxcor > -12 and pycor = 15]
    [set pcolor blue]
  ask patches with [pxcor < 12 and pxcor > -12 and pycor = 13]
    [set pcolor blue]
  ask patches with [pxcor < 12 and pxcor > -12 and pycor = 11]
    [set pcolor blue]
  ask patches with [pxcor < 12 and pxcor > -12 and pycor = 9]
    [set pcolor blue]
  ask patches with [pxcor < 12 and pxcor > -12 and pycor = 7]
    [set pcolor blue]
  ask patches with [pxcor < 12 and pxcor > -12 and pycor = 5]
    [set pcolor blue]
  ask patches with [pxcor < 12 and pxcor > -12 and pycor = 3]
    [set pcolor blue]
  ask patches with [pxcor < 12 and pxcor > -12 and pycor = 1]
    [set pcolor blue]
  ask patches with [pxcor < 12 and pxcor > -12 and pycor = -1]
    [set pcolor blue]
  ask patches with [pxcor < 12 and pxcor > -12 and pycor = -3]
    [set pcolor blue]
  ask patches with [pxcor < 12 and pxcor > -12 and pycor = -5]
    [set pcolor blue]
  ask patches with [pxcor < 12 and pxcor > -12 and pycor = -7]
    [set pcolor blue]
  ask patches with [pxcor < 12 and pxcor > -12 and pycor = -9]
    [set pcolor blue]
  ask patches with [pxcor < 12 and pxcor > -12 and pycor = -11]
    [set pcolor blue]
  ask patches with [pxcor < 12 and pxcor > -12 and pycor = -13]
    [set pcolor blue]
  ask patches with [pxcor < 12 and pxcor > -12 and pycor = -15]
    [set pcolor blue]
  ask patches with [pxcor < 12 and pxcor > -12 and pycor = -17]
    [set pcolor blue]
  ask patches with [pxcor < 12 and pxcor > -12 and pycor = -19]
    [set pcolor blue]
  
  ;Larmour
  ask patches with [pxcor < 29 and pxcor > 17 and pycor = 38]
    [set pcolor blue]
  ask patches with [pxcor < 29 and pxcor > 17 and pycor = 36]
    [set pcolor blue]
  ask patches with [pxcor < 29 and pxcor > 17 and pycor = 34]
    [set pcolor blue]
  ask patches with [pxcor < 29 and pxcor > 17 and pycor = 32]
    [set pcolor blue]
  ask patches with [pxcor < 29 and pxcor > 17 and pycor = 30]
    [set pcolor blue]
  ask patches with [pxcor < 29 and pxcor > 17 and pycor = 28]
    [set pcolor blue]
  ask patches with [pxcor < 29 and pxcor > 17 and pycor = 26]
    [set pcolor blue]
  ask patches with [pxcor < 29 and pxcor > 17 and pycor = 24]
    [set pcolor blue]   
  
  ;Dillon 
  ask patches with [pxcor < -17 and pxcor > -29 and pycor = 38]
    [set pcolor blue]
  ask patches with [pxcor < -17 and pxcor > -29 and pycor = 36]
    [set pcolor blue]
  ask patches with [pxcor < -17 and pxcor > -29 and pycor = 34]
    [set pcolor blue]
  ask patches with [pxcor < -17 and pxcor > -29 and pycor = 32]
    [set pcolor blue]
  ask patches with [pxcor < -17 and pxcor > -29 and pycor = 30]
    [set pcolor blue]
  ask patches with [pxcor < -17 and pxcor > -29 and pycor = 28]
    [set pcolor blue]
  ask patches with [pxcor < -17 and pxcor > -29 and pycor = 26]
    [set pcolor blue]
  ask patches with [pxcor < -17 and pxcor > -29 and pycor = 24]
    [set pcolor blue]
  
  ;AC201
  ask patches with [pxcor < 56 and pxcor > 35 and pycor = 40]
    [set pcolor blue]      
  ask patches with [pxcor < 56 and pxcor > 35 and pycor = 42]
    [set pcolor blue]
  ask patches with [pxcor < 56 and pxcor > 35 and pycor = 44]
    [set pcolor blue]
  ask patches with [pxcor < 52 and pxcor > 39 and pycor = 46]
    [set pcolor blue]
  
  ;AC202
  ask patches with [pycor < 48 and pycor > 39 and pxcor = 58]
  [set pcolor blue] 
  ask patches with [pycor < 48 and pycor > 39 and pxcor = 60]
    [set pcolor blue]  
  ask patches with [pycor < 48 and pycor > 39 and pxcor = 62]
    [set pcolor blue] 
  ask patches with [pycor < 48 and pycor > 39 and pxcor = 64]
    [set pcolor blue] 
  ask patches with [pycor < 48 and pycor > 39 and pxcor = 66]
    [set pcolor blue]   
  ask patches with [pycor < 48 and pycor > 39 and pxcor = 68]
    [set pcolor blue]    
  ask patches with [pycor < 48 and pycor > 39 and pxcor = 70]
    [set pcolor blue] 
  ask patches with [pycor < 48 and pycor > 39 and pxcor = 72]
    [set pcolor blue] 
  
  
  ;AC203
  ask patches with [pycor <= 48 and pycor > 39 and pxcor = 73]
    [set pcolor yellow]
  ask patches with [pycor < 48 and pycor > 39 and pxcor = 75]
    [set pcolor blue]
  ask patches with [pycor < 48 and pycor > 39 and pxcor = 77]
    [set pcolor blue]
  ask patches with [pycor < 48 and pycor > 39 and pxcor = 79]
    [set pcolor blue]
  ask patches with [pycor < 48 and pycor > 39 and pxcor = 81]
    [set pcolor blue]
  ask patches with [pycor < 48 and pycor > 39 and pxcor = 83]
    [set pcolor blue]
  
  ;AC204
  ask patches with [pycor <= 48 and pycor > 39 and pxcor = 84]
    [set pcolor yellow]
  ask patches with [pycor < 48 and pycor > 39 and pxcor = 86]
    [set pcolor blue]
  ask patches with [pycor < 48 and pycor > 39 and pxcor = 88]
    [set pcolor blue]
  ask patches with [pycor < 48 and pycor > 39 and pxcor = 90]
    [set pcolor blue]
  ask patches with [pycor < 48 and pycor > 39 and pxcor = 92]
    [set pcolor blue]
  ask patches with [pycor < 48 and pycor > 39 and pxcor = 94]
    [set pcolor blue]
  
  ;O'Flaherty
  ask patches with [pxcor <= 100 and pxcor > 96 and pycor = 42]
    [set pcolor blue]
  ask patches with [pxcor <= 100 and pxcor > 96 and pycor = 40]
    [set pcolor blue]
  ask patches with [pxcor <= 100 and pxcor > 96 and pycor = 38]
    [set pcolor blue]
  ask patches with [pxcor <= 100 and pxcor > 96 and pycor = 36]
    [set pcolor blue]
  ask patches with [pxcor <= 100 and pxcor > 96 and pycor = 34]
    [set pcolor blue]
  ask patches with [pxcor <= 100 and pxcor > 96 and pycor = 32]
    [set pcolor blue]
  ask patches with [pxcor <= 100 and pxcor > 96 and pycor = 30]
    [set pcolor blue]
  ask patches with [pxcor <= 100 and pxcor > 96 and pycor = 28]
    [set pcolor blue] 
  ask patches with [pxcor <= 100 and pxcor > 96 and pycor = 26]
    [set pcolor blue]
  ask patches with [pxcor <= 100 and pxcor > 96 and pycor = 24]
    [set pcolor blue]
  ask patches with [pxcor <= 100 and pxcor > 96 and pycor = 22]
    [set pcolor blue]
  ask patches with [pxcor <= 100 and pxcor > 96 and pycor = 20]
    [set pcolor blue]
  ask patches with [pxcor <= 100 and pxcor > 96 and pycor = 18]
    [set pcolor blue]
  ask patches with [pxcor <= 100 and pxcor > 96 and pycor = 16]
    [set pcolor blue]
  ask patches with [pxcor <= 100 and pxcor > 96 and pycor = 14]
    [set pcolor blue]
  ask patches with [pxcor <= 100 and pxcor > 96 and pycor = 12]
    [set pcolor blue]
  ask patches with [pxcor <= 100 and pxcor > 96 and pycor = 10]
    [set pcolor blue] 
  ask patches with [pxcor < 113 and pxcor > 102 and pycor = 42]
    [set pcolor blue]
  ask patches with [pxcor < 113 and pxcor > 102 and pycor = 40]
    [set pcolor blue]
  ask patches with [pxcor < 113 and pxcor > 102 and pycor = 38]
    [set pcolor blue]
  ask patches with [pxcor < 113 and pxcor > 102 and pycor = 36]
    [set pcolor blue]
  ask patches with [pxcor < 113 and pxcor > 102 and pycor = 34]
    [set pcolor blue]
  ask patches with [pxcor < 113 and pxcor > 102 and pycor = 32]
    [set pcolor blue]
  ask patches with [pxcor < 113 and pxcor > 102 and pycor = 30]
    [set pcolor blue]
  ask patches with [pxcor < 113 and pxcor > 102 and pycor = 28]
    [set pcolor blue] 
  ask patches with [pxcor < 113 and pxcor > 102 and pycor = 26]
    [set pcolor blue]
  ask patches with [pxcor < 113 and pxcor > 102 and pycor = 24]
    [set pcolor blue]
  ask patches with [pxcor < 113 and pxcor > 102 and pycor = 22]
    [set pcolor blue]
  ask patches with [pxcor < 113 and pxcor > 102 and pycor = 20]
    [set pcolor blue]
  ask patches with [pxcor < 113 and pxcor > 102 and pycor = 18]
    [set pcolor blue]
  ask patches with [pxcor < 113 and pxcor > 102 and pycor = 16]
    [set pcolor blue]
  ask patches with [pxcor < 113 and pxcor > 102 and pycor = 14]
    [set pcolor blue]
  ask patches with [pxcor < 113 and pxcor > 102 and pycor = 12]
    [set pcolor blue] 
  ask patches with [pxcor < 113 and pxcor > 102 and pycor = 10]
    [set pcolor blue]   
  ask patches with [pxcor < 119 and pxcor > 114 and pycor = 42]
    [set pcolor blue]
  ask patches with [pxcor < 119 and pxcor > 114 and pycor = 40]
    [set pcolor blue]
  ask patches with [pxcor < 119 and pxcor > 114 and pycor = 38]
    [set pcolor blue]
  ask patches with [pxcor < 119 and pxcor > 114 and pycor = 36]
    [set pcolor blue]
  ask patches with [pxcor < 119 and pxcor > 114 and pycor = 34]
    [set pcolor blue]
  ask patches with [pxcor < 119 and pxcor > 114 and pycor = 32]
    [set pcolor blue]
  ask patches with [pxcor < 119 and pxcor > 114 and pycor = 30]
    [set pcolor blue]
  ask patches with [pxcor < 119 and pxcor > 114 and pycor = 28]
    [set pcolor blue]    
  ask patches with [pxcor < 119 and pxcor > 114 and pycor = 26]
    [set pcolor blue]
  ask patches with [pxcor < 119 and pxcor > 114 and pycor = 24]
    [set pcolor blue]
  ask patches with [pxcor < 119 and pxcor > 114 and pycor = 22]
    [set pcolor blue]
  ask patches with [pxcor < 119 and pxcor > 114 and pycor = 20]
    [set pcolor blue]
  ask patches with [pxcor < 119 and pxcor > 114 and pycor = 18]
    [set pcolor blue]
  ask patches with [pxcor < 119 and pxcor > 114 and pycor = 16]
    [set pcolor blue]
  ask patches with [pxcor < 119 and pxcor > 114 and pycor = 14]
    [set pcolor blue]
  ask patches with [pxcor < 119 and pxcor > 114 and pycor = 12]
    [set pcolor blue] 
  ask patches with [pxcor < 119 and pxcor > 114 and pycor = 10]
    [set pcolor blue]   
  
  
  ;D'arcy Thompson
  ask patches with [pxcor < 130 and pxcor >= 119 and pycor = 22]
    [set pcolor blue]
  ask patches with [pxcor < 135 and pxcor >= 119 and pycor = 20]
    [set pcolor blue]
  ask patches with [pxcor < 135 and pxcor >= 119 and pycor = 18]
    [set pcolor blue]
  ask patches with [pxcor < 135 and pxcor >= 119 and pycor = 16]
    [set pcolor blue]
  ask patches with [pxcor < 135 and pxcor >= 119 and pycor = 14]
    [set pcolor blue]
  ask patches with [pxcor < 135 and pxcor >= 119 and pycor = 12]
    [set pcolor blue]
  ask patches with [pxcor < 135 and pxcor >= 119 and pycor = 10]
    [set pcolor blue]
  ask patches with [pxcor < 135 and pxcor >= 119 and pycor = 8]
    [set pcolor blue]  
  ask patches with [pxcor < 135 and pxcor >= 119 and pycor = 6]
    [set pcolor blue]   
  ask patches with [pxcor < 135 and pxcor >= 119 and pycor = 4]
    [set pcolor blue]  
  ask patches with [pxcor < 135 and pxcor >= 119 and pycor = 2]
    [set pcolor blue] 
  ask patches with [pxcor < 131 and pxcor >= 123 and pycor = 0]
    [set pcolor blue]
  
  ;Cairnes
  ask patches with [pxcor < 140 and pxcor >= 136 and pycor = 42]
    [set pcolor blue]
  ask patches with [pxcor < 140 and pxcor >= 136 and pycor = 40]
    [set pcolor blue]
  ask patches with [pxcor < 140 and pxcor >= 136 and pycor = 38]
    [set pcolor blue]
  ask patches with [pxcor < 140 and pxcor >= 136 and pycor = 36]
    [set pcolor blue]
  ask patches with [pxcor < 140 and pxcor >= 136 and pycor = 34]
    [set pcolor blue]
  ask patches with [pxcor < 140 and pxcor >= 136 and pycor = 32]
    [set pcolor blue]
  ask patches with [pxcor < 140 and pxcor >= 136 and pycor = 30]
    [set pcolor blue]
  ask patches with [pxcor < 140 and pxcor >= 136 and pycor = 28]
    [set pcolor blue]  
  ask patches with [pxcor < 140 and pxcor >= 136 and pycor = 26]
    [set pcolor blue]   
  ask patches with [pxcor < 140 and pxcor >= 136 and pycor = 24]
    [set pcolor blue]  
  ask patches with [pxcor < 140 and pxcor >= 136 and pycor = 22]
    [set pcolor blue] 
  ask patches with [pxcor < 140 and pxcor >= 136 and pycor = 20]
    [set pcolor blue]
  ask patches with [pxcor < 153 and pxcor >= 141 and pycor = 42]
    [set pcolor blue]
  ask patches with [pxcor < 153 and pxcor >= 141 and pycor = 40]
    [set pcolor blue]
  ask patches with [pxcor < 153 and pxcor >= 141 and pycor = 38]
    [set pcolor blue]
  ask patches with [pxcor < 153 and pxcor >= 141 and pycor = 36]
    [set pcolor blue]
  ask patches with [pxcor < 153 and pxcor >= 141 and pycor = 34]
    [set pcolor blue]
  ask patches with [pxcor < 153 and pxcor >= 141 and pycor = 32]
    [set pcolor blue]
  ask patches with [pxcor < 153 and pxcor >= 141 and pycor = 30]
    [set pcolor blue]
  ask patches with [pxcor < 153 and pxcor >= 141 and pycor = 28]
    [set pcolor blue]  
  ask patches with [pxcor < 153 and pxcor >= 141 and pycor = 26]
    [set pcolor blue]   
  ask patches with [pxcor < 153 and pxcor >= 141 and pycor = 24]
    [set pcolor blue]  
  ask patches with [pxcor < 153 and pxcor >= 141 and pycor = 22]
    [set pcolor blue] 
  ask patches with [pxcor < 153 and pxcor >= 141 and pycor = 20]
    [set pcolor blue]
  ask patches with [pxcor < 159 and pxcor >= 155 and pycor = 42]
    [set pcolor blue]
  ask patches with [pxcor < 159 and pxcor >= 155 and pycor = 40]
    [set pcolor blue]
  ask patches with [pxcor < 159 and pxcor >= 155 and pycor = 38]
    [set pcolor blue]
  ask patches with [pxcor < 159 and pxcor >= 155 and pycor = 36]
    [set pcolor blue]
  ask patches with [pxcor < 159 and pxcor >= 155 and pycor = 34]
    [set pcolor blue]
  ask patches with [pxcor < 159 and pxcor >= 155 and pycor = 32]
    [set pcolor blue]
  ask patches with [pxcor < 159 and pxcor >= 155 and pycor = 30]
    [set pcolor blue]
  ask patches with [pxcor < 159 and pxcor >= 155 and pycor = 28]
    [set pcolor blue]  
  ask patches with [pxcor < 159 and pxcor >= 155 and pycor = 26]
    [set pcolor blue]   
  ask patches with [pxcor < 159 and pxcor >= 155 and pycor = 24]
    [set pcolor blue]  
  ask patches with [pxcor < 159 and pxcor >= 155 and pycor = 22]
    [set pcolor blue] 
  ask patches with [pxcor < 159 and pxcor >= 155 and pycor = 20]
    [set pcolor blue]
  
  ;McMunn
  ask patches with [pxcor <= -128 and pxcor >= -137 and pycor = 40]
    [set pcolor blue]
  ask patches with [pxcor <= -128 and pxcor >= -137 and pycor = 38]
    [set pcolor blue]
  ask patches with [pxcor <= -128 and pxcor >= -137 and pycor = 36]
    [set pcolor blue]
  ask patches with [pxcor <= -128 and pxcor >= -137 and pycor = 34]
    [set pcolor blue]
  ask patches with [pxcor <= -128 and pxcor >= -137 and pycor = 32]
    [set pcolor blue]
  ask patches with [pxcor <= -128 and pxcor >= -137 and pycor = 30]
    [set pcolor blue]
  ask patches with [pxcor <= -128 and pxcor >= -137 and pycor = 28]
    [set pcolor blue]
  ask patches with [pxcor <= -128 and pxcor >= -137 and pycor = 26]
    [set pcolor blue]
end 

to draw-aisle
  ;draws aisles in theatres, where  turtles walk
  
  ;Kirwan
  ask patches with [pxcor = -6 and pycor > -20 and pycor < 24]
    [set pcolor grey]
  ask patches with [pxcor = -7 and pycor > -20 and pycor < 24]
    [set pcolor grey]
  ask patches with [pxcor = 6 and pycor > -20 and pycor < 24]
    [set pcolor grey]
  ask patches with [pxcor = 7 and pycor > -20 and pycor < 24]
    [set pcolor grey]
  
  ;Larmour
  ask patches with [pxcor = 17 and pycor > 23 and pycor < 39]
    [set pcolor grey]
  ask patches with [pxcor = 16 and pycor > 23 and pycor < 39]
    [set pcolor grey]
  ask patches with [pxcor = 29 and pycor > 23 and pycor < 39]
    [set pcolor grey]
  ask patches with [pxcor = 30 and pycor > 23 and pycor < 39]
    [set pcolor grey]
  
  ;Dillon
  ask patches with [pxcor = -17 and pycor > 23 and pycor < 39]
    [set pcolor grey]
  ask patches with [pxcor = -16 and pycor > 23 and pycor < 39]
    [set pcolor grey]
  ask patches with [pxcor = -29 and pycor > 23 and pycor < 39]
    [set pcolor grey]
  ask patches with [pxcor = -30 and pycor > 23 and pycor < 39]
    [set pcolor grey]
  
  ;Ac201
  ask patches with [pxcor = 35 and pycor > 39 and pycor <= 48]
    [set pcolor grey]
  ask patches with [pxcor = 56 and pycor > 39 and pycor <= 48]
    [set pcolor grey]
  ask patches with [pycor = 48 and pxcor > 35 and pxcor < 56]
    [set pcolor grey]
  ask patches with [pycor = 46 and pxcor > 35 and pxcor < 40]
    [set pcolor grey]
  ask patches with [pycor = 46 and pxcor > 51 and pxcor < 56]
    [set pcolor grey]
  
  ;AC202
  ask patches with [pycor = 48 and pxcor > 56 and pxcor < 73]
    [set pcolor grey]
  
  ;AC203
  ask patches with [pycor = 48 and pxcor > 73 and pxcor < 84]
    [set pcolor grey]
  
  ;AC204
  ask patches with [pycor = 48 and pxcor > 84 and pxcor < 95]
    [set pcolor grey]
  
  ;O'Flaherty
  ask patches with [pxcor = 101 and pycor >= 10 and pycor <= 42]
    [set pcolor grey]
  ask patches with [pxcor = 102 and pycor >= 10 and pycor <= 42]
    [set pcolor grey]
  ask patches with [pxcor = 113 and pycor >= 10 and pycor <= 42]
    [set pcolor grey]
  ask patches with [pxcor = 114 and pycor >= 10 and pycor <= 42]
    [set pcolor grey]
  
  ;D'arcy Thompson
  ask patches with [pxcor = 119 and pycor >= 0 and pycor <= 22]
    [set pcolor grey]
  ask patches with [pxcor = 135 and pycor >= 0 and pycor <= 22]
    [set pcolor grey]
  ask patches with [pycor = 22 and pxcor >= 130 and pxcor <= 134]
    [set pcolor grey]
  ask patches with [pycor = 0 and pxcor >= 120 and pxcor <= 123]
    [set pcolor grey]
  ask patches with [pycor = 0 and pxcor >= 130 and pxcor <= 134]
    [set pcolor grey]
  
  ;Cairnes
  ask patches with [pxcor = 141 and pycor >= 20 and pycor <= 42]
    [set pcolor grey]
  ask patches with [pxcor = 140 and pycor >= 20 and pycor <= 42]
    [set pcolor grey]
  ask patches with [pxcor = 153 and pycor >= 20 and pycor <= 42]
    [set pcolor grey]
  ask patches with [pxcor = 154 and pycor >= 20 and pycor <= 42]
    [set pcolor grey]
  
  ;McMunn
  ask patches with [pxcor = -139 and pycor >= 26 and pycor < 41]
    [set pcolor grey]
  ask patches with [pxcor = -138 and pycor >= 26 and pycor < 41]
    [set pcolor grey]
  ask patches with [pxcor = -127 and pycor >= 26 and pycor < 41]
    [set pcolor grey]
  ask patches with [pxcor = -126 and pycor >= 26 and pycor < 41]
    [set pcolor grey]
end 

to draw-exit1
  ;exits at top of concourse area, where turtles will leave
  set goal-x -7
  set goal-y 85
  ask patch goal-x goal-y [
    sprout 1 [ set pcolor red
      set shape "square"  
    ]
  ]
end 

to draw-exit2
  set goal-x 0
  set goal-y 85
  ask patch goal-x goal-y [
    sprout 1 [ set pcolor red
      set shape "square"  
    ]
  ]
end 

to draw-exit3
  set goal-x 7
  set goal-y 85
  ask patch goal-x goal-y [
    sprout 1 [ set pcolor red
      set shape "square"  
    ]
  ]
end 

to draw-exit4
  set goal-x -133
  set goal-y 55
  ask patch goal-x goal-y [
    sprout 1 [ set pcolor red
      set shape "square"  
    ]
  ]
end 

to draw-exit5
  set goal-x -132
  set goal-y 55
  ask patch goal-x goal-y [
    sprout 1 [ set pcolor red
      set shape "square"  
    ]
  ]
end 

to draw-exit6
  set goal-x -130
  set goal-y 55
  ask patch goal-x goal-y [
    sprout 1 [ set pcolor red
      set shape "square"  
    ]
  ]
end 

to draw-exit7
  set goal-x -135
  set goal-y 55
  ask patch goal-x goal-y [
    sprout 1 [ set pcolor red
      set shape "square"  
    ]
  ]
end 

to draw-exit8
  set goal-x 153
  set goal-y 55
  ask patch goal-x goal-y [
    sprout 1 [ set pcolor red
      set shape "square"  
    ]
  ]
end 

to draw-exit9
  set goal-x 152
  set goal-y 55
  ask patch goal-x goal-y [
    sprout 1 [ set pcolor red
      set shape "square"  
    ]
  ]
end 

to draw-exit10
  set goal-x 150
  set goal-y 55
  ask patch goal-x goal-y [
    sprout 1 [ set pcolor red
      set shape "square"  
    ]
  ]
end 

to draw-exit11
  set goal-x 149
  set goal-y 55
  ask patch goal-x goal-y [
    sprout 1 [ set pcolor red
      set shape "square"  
    ]
  ]
end 

to draw-exit12
  set goal-x -8
  set goal-y 85
  ask patch goal-x goal-y [
    sprout 1 [ set pcolor red
      set shape "square"  
    ]
  ]
end 

to draw-exit13
  set goal-x -1
  set goal-y 85
  ask patch goal-x goal-y [
    sprout 1 [ set pcolor red
      set shape "square"  
    ]
  ]
end 

to draw-exit14
  set goal-x 8
  set goal-y 85
  ask patch goal-x goal-y [
    sprout 1 [ set pcolor red
      set shape "square"  
    ]
  ]
end 

to draw-exit15
  set goal-x -6
  set goal-y 85
  ask patch goal-x goal-y [
    sprout 1 [ set pcolor red
      set shape "square"  
    ]
  ]
end 

to draw-exit16
  set goal-x 6
  set goal-y 85
  ask patch goal-x goal-y [
    sprout 1 [ set pcolor red
      set shape "square"  
    ]
  ]
end 

to go
  ask turtles with [pcolor != red] [walk] ;asks turtles with patch color not equal to red carry out function walk
  
  if all? turtles [ pcolor = red ];stops simuation
    [ stop ]
  spread
  tick
end 

to spread ;this is the spread of fear.
          ;when one turtle with fear is near another without,
          ;the other has a chance of also getting scared, according to slider on interface, spreadfear
  
  ask turtles with [fear? = true and pcolor != red]
    [ ask other turtles-here with [fear? = false ]
      [ if (random-float 100) < spreadfear
        [ getscared ] ] ]
end 

to walk; tells what directions turtles are to go in, and to actually move.
  
       ;Kirwan
  if xcor >= 6 and xcor <= 7 and ycor > -20 and ycor < 24 [set heading 0]
  if xcor <= -6 and xcor >= -7 and ycor > -20 and ycor < 24 [set heading 0]
  ;if xcor = 7 and ycor > -20 and ycor < 24 [set heading 0]
  ;if xcor = -7 and ycor > -20 and ycor < 24 [set heading 0]
  
  ;Larmour
  if xcor <= 17 and xcor >= 16 and ycor >= 23 and ycor <= 39 [set heading 0]
  if xcor >= 29 and xcor <= 30 and ycor >= 23 and ycor <= 39 [set heading 0]
  
  ;Dillon
  if xcor >= -17 and xcor <= -16 and ycor > 23 and ycor < 39 [set heading 0]
  if xcor <= -29 and xcor >= -30 and ycor > 23 and ycor < 39 [set heading 0]
  
  ;AC201
  if xcor = 35 and ycor < 48 and ycor > 39 [set heading 0]
  if xcor = 56 and ycor < 48 and ycor > 39 [set heading 0] 
  
  ;AC202
  if xcor > 57 and xcor <= 64 and ycor = 48 [set heading -90]
  if xcor > 64 and xcor < 72 and ycor = 48 [set heading 90]
  
  ;AC203
  if xcor > 74 and xcor <= 84 and ycor = 48 [set heading -90]
  
  ;AC204
  if xcor >= 86 and xcor <= 95 and ycor = 48 [set heading -90] 
  
  ;O'Flaherty
  if xcor >= 101 and xcor <= 102 and ycor > 9 and ycor < 43[set heading 0]
  ;if xcor = 102 and ycor > 9 and ycor < 43[set heading 0]
  if xcor >= 113 and xcor <= 114 and ycor > 9 and ycor < 43[set heading 0]
  ;if xcor = 114 and ycor > 9 and ycor < 43[set heading 0]
  
  ;D'arcy Thompson
  if xcor >= 119.0 and xcor <= 119.99 and ycor > -1 and ycor < 23[set heading 0]
  if xcor >= 135.0 and xcor <= 135.99 and ycor > -1 and ycor < 23[set heading 0]
  
  ;Cairnes
  if xcor >= 140.0 and xcor <= 141.9 and ycor < 43 [set heading 0]
  ;if xcor = 141 and ycor < 43 [set heading 0]
  if xcor >= 153.0 and xcor <= 154.9 and ycor < 43 [set heading 0]
  ;if xcor = 154 and ycor < 43 [set heading 0]
  
  ;;McMunn
  if xcor >= -139 and xcor <= -138 and ycor > 25 and ycor < 41[set heading 0]
  ;if xcor = -138 and ycor > 25 and ycor < 41[set heading 0]
  if xcor >= -127 and xcor <= -126 and ycor > 25 and ycor < 41[set heading 0]
  ;if xcor = -126 and ycor > 25 and ycor < 41[set heading 0]
  
  if fear? = true [fd 1] ;if scared, turtles move faster.
  if fear? = false  [fd .5]
  
  exit
end 

to fear
  ;ask some initialy scared turtles to get scared
  ask n-of initially-scared turtles with [size = 1] [getscared] 
end 

to getscared ;changes turtles
  set color red 
  set fear? true
end 

to exit ;directs turtles to exits after they leave theatres
  
  ask turtles with [pxcor > 13 and pxcor < 98 and pycor <= 52 and pycor >= 51] [ set heading -90]
  ask turtles with [pxcor = 10 and pycor <= 52 and pycor >= 51] [face one-of turtles with [shape = "square" and xcor > 5 and xcor < 9 and ycor = 85]]
  ask turtles with [fear? = true and fast? = true and pycor = 55 and pxcor <= 13 and pxcor >= -13] [face one-of turtles with [shape = "square" and xcor > -9 and xcor < -5 and ycor = 85]]
  ask turtles with [pcolor = white] [die]
  
  ;Cairnes
  ask turtles with [pxcor >= 137.0 and pycor >= 43 and pycor <= 44 and pxcor <= 157.9] [face one-of turtles with [shape = "square" and xcor > 131 and ycor = 55 ]]
  
  ;D'arcy Thompson
  ask turtles with [pxcor >= 119 and pxcor <= 120 and pycor = 32] [face one-of turtles with [shape = "square" and xcor > 131 and ycor = 55]]
  ask turtles with [pxcor >= 135.0 and pxcor <= 135.99 and pycor = 43] [face one-of turtles with [shape = "square" and xcor > 131 and ycor = 55]]
  ask turtles with [pxcor >= 133 and pxcor <= 136 and pycor = 47] [face one-of turtles with [shape = "square" and xcor > 131 and ycor = 55]]
  
  ;O'Flaherty
  ask turtles with [pxcor >= 100 and pycor >= 43 and pycor <= 44 and pxcor <= 116] [face one-of turtles with [shape = "square" and xcor > 131 and ycor = 55 ]]
  
  ;AC204
  ask turtles with [pxcor = 85 and pycor = 48] [set heading 0]
  ask turtles with [pxcor = 85 and pycor = 49] [face one-of turtles with [shape = "square" and xcor > 131 and ycor = 55]]
  
  ;AC203
  ask turtles with [pxcor = 74 and pycor = 48] [set heading 0]
  ask turtles with [pxcor = 74 and pycor = 49] [face one-of turtles with [shape = "square" and xcor > -17 and ycor > 50]] 
  
  ;AC202
  ask turtles with [pxcor = 72 and pycor = 48] [ set heading 0]
  ask turtles with [pxcor = 57 and pycor = 48] [set heading 0]
  ask turtles with [pxcor = 72 and pycor = 49] [face one-of turtles with [shape = "square" and xcor > -17 and ycor > 50]]
  ask turtles with [pxcor = 57 and pycor = 49] [face one-of turtles with [shape = "square" and xcor > -17 and ycor > 50]]
  
  ;AC201
  ask turtles with [pxcor = 56 and pycor = 48] [set heading 0]
  ask turtles with [pxcor = 35 and pycor = 48] [set heading 0]
  ask turtles with [pxcor = 56 and pycor = 49] [face one-of turtles with [shape = "square" and xcor > 5 and xcor < 9 and ycor = 85]]
  ask turtles with [pxcor = 35 and pycor = 49] [face one-of turtles with [shape = "square" and xcor > 5 and xcor < 9 and ycor = 85]]
  
  ;McMunn
  ask turtles with [pxcor >= -140 and pycor = 42 and pxcor <= -125] [face one-of turtles with [shape = "square" and xcor <= -130 and xcor >= -135 and ycor = 55 ]]
  
  ;Dillon
  ask turtles with [pxcor >= -33 and pycor >= 39 and pycor <= 40 and pxcor <= -14] [face patch -10 52]
  ask turtles with [pxcor = -10 and pycor = 52] [face one-of turtles with [shape = "square" and xcor < -5 and xcor > -9 and ycor = 85]]
  ask turtles with [pxcor = -15 and pycor = 43 and fear? = true and fast? = true] [face turtle 2]
  
  ;Larmour
  ask turtles with [pxcor >= 14 and pycor = 39 and pxcor <= 33] [face patch 10 52]
  ask turtles with [pxcor = 29 and pycor = 49 and fear? = true and fast? = true] [face one-of turtles with [shape = "square" and xcor > 131 and ycor = 55 ]]
end 

There are 2 versions of this model.

Uploaded by When Description Download
David Haynes about 6 years ago Updated code Download this version
David Haynes about 6 years ago Initial upload Download this version

Attached files

No files

This model does not have any ancestors.

This model does not have any descendants.