Sample tsunami evacuation

No preview image

1 collaborator

Default-person Luke Newman (Author)

Tags

(This model has yet to be categorized with any tags)
Visible to everyone | Changeable by everyone
Model was written in NetLogo 5.1.0 • Viewed 442 times • Downloaded 43 times • Run 0 times
Download the 'Sample tsunami 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.)


Comments and Questions

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

Click to Run Model

extensions [bitmap]

breed [citizens]
breed [tourists]

patches-own [EvacuationPoint Buildings]
turtles-own [ tsunami-seen ]

to setup-patches
  ca
  import-pcolors "C:/Users/Nox/Documents/GIS PgDip/Modelling for Geographic Phenomena/Assignment/Data/streetgrid.gif"
    let SafeSpot (list (patch -90 90) (patch 0 90) (patch 90 90) 
                              (patch -90 0) (patch 90 0) (patch -90 -90)
                              (patch 0 -90) (patch 90 -90))
    foreach SafeSpot [ask ?[set pcolor green
                                   set EvacuationPoint 1]] ;;creation of evacuation zones
    let building (list (patch -56 22) (patch -12 39) (patch -46 12) (patch 8 67) (patch 38 19))
    foreach building [ask ?[set pcolor brown
        set Buildings 1]]                                  ;;creation of buildings
end  

to setup
  setup-patches
  create-citizens 360 [
    set color red 
    setxy random-xcor random-ycor 
    set tsunami-seen 0
  ]
    reset-ticks                                           ;;creation of citizens (360)
  create-tourists
  tourist-pop [
    set color yellow
    setxy random-xcor random-ycor
    set tsunami-seen 0
  ]
    reset-ticks                                           ;;creation of tourists
end 

to go
  if ticks > 30 [ ask patch 16 0 [ set pcolor blue ]]
  tsunami
  ask citizens [
    check-tsunami
    if tsunami-seen = 0 [ move-citizens ]
    if tsunami-seen = 1 [ face min-one-of patches with [ pcolor = green ] [ distance myself ]
    forward 1
    if pcolor = blue [ die ]
  ]]
  tick                                                   ;; citizens run towards nearest evac point if tsunami seen
  ask tourists [
    check-tsunami
    if tsunami-seen = 0 [ move-tourists ]
    if tsunami-seen = 1 [ face min-one-of patches with [ pcolor = brown ] [ distance myself ]
    forward 1
    if pcolor = blue [ die ]
    ]]
  tick
end                                                       ;; tourists run towards nearest building if tsunami seen

to check-tsunami
  ifelse any? patches in-radius 50 with [pcolor = blue ]= false
    [move-citizens move-tourists]
    [set tsunami-seen 1 ]
end 

to move-citizens
  ifelse coin-flip? [right random 60][left random 60]         ; random movement of turtles
  forward 0.5
end 

to move-tourists
  ifelse coin-flip? [right random 60][left random 60]         ; random movement of turtles
  forward 0.5
end 

to tsunami
  if ticks > 30                                    ; wait for 30 seconds before tsunami starts
  [ask patches with [pcolor = blue]
  [ask patches in-radius 1.5 with [pcolor < 10 and pcolor > 0] [set pcolor blue] ]    ; if patches within 1.5 patches are not blue, make blue. This is how the tsunami moves
  ]
end 

to-report coin-flip?
  report random 2 = 0
end 
  






  
  
  
  

There is only one version of this model, created over 3 years ago by Luke Newman.

Attached files

No files

This model does not have any ancestors.

This model does not have any descendants.